[CentOS] Problem with DHCP and default route in CentOS

Joshua J. Kugler joshua at azariah.com
Wed Aug 21 23:47:51 UTC 2013


Siiiiiiiiiigh.  Discovered that the file

/etc/sysconfig/network

contained this line:

GATEWAY=<some other IP address>

That was first placed there when the machine was first installed, using a static 
IP address.

Commented that out, and now the system gets its gateway via dhcp.

j

On Wednesday, August 21, 2013 15:39:25 Joshua J. Kugler wrote:
> Further investigation.
> 
> If I create a route-eth0 file and put this in it:
> 
> default 192.168.122.1 dev eth0
> 
> I get this upon network restart:
> 
> Error: either "to" is duplicate, or "192.168.122.1" is a garbage.
> 
> Which this page:
> http://www.centos.org/docs/5/html/5.1/Deployment_Guide/s1%2dnetworkscripts%2
> dstatic%2droutes.html
> 
> says I will get if the default route is set via DHCP.  So, the system is
> seeing the default route, and apparently even trying to set it, but it's not
> lasting.
> 
> I'm really lost on this one.
> 
> j
> 
> On Wednesday, August 21, 2013 13:48:02 Joshua J. Kugler wrote:
> > I have a CentOS 6.4 VM that is getting its DHCP information from dnsmasq
> > (a
> > libvirt instance). However, it is not applying the routing information.
> > 
> > Attached is a tcpdump of the dhcpc output. You'll see:
> >             Default-Gateway Option 3, length 4: 192.168.122.1
> > 
> > However, when I run 'route -n', I get:
> > 
> > # route -n
> > Kernel IP routing table
> > Destination     Gateway         Genmask         Flags Metric Ref    Use
> > Iface 192.168.122.0   0.0.0.0         255.255.255.0   U     0      0
> > 0 eth0 169.254.0.0     0.0.0.0         255.255.0.0     U     1002   0
> > 
> >  0 eth0
> > 
> > Any ideas as to why the default route/gateway information isn't being
> > applied?
> > 
> > j

-- 
Joshua J. Kugler - Fairbanks, Alaska
Azariah Enterprises - Programming and Website Design
joshua at azariah.com - Jabber: pedahzur at gmail.com
PGP Key: http://pgp.mit.edu/  ID 0x73B13B6A



More information about the CentOS mailing list