Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Default route always wrong
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
mvb
n00b
n00b


Joined: 22 May 2006
Posts: 8

PostPosted: Mon May 22, 2006 4:47 pm    Post subject: Default route always wrong Reply with quote

Hi,
how can I set the default route to my second Ethernet card?
In /etc/conf.d/net I've first tried
Code:
config_eth0=( "192.168.227.114 broadcast 192.168.227.255 netmask 255.255.255.0" )
config_eth1=( "213.203.218.134 broadcast 213.203.218.159 netmask 255.255.255.224" )
routes_eth1=( "default via 213.203.218.129" )

but after boot this results in:
Code:
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
213.203.218.128 0.0.0.0         255.255.255.224 U     0      0        0 eth1
192.168.227.0   0.0.0.0         255.255.255.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         213.203.218.129 0.0.0.0         UG    0      0        0 eth1
0.0.0.0         192.168.227.1   0.0.0.0         UG    0      0        0 eth0


No matter how I try I alway get a default route to 192.168.227.1 :(
What did I do wrong?

Thanks in advance

MvB
Back to top
View user's profile Send private message
PsychoticRetina
Guru
Guru


Joined: 18 Dec 2005
Posts: 352
Location: behind the scalpel

PostPosted: Mon May 22, 2006 5:35 pm    Post subject: Re: Default route always wrong Reply with quote

i have no *nix networking experience, but it looks logical to me. youve chosen to specify a gateway for eth1 and the appropriate ip is listed correctly (213.203.218.129). you havent specified any gateway for eth0, so (i assume) the system chooses one - the one it sees as the most probable for the subnet range specified. with a /24 mask, as you have specified for eth0, 192.168.127.1 would be the most probable gateway, as this is the first ip address in that range that is "usable" (192.168.127.0 being a reserved ip address of the whole network.) thats just a guess though.

what value do you expect and what exacly are you trying to achieve? whats your network topology?
_________________
there are pinheads everywhere.
penguins are no exception.
Back to top
View user's profile Send private message
nixnut
Bodhisattva
Bodhisattva


Joined: 09 Apr 2004
Posts: 10974
Location: the dutch mountains

PostPosted: Mon May 22, 2006 5:50 pm    Post subject: Reply with quote

Moved from Installing Gentoo to Networking & Security.
Networking question, so moved here.
_________________
Please add [solved] to the initial post's subject line if you feel your problem is resolved. Help answer the unanswered

talk is cheap. supply exceeds demand
Back to top
View user's profile Send private message
bluedevils
Apprentice
Apprentice


Joined: 21 Jul 2004
Posts: 252
Location: Vancouver BC -> NYC, NY

PostPosted: Mon May 22, 2006 6:37 pm    Post subject: Reply with quote

it looks like it put in two default routes. One is yours and the other must have come from some other configuration. I can't remember, does gentoo or newer linux even look at /etc/defaultrouter or is /etc/conf.d/net the only file?
Back to top
View user's profile Send private message
mvb
n00b
n00b


Joined: 22 May 2006
Posts: 8

PostPosted: Tue May 23, 2006 6:28 am    Post subject: Reply with quote

nixnut wrote:
Moved from Installing Gentoo to Networking & Security.
Networking question, so moved here.

Mmmh, this is not a networking question. I have no problems with network setup. Since when I remove the strange route by issuing a
Code:
route del default gw 192.168.227.1
everything is fine. I have a problem with gentoo-specific scripts. I want to know how I can install a server which operates smoothly after boot without the necessity of deleting the false route by hand.
Back to top
View user's profile Send private message
mvb
n00b
n00b


Joined: 22 May 2006
Posts: 8

PostPosted: Tue May 23, 2006 6:39 am    Post subject: Reply with quote

bluedevils wrote:
it looks like it put in two default routes. One is yours and the other must have come from some other configuration. I can't remember, does gentoo or newer linux even look at /etc/defaultrouter or is /etc/conf.d/net the only file?

What you term
Quote:
some other configuration
is exactly what I'm looking for. But my search revealed little so far:
There is a script named 'net.lo' in /etc/iniit.d. For each card there is a link to that script e.g.
net.eth0->net.lo
net.eth1->net.lo
The script's header reads:
Code:
#NB: Config is in /etc/conf.d/net

and I cannnot find any traditional config files like /etc/route or /etc/defaultroute
Back to top
View user's profile Send private message
mvb
n00b
n00b


Joined: 22 May 2006
Posts: 8

PostPosted: Tue May 23, 2006 6:44 am    Post subject: Re: Default route always wrong Reply with quote

vesselin wrote:
i have no *nix networking experience, but it looks logical to me. youve chosen to specify a gateway for eth1 and the appropriate ip is listed correctly (213.203.218.129). you havent specified any gateway for eth0, so (i assume) the system chooses one - the one it sees as the most probable for the subnet range specified. with a /24 mask, as you have specified for eth0, 192.168.127.1 would be the most probable gateway, as this is the first ip address in that range that is "usable" (192.168.127.0 being a reserved ip address of the whole network.) thats just a guess though.

what value do you expect and what exacly are you trying to achieve? whats your network topology?


Since I have an external IP I don't want packets to remote destinations routet through LAN, but through the interface with the external IP. The default route to LAN prevents that. I have to remove it manually. Otherwise you never get a reply when you contact the server from Internet.
Back to top
View user's profile Send private message
troymc
Guru
Guru


Joined: 22 Mar 2006
Posts: 553

PostPosted: Tue May 23, 2006 7:11 am    Post subject: Reply with quote

This bad gateway appears only at boot?

No DHCP client or server running?

No ppp connection initiated out eth0?

Can you show us the output of

Code:

# grep -v "^#" /etc/conf.d/net



troymc
Back to top
View user's profile Send private message
mvb
n00b
n00b


Joined: 22 May 2006
Posts: 8

PostPosted: Tue May 23, 2006 7:44 am    Post subject: Reply with quote

troymc wrote:
This bad gateway appears only at boot?

Yes

Quote:
No DHCP client or server running?

Yes and No ;)
The box is a diskless, headless server with an NFS-mounted root. It boots via pxelinux. Therefore, DHCP boot support is in the kernel. And of course it boots from LAN. But there is no need for a default route at this stage and the DHCP server does not provide one.



