[CentOS] Routing lost

Bryan J. Smith thebs413 at earthlink.net
Mon Nov 14 08:09:16 UTC 2005

"Chris Mason (Lists)" <lists at masonc.com> wrote:
> I have a server running Centos4. I found I was seeing some
> network problems so I tried "route" and found there was no
> routing.

Also remember to use the "-n" option to turn off name service
lookups.  If you're on a private LAN without an internal DNS,
it will cause route to seem to "hang."

Also consider "netstat -rn" instead of "route -n" for a
variety of reasons on various UNIX platforms, including

> I thought reboot would solve it but it didn't.

Consider "service network restart" before rebooting.

> I had to manually enter a route to the default gateway,
> there is still no route to the loopback interface.

For the loopback to come up on Fedora-based distros, there
must be a /etc/sysconfig/network-scripts/ifcfg-lo file (with
properly configured entries).

> How is this possible? I thought there was default routes
> built into the kernel,

Yes, the routing table is built into the kernel.  And
depending on the configuration, the kernel may or may not
assign "default route" to subnets "local" to lo, eth0, etc...
(i.e., metric 0 routes)

But no, the kernel _never_ sets a "default gateway" -- that
is done in a platform's rc/system/init/whatever script.  In
Fedora-based distros, this is in either
/etc/sysconfig/network or the relevant
/etc/sysconfig/network-scripts/ifcfg-* file(s).

> taken from ifcfg-eth0.

For a single NIC system, it can be in either
/etc/sysconfig/network or

> Is there an easy way to fix this? Thanks for any advice.
> # cat /etc/sysconfig/network  
> HOSTNAME=pbx.mysite.home
> gateway=

Yes, make your "gateway" variable "GATEWAY".  Bourne [Again]
Shell ([ba]sh) variables have _always_ been case sensitive. 
Constants are almost always declared as upper-case c/o legacy

> # cat /etc/sysconfig/network-scripts/ifcfg-eth0
> DEVICE=eth0
> BOOTPROTO=static
> HWADDR=00:30:48:80:EE:0C
> ONBOOT=yes
> TYPE=Ethernet

You _should_ still have a route for in your
routing table.  But that, of course, won't get you to the
Internet.  ;->

If "route" (or "netstat -r") are seemingly "hanging" for
minutes, then you don't have DNS for your
network, and use the "-n" option.

Bryan J. Smith                | Sent from Yahoo Mail
mailto:b.j.smith at ieee.org     |  (please excuse any
http://thebs413.blogspot.com/ |   missing headers)

More information about the CentOS mailing list