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 at centos.org > http://lists.centos.org/mailman/listinfo/centos-- Enrique Verdes <EVerdes at conatel.com.uy> Depto. de Ingenier?a - CONATEL S.A. Este mensaje es privado y confidencial y tiene como ?nico destinatario la persona a la que va dirigida. La responsabilidad de su contenido es del remitente y no de CONATEL. Si usted ha recibido este mensaje por error, tenga presente que le est? prohibido revelarlo, copiarlo o distribuirlo, debiendo avisar de inmediato al remitente y borrarlo de su sistema. El error de transmisi?n no implica renuncia a la privacidad y confidencialidad. This email is private and confidential and intended solely for the use of the individual to whom it is addressed. The responsibility of its content is the sender's and not CONATEL'S. If you have received this email by mistake please notify the sender immediately and delete it from your system. Its disclosure, copy or distribution is absolutely forbidden. The transmission error does not imply a waiver of privacy and confidentiality.
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 -- Find research and analysis on US healthcare, health insurance, and health policy at: <http://healthpolicydaily.blogspot.com/>
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} -- Dominik Zyla -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 195 bytes Desc: not available URL: <http://lists.centos.org/pipermail/centos/attachments/20100623/7216b616/attachment.sig>
> -----Original Message----- > From: centos-bounces at centos.org > [mailto:centos-bounces at centos.org] On Behalf Of Dominik Zyla > Sent: Wednesday, June 23, 2010 13:55 > To: centos at 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.