Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Correct place for static routes
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
ycUygB1
Apprentice
Apprentice


Joined: 27 Jul 2005
Posts: 276
Location: Portland, Oregon

PostPosted: Sat Sep 17, 2005 1:19 pm    Post subject: Correct place for static routes Reply with quote

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
View user's profile Send private message
Oliv
n00b
n00b


Joined: 17 Sep 2005
Posts: 35
Location: Montpellier (France)

PostPosted: Sat Sep 17, 2005 6:07 pm    Post subject: Reply with quote

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
View user's profile Send private message
ycUygB1
Apprentice
Apprentice


Joined: 27 Jul 2005
Posts: 276
Location: Portland, Oregon

PostPosted: Sat Sep 17, 2005 6:29 pm    Post subject: tres bien Reply with quote

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
View user's profile Send private message
Oliv
n00b
n00b


Joined: 17 Sep 2005
Posts: 35
Location: Montpellier (France)

PostPosted: Sat Sep 17, 2005 8:05 pm    Post subject: Reply with quote

Yes, that's my first day in this forum :oops:
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
View user's profile Send private message
gerdesj
l33t
l33t


Joined: 29 Sep 2005
Posts: 622
Location: Yeovil, Somerset, UK

PostPosted: Thu Oct 20, 2005 8:45 am    Post subject: Re: tres bien Reply with quote

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
View user's profile Send private message
UberLord
Retired Dev
Retired Dev


Joined: 18 Sep 2003
Posts: 6835
Location: Blighty

PostPosted: Thu Oct 20, 2005 9:20 am    Post subject: Re: tres bien Reply with quote

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
View user's profile Send private message
gerdesj
l33t
l33t


Joined: 29 Sep 2005
Posts: 622
Location: Yeovil, Somerset, UK

PostPosted: Thu Oct 20, 2005 11:11 am    Post subject: Re: tres bien Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum