[CentOS] How to specify the default route?

ken gebser at mousecar.com
Tue Jun 22 00:52:41 UTC 2010


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/>



More information about the CentOS mailing list