View previous topic :: View next topic |
Author |
Message |
lbr Guru
![Guru Guru](/images/ranks/rank_rect_3.gif)
Joined: 05 Apr 2004 Posts: 503 Location: Paris
|
Posted: Wed Jan 05, 2005 4:44 pm Post subject: [reseau] routes statiques |
|
|
Bonjour,
J'ai installé une deuxiéme carte réseau sur lon poste. Pour lui affecter un adresse IP : pas de bleme
En revanche, je voudrais que certaine adresses soient routées par cette carte et d'autres adresses par la premiere carte; je voudrais faire un genre de route add -net xxxxx etc.
Mais je voudrais le faire une fois pour toute, et non à chaque fois que je me logue.
ajouter la ligne qui va bien dans rc.conf/net me semble la bonne manière : mais qu'y mettre ?
Code: | routes_eth1="192.9.9.0 broadcast 192.9.9.255 netmask 255.255.255.0" |
ca ne marche pas et je n'arrive pas à trouver de la doc sur le sujet, sauf une syntaxe qui me parait "deprecated"
Code: | routes_eth0=(
"default via 192.168.5.1"
) |
Quid ?
Merci.
Last edited by lbr on Fri Jan 07, 2005 10:18 am; edited 2 times in total |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
Pachacamac Veteran
![Veteran Veteran](/images/ranks/rank_rect_5_vet.gif)
![](images/avatars/64980873541e17d1288359.jpg)
Joined: 22 Nov 2003 Posts: 1264 Location: Paris - France
|
Posted: Wed Jan 05, 2005 7:42 pm Post subject: |
|
|
Pourquoi tu ne fais pas toi même ton script pour qu'il se lance quand tu le désires ? |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
Polo l33t
![l33t l33t](/images/ranks/rank_rect_4.gif)
![](images/avatars/1278817250425e38f438099.png)
Joined: 27 Jan 2004 Posts: 649 Location: Angers, France
|
Posted: Wed Jan 05, 2005 7:47 pm Post subject: |
|
|
ouai, tu peux ajouter les commandes que tu fait a chaque fois dans /etc/conf.d/local.start
c'est fait pour ca !! ![Smile :)](images/smiles/icon_smile.gif) |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
lbr Guru
![Guru Guru](/images/ranks/rank_rect_3.gif)
Joined: 05 Apr 2004 Posts: 503 Location: Paris
|
Posted: Thu Jan 06, 2005 1:33 pm Post subject: |
|
|
Apparemment y'a pas de solution made in Gentoo
Alors je vais me bidouiller un script qui va bien ... |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
Pachacamac Veteran
![Veteran Veteran](/images/ranks/rank_rect_5_vet.gif)
![](images/avatars/64980873541e17d1288359.jpg)
Joined: 22 Nov 2003 Posts: 1264 Location: Paris - France
|
Posted: Thu Jan 06, 2005 3:12 pm Post subject: |
|
|
Oui, c'est ce qu'il faut faire.
Ils sont en général bien commenté, sinon tu as de la doc sur le site officiel. |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
guilc Bodhisattva
![Bodhisattva Bodhisattva](/images/ranks/rank-bodhisattva.gif)
![](images/avatars/190892864153fcc64a2a920.jpg)
Joined: 15 Nov 2003 Posts: 3326 Location: Paris - France
|
Posted: Thu Jan 06, 2005 4:40 pm Post subject: |
|
|
Heu, je vois pas vraiment le problème.... Chez moi, j'utilise ça :
Code: | routes_eth0=(
"192.168.0.0/16 via 192.168.6.254"
"193.54.225.74 via 192.168.6.254"
"193.54.225.85 via 192.168.6.254"
"193.54.225.81 via 192.168.6.254"
"193.54.195.212 via 192.168.6.254"
"default via 192.168.6.33"
"2001:7a8:2b1b::/48"
"2000::/3 via 2001:7a8:2b1b::33"
) |
Et ça marche très bien, ça fait ce que tu cherche si j'ai bein compris ta demande...
Et petite info, cette syntaxe n'est pas du tout deprecated : c'est la syntaxe iproute2 (et pas net-tools) _________________ Merci de respecter les règles du forum.
Mon site perso : https://www.xwing.info
Mon PORTDIR_OVERLAY : https://gentoo.xwing.info ou layman -a xwing |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
lbr Guru
![Guru Guru](/images/ranks/rank_rect_3.gif)
Joined: 05 Apr 2004 Posts: 503 Location: Paris
|
Posted: Thu Jan 06, 2005 5:01 pm Post subject: |
|
|
Quote: | Et petite info, cette syntaxe n'est pas du tout deprecated : c'est la syntaxe iproute2 (et pas net-tools) |
Ok ! j'ai donc lu des conneries sur le net
Je vais faire comme toi, ca me parait mieux que le coup du script perso.
Merci |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
guilc Bodhisattva
![Bodhisattva Bodhisattva](/images/ranks/rank-bodhisattva.gif)
![](images/avatars/190892864153fcc64a2a920.jpg)
Joined: 15 Nov 2003 Posts: 3326 Location: Paris - France
|
Posted: Thu Jan 06, 2005 5:12 pm Post subject: |
|
|
Petite précision : n'oublie pas Code: | modules_eth0=( "iproute2" ) | dans ta conf aussi, sinon il ne reconnaitra pas la syntaxe ![Wink ;)](images/smiles/icon_wink.gif) _________________ Merci de respecter les règles du forum.
Mon site perso : https://www.xwing.info
Mon PORTDIR_OVERLAY : https://gentoo.xwing.info ou layman -a xwing |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
lbr Guru
![Guru Guru](/images/ranks/rank_rect_3.gif)
Joined: 05 Apr 2004 Posts: 503 Location: Paris
|
Posted: Thu Jan 06, 2005 6:49 pm Post subject: |
|
|
Quote: | Petite précision : n'oublie pas
Code:
modules_eth0=( "iproute2" )
dans ta conf aussi, sinon il ne reconnaitra pas la syntaxe Wink |
Dans conf.d/net ? |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
guilc Bodhisattva
![Bodhisattva Bodhisattva](/images/ranks/rank-bodhisattva.gif)
![](images/avatars/190892864153fcc64a2a920.jpg)
Joined: 15 Nov 2003 Posts: 3326 Location: Paris - France
|
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
lbr Guru
![Guru Guru](/images/ranks/rank_rect_3.gif)
Joined: 05 Apr 2004 Posts: 503 Location: Paris
|
Posted: Fri Jan 07, 2005 10:17 am Post subject: |
|
|
Désolé mais ca marche pas ...
mon conf.d/net :
Code: | # This is basically the ifconfig argument without the ifconfig $iface
#
iface_eth0="10.1.2.49 broadcast 10.1.2.255 netmask 255.255.255.0"
iface_eth1="192.168.112.38 broadcast 192.168.112.255 netmask 255.255.255.0"
#Ajout des routes statiques pour XXXX
modules_eth1=( "iproute2" )
routes_eth1=(
"192.5.60.0/24 via 192.168.112.100
"192.8.8.0/24 via 192.168.112.100
"192.9.9.0/24 via 192.168.112.100
"192.9.10.0/24 via 192.168.112.100
"192.9.11.0/24 via 192.168.112.100
"192.7.7.0/24 via 192.168.112.100
)
gateway="eth0/10.1.2.254"
|
et /etc/init.d/net.eth1 restart :
Code: | * Bringing eth1 down... [ ok ] * Bringing eth1 up (192.168.112.38)... [ ok ] * Adding routes
* 192.5.60.0/24 via 192.168.112.100
192.8.8.0/24...
Syntaxe: inet_route [-vF] del {-host|-net} Cible[/prefix] [gw Gw] [metric M] [[dev] If]
inet_route [-vF] add {-host|-net} Cible[/prefix] [gw Gw] [metric M]
[netmask N] [mss Mss] [window W] [irtt I]
[mod] [dyn] [reinstate] [[dev] If]
inet_route [-vF] add {-host|-net} Cible[/prefix] [metric M] reject
inet_route [-FC] flush PAS supporté [ !! ]
* via...
via: Erreur de repérage du nom de l'hôte cible [ !! ]
* 192.168.112.100...
SIOCADDRT: Aucun périphérique de ce type [ !! ]
* 192.9.9.0/24 via 192.168.112.100
192.9.10.0/24...
Syntaxe: inet_route [-vF] del {-host|-net} Cible[/prefix] [gw Gw] [metric M] [[dev] If]
inet_route [-vF] add {-host|-net} Cible[/prefix] [gw Gw] [metric M]
[netmask N] [mss Mss] [window W] [irtt I]
[mod] [dyn] [reinstate] [[dev] If]
inet_route [-vF] add {-host|-net} Cible[/prefix] [metric M] reject
inet_route [-FC] flush PAS supporté [ !! ]
* via...
via: Erreur de repérage du nom de l'hôte cible [ !! ]
* 192.168.112.100...
SIOCADDRT: Aucun périphérique de ce type [ !! ]
* 192.9.11.0/24 via 192.168.112.100
192.7.7.0/24...
Syntaxe: inet_route [-vF] del {-host|-net} Cible[/prefix] [gw Gw] [metric M] [[dev] If]
inet_route [-vF] add {-host|-net} Cible[/prefix] [gw Gw] [metric M]
[netmask N] [mss Mss] [window W] [irtt I]
[mod] [dyn] [reinstate] [[dev] If]
inet_route [-vF] add {-host|-net} Cible[/prefix] [metric M] reject
inet_route [-FC] flush PAS supporté [ !! ]
* via...
via: Erreur de repérage du nom de l'hôte cible [ !! ]
* 192.168.112.100...
SIOCADDRT: Aucun périphérique de ce type [ !! ]
|
![Question :?:](images/smiles/icon_question.gif) |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
lbr Guru
![Guru Guru](/images/ranks/rank_rect_3.gif)
Joined: 05 Apr 2004 Posts: 503 Location: Paris
|
Posted: Fri Jan 07, 2005 10:23 am Post subject: |
|
|
lbr wrote: | ...
routes_eth1=(
"192.5.60.0/24 via 192.168.112.100
"192.8.8.0/24 via 192.168.112.100
"192.9.9.0/24 via 192.168.112.100
"192.9.10.0/24 via 192.168.112.100
"192.9.11.0/24 via 192.168.112.100
"192.7.7.0/24 via 192.168.112.100
)
...
[/code]
et /etc/init.d/net.eth1 restart :
![Question :?:](images/smiles/icon_question.gif) |
Lire : Code: | routes_eth1=(
"192.5.60.0/24 via 192.142.112.100"
"192.8.8.0/24 via 192.142.112.100"
"192.9.9.0/24 via 192.142.112.100"
"192.9.10.0/24 via 192.142.112.100"
"192.9.11.0/24 via 192.142.112.100"
"192.7.7.0/24 via 192.142.112.100"
)
|
ca ne marche pas avec les quotes fermantes non plus. :
Code: | * Bringing eth1 down... [ ok ] * Bringing eth1 up (192.168.112.38)... [ ok ] * Adding routes
* 192.5.60.0/24 via 192.168.112.100...
Syntaxe: inet_route [-vF] del {-host|-net} Cible[/prefix] [gw Gw] [metric M] [[dev] If]
inet_route [-vF] add {-host|-net} Cible[/prefix] [gw Gw] [metric M]
[netmask N] [mss Mss] [window W] [irtt I]
[mod] [dyn] [reinstate] [[dev] If]
inet_route [-vF] add {-host|-net} Cible[/prefix] [metric M] reject
inet_route [-FC] flush PAS supporté [ !! ]
* 192.8.8.0/24 via 192.168.112.100...
Syntaxe: inet_route [-vF] del {-host|-net} Cible[/prefix] [gw Gw] [metric M] [[dev] If]
inet_route [-vF] add {-host|-net} Cible[/prefix] [gw Gw] [metric M]
[netmask N] [mss Mss] [window W] [irtt I]
[mod] [dyn] [reinstate] [[dev] If]
inet_route [-vF] add {-host|-net} Cible[/prefix] [metric M] reject
inet_route [-FC] flush PAS supporté [ !! ]
* 192.9.9.0/24 via 192.168.112.100...
Syntaxe: inet_route [-vF] del {-host|-net} Cible[/prefix] [gw Gw] [metric M] [[dev] If]
inet_route [-vF] add {-host|-net} Cible[/prefix] [gw Gw] [metric M]
[netmask N] [mss Mss] [window W] [irtt I]
[mod] [dyn] [reinstate] [[dev] If]
inet_route [-vF] add {-host|-net} Cible[/prefix] [metric M] reject
inet_route [-FC] flush PAS supporté [ !! ]
* 192.9.10.0/24 via 192.168.112.100...
Syntaxe: inet_route [-vF] del {-host|-net} Cible[/prefix] [gw Gw] [metric M] [[dev] If]
inet_route [-vF] add {-host|-net} Cible[/prefix] [gw Gw] [metric M]
[netmask N] [mss Mss] [window W] [irtt I]
[mod] [dyn] [reinstate] [[dev] If]
inet_route [-vF] add {-host|-net} Cible[/prefix] [metric M] reject
inet_route [-FC] flush PAS supporté [ !! ]
* 192.9.11.0/24 via 192.168.112.100...
Syntaxe: inet_route [-vF] del {-host|-net} Cible[/prefix] [gw Gw] [metric M] [[dev] If]
inet_route [-vF] add {-host|-net} Cible[/prefix] [gw Gw] [metric M]
[netmask N] [mss Mss] [window W] [irtt I]
[mod] [dyn] [reinstate] [[dev] If]
inet_route [-vF] add {-host|-net} Cible[/prefix] [metric M] reject
inet_route [-FC] flush PAS supporté [ !! ]
* 192.7.7.0/24 via 192.168.112.100...
Syntaxe: inet_route [-vF] del {-host|-net} Cible[/prefix] [gw Gw] [metric M] [[dev] If]
inet_route [-vF] add {-host|-net} Cible[/prefix] [gw Gw] [metric M]
[netmask N] [mss Mss] [window W] [irtt I]
[mod] [dyn] [reinstate] [[dev] If]
inet_route [-vF] add {-host|-net} Cible[/prefix] [metric M] reject
inet_route [-FC] flush PAS supporté [ !! ]
|
|
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
sireyessire Advocate
![Advocate Advocate](/images/ranks/rank-G-1-advocate.gif)
![](images/avatars/184146537040140c2d83e95.jpg)
Joined: 20 Mar 2003 Posts: 2991 Location: back in Paris, France
|
Posted: Fri Jan 07, 2005 10:23 am Post subject: |
|
|
lbr wrote: | Désolé mais ca marche pas ...
mon conf.d/net :
Code: | # This is basically the ifconfig argument without the ifconfig $iface
#
iface_eth0="10.1.2.49 broadcast 10.1.2.255 netmask 255.255.255.0"
iface_eth1="192.168.112.38 broadcast 192.168.112.255 netmask 255.255.255.0"
#Ajout des routes statiques pour XXXX
modules_eth1=( "iproute2" )
routes_eth1=(
"192.5.60.0/24 via 192.168.112.100
"192.8.8.0/24 via 192.168.112.100
"192.9.9.0/24 via 192.168.112.100
"192.9.10.0/24 via 192.168.112.100
"192.9.11.0/24 via 192.168.112.100
"192.7.7.0/24 via 192.168.112.100
)
gateway="eth0/10.1.2.254"
|
|
faut fermer les guilllemets!!!
[edit] grillé.
mais sinon tu l'as installé iproute2? _________________ I never think of the future. It comes soon enough.
Albert Einstein
Try simpler first
Shockley |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
lbr Guru
![Guru Guru](/images/ranks/rank_rect_3.gif)
Joined: 05 Apr 2004 Posts: 503 Location: Paris
|
Posted: Fri Jan 07, 2005 10:38 am Post subject: |
|
|
je viens d'emerger iproute2
Pareil
il me renvoie la syntaxe à la face : Code: | Syntaxe: inet_route [-vF] del {-host|-net} Cible[/prefix] [gw Gw] [metric M] [[dev] If]
inet_route [-vF] add {-host|-net} Cible[/prefix] [gw Gw] [metric M]
[netmask N] [mss Mss] [window W] [irtt I]
[mod] [dyn] [reinstate] [[dev] If]
inet_route [-vF] add {-host|-net} Cible[/prefix] [metric M] reject
inet_route [-FC] flush PAS supporté |
|
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
Pachacamac Veteran
![Veteran Veteran](/images/ranks/rank_rect_5_vet.gif)
![](images/avatars/64980873541e17d1288359.jpg)
Joined: 22 Nov 2003 Posts: 1264 Location: Paris - France
|
Posted: Fri Jan 07, 2005 7:41 pm Post subject: |
|
|
Et avec /etc/conf.d/local.start ? Ca marche très bien... mieux ? ![Razz :P](images/smiles/icon_razz.gif) |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
|