[CentOS] How to specify the default route?

Tue Jun 22 00:27:32 UTC 2010
Enrique Verdes <EVerdes at conatel.com.uy>

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.