Wednesday, July 21, 2010

Can't get on the Internet?

A typical DHCP session schemaImage via Wikipedia
Having problems getting on the internet?  Use whatever tool your operating system provides to check your IP address.

Is it an APIPA address?  If the address begins with 169.254, then it is an APIPA address.  This indicates you have a DHCP problem.  DHCP stands for Dynamic Host Configuration Protocol. DHCP automatically assigns an IP address when a computer connects to the network.

An older and less popular protocol is called the Bootstrap Protocol.  BOOTP is common on UNIX/Linux and Macintosh OS X systems.  BOOTP is like DHCP.

A computer configured to use DHCP is called a DHCP client.  When a computer boots up, it automatically sends out a DHCP discovery packet using the broadcast address.  Normally, your ISP sets up your router to act as a DHCP server.  The server responds to DHCP discovery requests with a DHCP offer.  The DHCP server passes out IP addresses from a range, called a DHCP scope, a subnet mask, and a default gateway.

The DHCP client (your computer) sends out a DHCP request (the name is misleading because actually it is accepting the offer).  The DHCP server (your router) then sends a DHCP acknowledgement and lists the MAC address and the IP information.  The DHCP client accepts the DHCP server's data with a lease for a fixed amount of time, determined by the DHCP setup configuration.  At about halfway through the lease time, the DHCP client makes another DHCP discovery message.  The DHCP server looks at the MAC address and will always give the same IP address and IP information unless another computer has taken the lease.

When a DHCP client (your computer) tries to get an IP address from the DHCP server and fails, your computer's operating system generates an error message and the IP address generated begins with 169.254.  This unusual address is APIPA, generated by Automatic Private IP Addressing.   The last two octets of the IP address are generated by the client (your computer).  This allows all of the clients on the network to communicate because they are on the same network ID.  However, you can't get on the internet, because APIPA cannot generate a default gateway, which is required to get on the Internet.

If you can't get on the Internet, and you know you have a DHCP problem because you have a 169.254 address, try to reestablish the lease manually.   In Windows, type the following into the command line interface:

ipconfig /renew

On a Macintosh, go to System Preferences and the Network utility.

Sometimes you still can't get an IP address for whatever reason.  Try to force the computer to release the lease.  In Windows, type

ipconfig /release
(hit enter)
ipconfig /renew
(hit enter)

In UNIX/Linux and Macintosh, use the IFCONFIG command to release.

sudo ifconfig eth0 down

To renew:

sudo ifconfig eth0 up

How DHCP Technology Works:

The TCP/IP Guide



Enhanced by Zemanta