View previous topic :: View next topic |
Author |
Message |
ycUygB1 Apprentice
Joined: 27 Jul 2005 Posts: 276 Location: Portland, Oregon
|
Posted: Sat Sep 17, 2005 1:19 pm Post subject: Correct place for static routes |
|
|
What is the correct place to put a static route?
I know I could add
Quote: | route add -net 192.168.37.0 netmask 255.255.255.0 gw 192.168.62.2 |
to /etc/conf.d/local.start, but is that the correct place for it?
It is tempting to try and add the route to /etc/conf.d/net in the routes_eth0 variable,
but I'm not sure how to do that. |
|
Back to top |
|
|
Oliv n00b
Joined: 17 Sep 2005 Posts: 35 Location: Montpellier (France)
|
Posted: Sat Sep 17, 2005 6:07 pm Post subject: |
|
|
Hi,
you're rigth, /etc/conf.d/net seems to be a more suitable place
try to add the following line:
Code: | routes_eth0=( "-net 192.168.37.0 netmask 255.255.255.0 gw 192.168.62.2" ) |
|
|
Back to top |
|
|
ycUygB1 Apprentice
Joined: 27 Jul 2005 Posts: 276 Location: Portland, Oregon
|
Posted: Sat Sep 17, 2005 6:29 pm Post subject: tres bien |
|
|
Well, that worked well. Is that syntax documented anywhere?
This is your first day in the Gentoo forum? You seem to be doing pretty well. Much better than I was on my first day!
Harold |
|
Back to top |
|
|
Oliv n00b
Joined: 17 Sep 2005 Posts: 35 Location: Montpellier (France)
|
Posted: Sat Sep 17, 2005 8:05 pm Post subject: |
|
|
Yes, that's my first day in this forum
But I've played with LFS during one year, so I quick understand how things work compared to a real newbie
About the syntax, I've not found a real document about (If someone know a manpage or something like that)... But according to what I've understood, I think it works like this:
-the keywords routes_eth0 will call route if you use" ifconfig" module and ip route if you use "iproute2" module
-then it appends the option beetween " " to the add option if that's a start script and the del option if that's a stop script
Hope my explanations are clear enough... |
|
Back to top |
|
|
gerdesj l33t
Joined: 29 Sep 2005 Posts: 622 Location: Yeovil, Somerset, UK
|
Posted: Thu Oct 20, 2005 8:45 am Post subject: Re: tres bien |
|
|
Just in case it helps someone, here's a more complete example:
Code: | modules=( "iproute2" )
config_eth0=( "192.168.100.140/32" )
routes_eth0=( "default via 192.168.100.1"
"192.168.100/24 dev eth0"
"172.16/16 via 192.168.100.1"
"172.18/16 via 192.168.100.1"
)
#ip r a default via 192.168.100.1
#ip r a 192.168.100/24 dev eth0
#ip r a 172.16/16 via 192.168.100.1
#ip r a 172.18/16 via 192.168.100.1 |
Note that routes_<iface> are the routes that get added/removed when that interface is started stopped. So for eg, if you have an ADSL line, you would put in a routing section that is to be added/removed when the ADSL line is started/stopped (and that section would probably include your default route, rather than the NIC iface)
Here I am using the iproute2 method rather than the current default ifconfig. I would personally recommend you switch (emerge iproute2 first).
For all your other networking needs see /etc/conf.d/net.example. You can do Bridging, TUN/TAP, VLANS, PPPoE and more via this init script which AFAIK is way ahead of any other distro and about time that you can do all this stuff in one place, rather than scattering files around /etc/sysconfig/network-scripts and all that cobblers.
Cheers
Jon
hnaparst wrote: | Well, that worked well. Is that syntax documented anywhere?
This is your first day in the Gentoo forum? You seem to be doing pretty well. Much better than I was on my first day!
Harold |
|
|
Back to top |
|
|
UberLord Retired Dev
Joined: 18 Sep 2003 Posts: 6835 Location: Blighty
|
Posted: Thu Oct 20, 2005 9:20 am Post subject: Re: tres bien |
|
|
gerdesj wrote: |
routes_eth0=( "default via 192.168.100.1"
"192.168.100/24 dev eth0"
"172.16/16 via 192.168.100.1"
"172.18/16 via 192.168.100.1"
) |
Do you need that dev eth0 on the 2nd line?
Quote: | For all your other networking needs see /etc/conf.d/net.example. You can do Bridging, TUN/TAP, VLANS, PPPoE and more via this init script which AFAIK is way ahead of any other distro and about time that you can do all this stuff in one place, rather than scattering files around /etc/sysconfig/network-scripts and all that cobblers. |
Thanks for the compliment _________________ Use dhcpcd for all your automated network configuration needs
Use dhcpcd-ui (GTK+/Qt) as your System Tray Network tool |
|
Back to top |
|
|
gerdesj l33t
Joined: 29 Sep 2005 Posts: 622 Location: Yeovil, Somerset, UK
|
Posted: Thu Oct 20, 2005 11:11 am Post subject: Re: tres bien |
|
|
UberLord wrote: | gerdesj wrote: |
routes_eth0=( "default via 192.168.100.1"
"192.168.100/24 dev eth0"
"172.16/16 via 192.168.100.1"
"172.18/16 via 192.168.100.1"
) |
Do you need that dev eth0 on the 2nd line?
Quote: | For all your other networking needs see /etc/conf.d/net.example. You can do Bridging, TUN/TAP, VLANS, PPPoE and more via this init script which AFAIK is way ahead of any other distro and about time that you can do all this stuff in one place, rather than scattering files around /etc/sysconfig/network-scripts and all that cobblers. |
Thanks for the compliment |
No it isn't necessary, the initscript (I presume) should put that in itself but I just put it there for completeness. I don't get a SIOBLAHBLAH error with it in there but on reflection, remove it. |
|
Back to top |
|
|
|