KB 308: Difference between revisions

From SWCP Support Wiki
Jump to navigationJump to search
New page: ===Linux DHCP problems=== Article:308 Created:2004-10-23 11:33:09 Categories: Linux ====Question or Symptom==== A Linux box using DHCP is getting bogus information for DNS servers i...
 
 
Line 13: Line 13:
In Linux, the file that controls what DNS servers the machine uses  
In Linux, the file that controls what DNS servers the machine uses  
is /etc/resolv.conf.  If the Linux box is doing DHCP and the DHCP server
is /etc/resolv.conf.  If the Linux box is doing DHCP and the DHCP server
includes name servers in its response, those name servers will be written  
includes name servers in its response, those name servers will be written  
in /etc/resolv.conf.
in /etc/resolv.conf.
    
    
Line 27: Line 27:
that pid file will be removed.  If for some reason it is not, when the  
that pid file will be removed.  If for some reason it is not, when the  
machine boots it will see an existing PID file for dhcpcd and not execute it.
machine boots it will see an existing PID file for dhcpcd and not execute it.
  It just won't try to DHCP.  This results in a broken resolv.conf, among  
 
It just won't try to DHCP.  This results in a broken resolv.conf, among  
other things.
other things.
    
    
The fix is to remove the PID file and start dhcpcd.
The fix is to remove the PID file and start dhcpcd.

Latest revision as of 12:48, 4 June 2008

Linux DHCP problems

Article:308
Created:2004-10-23 11:33:09
Categories:
  Linux

Question or Symptom

A Linux box using DHCP is getting bogus information for DNS servers in /etc/resolv.conf, such as 127.0.0.1, or what would be its gateway.


Resolution

In Linux, the file that controls what DNS servers the machine uses is /etc/resolv.conf. If the Linux box is doing DHCP and the DHCP server includes name servers in its response, those name servers will be written in /etc/resolv.conf.

If, when DHCP happens, bogus info is written to /etc/resolv.conf, such \ as 127.0.0.1, that probably means that DHCP is failing.

There could be many reasons that DHCP is failing, obviously,such as there is no DHCP server present. One tricky one, though, involves a PID file that is left behind after dhcpcd exits.

Some distrobutions use dhcpcd as the DHCP client. It writes a pid file to /var/run/dhcpcd-<interface>.pid. Usually, when the system shuts down, that pid file will be removed. If for some reason it is not, when the machine boots it will see an existing PID file for dhcpcd and not execute it.

It just won't try to DHCP. This results in a broken resolv.conf, among other things.

The fix is to remove the PID file and start dhcpcd.