I have a machine with two net interfaces.
it seems to always pick the wrong one (eth1) as the default route.
I can change it with
route del default route add default eth0
after it's up (or in rc.local, of course), but I'd like to figure out what I need to do this "the CentOS way" (e.g. edit some configuration file? Run some config utility, what?) once and for all.
Can somebody point me to the canonical documentation on the subject? I've searched /usr/share/doc and the man pages, but I can't find anything useful.
Googling for "default route centos" gives some interesting stuff, but nothing definitive.
Thanks!
Rick
El lun, 21-06-2010 a las 19:57 -0400, Rick Thomas escribió:
I have a machine with two net interfaces.
it seems to always pick the wrong one (eth1) as the default route.
I can change it with
route del default route add default eth0
after it's up (or in rc.local, of course), but I'd like to figure out what I need to do this "the CentOS way" (e.g. edit some configuration file? Run some config utility, what?) once and for all.
Can somebody point me to the canonical documentation on the subject? I've searched /usr/share/doc and the man pages, but I can't find anything useful.
Googling for "default route centos" gives some interesting stuff, but nothing definitive.
Maybe I'm missing something, but why you specify an interface and not an IP address as default gateway?
You can specify the gateway in the /etc/sysconfig/networking file or in the /etc/sysconfig/network-scripts/ifcfg-ethX, where X is the number of the eth interface. The variable GATEWAY is used.
This files are read by /etc/init.d/network script, but probably this script expect an IP address, should check the script to verify this.
It will be usefull if you send the output of the route -n command, and the content of /etc/sysconfig/network-scripts/ifcfg-eth{0,1} so we can help you better.
Enrique.
Thanks!
Rick _______________________________________________ CentOS mailing list CentOS@centos.org http://lists.centos.org/mailman/listinfo/centos
Thanks! to all who replied.
I solved it by putting identical "GATEWAY=" clauses in each of
/etc/sysconfig/networking/devices/ifcfg-eth0 /etc/sysconfig/networking/devices/ifcfg-eth1
This works without error, even though the gateway IP address in question is not accessible from eth1.
I haven't tried taking the GATEWAY clause(s) out of the ifcfg files and moving it to the /etc/sysconfig/network file alone. Does anybody know if that's the preferred configuration option?
Thanks!
Rick
El lun, 21-06-2010 a las 19:57 -0400, Rick Thomas escribió:
I have a machine with two net interfaces.
it seems to always pick the wrong one (eth1) as the default route.
I can change it with
route del default route add default eth0
after it's up (or in rc.local, of course), but I'd like to figure out what I need to do this "the CentOS way" (e.g. edit some configuration file? Run some config utility, what?) once and for all.
Can somebody point me to the canonical documentation on the subject? I've searched /usr/share/doc and the man pages, but I can't find anything useful.
Googling for "default route centos" gives some interesting stuff, but nothing definitive.
On 6/22/2010 1:51 PM, Rick Thomas wrote:
Thanks! to all who replied.
I solved it by putting identical "GATEWAY=" clauses in each of
/etc/sysconfig/networking/devices/ifcfg-eth0 /etc/sysconfig/networking/devices/ifcfg-eth1
This works without error, even though the gateway IP address in question is not accessible from eth1.
I haven't tried taking the GATEWAY clause(s) out of the ifcfg files and moving it to the /etc/sysconfig/network file alone. Does anybody know if that's the preferred configuration option?
It doesn't matter as long as there is only one. You could just remove the GATEWAY line from ifcfg-eth1 and only specify it in ifcfg-eth0 since that is the only one that will work anyway. The only reason to specify a GATEWAY on other interfaces would be if you sometimes have one active and sometimes another and each network has a router that will work as a default.
So I tried moving the GATEWAY clause into etc/sysconfig/network and out of the individual ifcfg-eth? files. It works.
So I guess that's the preferred solution, because it puts the information in a single place. There's no need to make sure two or more places are synchronized if anything changes.
Thanks to all!
Rick
On Jun 22, 2010, at 2:51 PM, Rick Thomas wrote:
Thanks! to all who replied.
I solved it by putting identical "GATEWAY=" clauses in each of
/etc/sysconfig/networking/devices/ifcfg-eth0 /etc/sysconfig/networking/devices/ifcfg-eth1
This works without error, even though the gateway IP address in question is not accessible from eth1.
I haven't tried taking the GATEWAY clause(s) out of the ifcfg files and moving it to the /etc/sysconfig/network file alone. Does anybody know if that's the preferred configuration option?
Thanks!
Rick
El lun, 21-06-2010 a las 19:57 -0400, Rick Thomas escribió:
I have a machine with two net interfaces.
it seems to always pick the wrong one (eth1) as the default route.
I can change it with
route del default route add default eth0
after it's up (or in rc.local, of course), but I'd like to figure out what I need to do this "the CentOS way" (e.g. edit some configuration file? Run some config utility, what?) once and for all.
Can somebody point me to the canonical documentation on the subject? I've searched /usr/share/doc and the man pages, but I can't find anything useful.
Googling for "default route centos" gives some interesting stuff, but nothing definitive.
It's getting set from /etc/sysconfig/network-scripts/ifup-eth, line 285 and following - although I haven't traced out the logic it's using to begin to say why it's coming to the wrong conclusion in your case.
Whit
On Mon, Jun 21, 2010 at 07:57:13PM -0400, Rick Thomas wrote:
I have a machine with two net interfaces.
it seems to always pick the wrong one (eth1) as the default route.
On the other hand, which interface is listed in the /etc/sysconfig/network file? Is it your desired default?
Whit
On Mon, Jun 21, 2010 at 07:57:13PM -0400, Rick Thomas wrote:
I have a machine with two net interfaces.
it seems to always pick the wrong one (eth1) as the default route.
On 06/21/2010 07:57 PM Rick Thomas wrote:
I have a machine with two net interfaces.
it seems to always pick the wrong one (eth1) as the default route. ...
after it's up (or in rc.local, of course), but I'd like to figure out what I need to do this "the CentOS way" (e.g. edit some configuration file? Run some config utility, what?) once and for all.
Can somebody point me to the canonical documentation on the subject? I've searched /usr/share/doc and the man pages, but I can't find anything useful.
You need an ifcfg-eth0 file in a directory under /etc/sysconfig/networking/profiles/... probably "default" would be the directory name you want. The file will look something like this:
# Broadcom Corporation NetXtreme BCM5705M Gigabit Ethernet DEVICE=eth0 HWADDR=00:0F:1F:C9:C3:A7 BROADCAST=192.168.0.255 ONBOOT=yes TYPE=Ethernet USERCTL=no PEERDNS=no IPV6INIT=no NETMASK=255.255.255.0 IPADDR=192.168.0.88 GATEWAY=192.168.0.1
You might already have such a file on your system. In fact, you should have one for each NIC... at least. Of course the last variable, "GATEWAY", is used to specify the default route.
hth, ken
On Mon, Jun 21, 2010 at 07:57:13PM -0400, Rick Thomas wrote:
I have a machine with two net interfaces.
it seems to always pick the wrong one (eth1) as the default route.
I can change it with
route del default route add default eth0
after it's up (or in rc.local, of course), but I'd like to figure out what I need to do this "the CentOS way" (e.g. edit some configuration file? Run some config utility, what?) once and for all.
Can somebody point me to the canonical documentation on the subject? I've searched /usr/share/doc and the man pages, but I can't find anything useful.
Googling for "default route centos" gives some interesting stuff, but nothing definitive.
route add default gw ${GATEWAYS_IP}
-----Original Message----- From: centos-bounces@centos.org [mailto:centos-bounces@centos.org] On Behalf Of Dominik Zyla Sent: Wednesday, June 23, 2010 13:55 To: centos@centos.org Subject: Re: [CentOS] How to specify the default route?
On Mon, Jun 21, 2010 at 07:57:13PM -0400, Rick Thomas wrote:
I have a machine with two net interfaces.
it seems to always pick the wrong one (eth1) as the default route.
I can change it with
route del default route add default eth0
after it's up (or in rc.local, of course), but I'd like to
figure out
what I need to do this "the CentOS way" (e.g. edit some
configuration
file? Run some config utility, what?) once and for all.
Can somebody point me to the canonical documentation on the
subject?
I've searched /usr/share/doc and the man pages, but I can't find anything useful.
Googling for "default route centos" gives some interesting
stuff, but
nothing definitive.
route add default gw ${GATEWAYS_IP}
Our 2 nics are a wan(static) and lan(dhcp)
We set the default route for the wan, and when the dhcp lease expires and renews it klobbers the default route with the lan's gateway.
-- -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- - - - Jason Pyeron PD Inc. http://www.pdinc.us - - Principal Consultant 10 West 24th Street #100 - - +1 (443) 269-1555 x333 Baltimore, Maryland 21218 - - - -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- This message is copyright PD Inc, subject to license 20080407P00.