Quote:
No ppp connection initiated out eth0?

No

Quote:
Can you show us the output of

Code:

# grep -v "^#" /etc/conf.d/net


Code:

mvb@www4 ~ $ grep -v "^#" /etc/conf.d/net


config_eth0=( "192.168.227.114 broadcast 192.168.227.255 netmask 255.255.255.0" )
config_eth1=( "213.203.218.134 broadcast 213.203.218.159 netmask 255.255.255.224" )
routes_eth1=( "default via 213.203.218.129" )

mvb@www4 ~ $
Back to top
View user's profile Send private message
troymc
Guru
Guru


Joined: 22 Mar 2006
Posts: 553

PostPosted: Tue May 23, 2006 10:31 am    Post subject: Reply with quote

Wow...Ok, does the bad gateway go away if you take down eth0 manually?

Code:

# /etc/init.d/net.eth0 stop



troymc
Back to top
View user's profile Send private message
mvb
n00b
n00b


Joined: 22 May 2006
Posts: 8

PostPosted: Tue May 23, 2006 11:24 am    Post subject: Reply with quote

troymc wrote:
Wow...Ok, does the bad gateway go away if you take down eth0 manually?

Code:

# /etc/init.d/net.eth0 stop



troymc


This I cannot answer because since the whole file system is mounted on nfs the box immediatly hangs when eth0 goes away.
It does not change when I stop/start net.eth1, though. (whatever this info might be worth). I should perhaps enable serial console to have a look/see....
Back to top
View user's profile Send private message
troymc
Guru
Guru


Joined: 22 Mar 2006
Posts: 553

PostPosted: Tue May 23, 2006 11:42 am    Post subject: Reply with quote

mvb wrote:

This I cannot answer because since the whole file system is mounted on nfs the box immediatly hangs when eth0 goes away.
It does not change when I stop/start net.eth1, though. (whatever this info might be worth). I should perhaps enable serial console to have a look/see....


Ok, every bit of info helps, that does count out the eth1 configuration as the culprit. We know it has to be coming in with the initial eth0 configuration. And that comes during the PXE boot, and that comes in from the DHCP server.

Can you post the dhcp.conf from the dhcp server? (I understand that this may be sensitive info.)

Are you sure the dhcp server is not providing a default gateway?

You may not have one set specifically for this host, but maybe a global option that is being sent by default?


troymc
Back to top
View user's profile Send private message
mvb
n00b
n00b


Joined: 22 May 2006
Posts: 8

PostPosted: Tue May 23, 2006 12:04 pm    Post subject: [solved] Default route always wrong Reply with quote

troymc wrote:
mvb wrote:

This I cannot answer because since the whole file system is mounted on nfs the box immediatly hangs when eth0 goes away.
It does not change when I stop/start net.eth1, though. (whatever this info might be worth). I should perhaps enable serial console to have a look/see....


Ok, every bit of info helps, that does count out the eth1 configuration as the culprit. We know it has to be coming in with the initial eth0 configuration. And that comes during the PXE boot, and that comes in from the DHCP server.

Can you post the dhcp.conf from the dhcp server? (I understand that this may be sensitive info.)

Are you sure the dhcp server is not providing a default gateway?

You may not have one set specifically for this host, but maybe a global option that is being sent by default?
troymc


Yes! I've got it! It was not the dhcp, but the pxe boot loader. In its configuration there was a line
Code:
IPAPPEND 1

which automagically sets a default route to the boot device and is deprecated anyway. I removed this line and since then the route is fine.
Thanks for your effort.

MvB
Back to top
View user's profile Send private message
troymc
Guru
Guru


Joined: 22 Mar 2006
Posts: 553

PostPosted: Tue May 23, 2006 1:22 pm    Post subject: Re: [solved] Default route always wrong Reply with quote

mvb wrote:

Yes! I've got it! It was not the dhcp, but the pxe boot loader. In its configuration there was a line
Code:
IPAPPEND 1

which automagically sets a default route to the boot device and is deprecated anyway. I removed this line and since then the route is fine.
Thanks for your effort.

MvB


Excellent! Glad you got it squared away!


troymc
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