Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[SOLVED] Routing...
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
wilf
Tux's lil' helper
Tux's lil' helper


Joined: 12 Feb 2006
Posts: 131
Location: West Sussex, UK

PostPosted: Tue May 15, 2007 11:55 pm    Post subject: [SOLVED] Routing... Reply with quote

Hello,

I have built a box for a customer which has the following static ip setupin /etc/conf.d/net.eth0

Code:
vm-host conf.d # cat net.eth0
modules=("ifconfig" )
config_eth0=( "10.0.253.72 netmask 255.255.0.0 broadcast 10.0.253.255" )
routes_eth0=( "10.0.253.0/24 via 10.0.254.2" )
When the machine is booted up, you get this:-
Code:
vm-host ipv4 # route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
10.0.253.133    0.0.0.0         255.255.255.255 UH    0      0        0 venet0
10.0.253.0      10.0.254.2      255.255.255.0   UG    0      0        0 eth0
10.0.0.0        0.0.0.0         255.255.0.0     U     0      0        0 eth0
127.0.0.0       0.0.0.0         255.0.0.0       U     0      0        0 lo
What I really want is this
Code:
vm-host ipv4 # route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
10.0.253.133    0.0.0.0         255.255.255.255 UH    0      0        0 venet0
10.0.253.0      10.0.254.2      255.255.255.0   UG    0      0        0 eth0
10.0.0.0        0.0.0.0         255.255.0.0     U     0      0        0 eth0
127.0.0.0       0.0.0.0         255.0.0.0       U     0      0        0 lo
0.0.0.0         10.0.254.2      0.0.0.0         UG    0      0        0 eth0
To get this this, I have to do a
Code:
route add default gw 10.0.254.2 dev eth0
after booting. I thought the line
Code:
routes_eth0=( "10.0.253.0/24 via 10.0.254.2" )
did this in net.eth0. Please will you show me how to get the bottom routing table by correctly configuring net.eth0 so that I don't have to run that route command after booting.

Best Regards, Paul.


Last edited by wilf on Wed May 16, 2007 4:42 pm; edited 1 time in total
Back to top
View user's profile Send private message
think4urs11
Bodhisattva
Bodhisattva


Joined: 25 Jun 2003
Posts: 6659
Location: above the cloud

PostPosted: Wed May 16, 2007 3:44 am    Post subject: Reply with quote

The netmask and the broadcast address do not match.
Either the netmask is 255.255.255.0 or the broadcast is 10.0.255.255; the combination shown makes no sense.

As the machine itself is in 10.0.253.0/24 the route is completely unneeded; it should be generated automagically anyhow.
_________________
Nothing is secure / Security is always a trade-off with usability / Do not assume anything / Trust no-one, nothing / Paranoia is your friend / Think for yourself
Back to top
View user's profile Send private message
erik258
Advocate
Advocate


Joined: 12 Apr 2005
Posts: 2650
Location: Twin Cities, Minnesota, USA

PostPosted: Wed May 16, 2007 3:50 am    Post subject: Reply with quote

routes_eth0=(" default via 10.0.254.2" )
_________________
Configuring a Firewall? Try my iptables configuration
LinuxCommando.com is my blog for linux-related scraps and tidbits. Stop by for a visit!
Back to top
View user's profile Send private message
wilf
Tux's lil' helper
Tux's lil' helper


Joined: 12 Feb 2006
Posts: 131
Location: West Sussex, UK

PostPosted: Wed May 16, 2007 4:42 pm    Post subject: Reply with quote

Hello Think4UrS11 and erik258,

I have modified the base instance ( the machine is running OpenVZ) and incorporated both your observations - with success.
Code:
config_eth0=( "10.0.253.72 netmask 255.255.0.0 broadcast 10.0.255.255" )
routes_eth0=("-net 10.0.253.0/24" "default via 10.0.254.2" )


So thank you both very much.

I must say with a name like Think4UrS11 I did feel guilty for asking :-)

I have other problems within the live instance, so I am off to the OpenVZ forums.

Hey ho, Hey Ho, it's off to work I go...

Best Regards, Paul.
Back to top
View user's profile Send private message
erik258
Advocate
Advocate


Joined: 12 Apr 2005
Posts: 2650
Location: Twin Cities, Minnesota, USA

PostPosted: Wed May 16, 2007 8:57 pm    Post subject: Reply with quote

Think4UrS11 wrote:
The netmask and the broadcast address do not match.
Either the netmask is 255.255.255.0 or the broadcast is 10.0.255.255; the combination shown makes no sense.

As the machine itself is in 10.0.253.0/24 the route is completely unneeded; it should be generated automagically anyhow.


Yes, I tripped over this as well. I went with the assumption that there could be a network 10.0/16, and within that a subnet 10.0.0/24. Of course, this means that the subnets' host ip ranges overlap a little, but that shouldn't be a problem until they start conflicting. At least, anything on 10.0/16 with an address of 10.0.0,xx certainly is going to look like it's on both subnets.

I don't know whether this is a good idea, but I wanted to give wilf the benefit of the doubt.


Code:
As the machine itself is in 10.0.253.0/24 the route is completely unneeded; it should be generated automagically anyhow.

Quite so. I was going to say so, but then looked closely and realized that 10.0.253.72/16 isn't on that subnet, so you'll still need a route to 10.0.0/24. The router is on 10.0/16 of course, and that route will be set up automatically by the config_eth0 line.
_________________
Configuring a Firewall? Try my iptables configuration
LinuxCommando.com is my blog for linux-related scraps and tidbits. Stop by for a visit!
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