Saturday, June 23, 2012

Intro to DHCP

Adventures in Networking - DHCP

DHCP is one of the fundamentals of our current network infrastructure.  It is one of the protocols that allows devices to join your network without you having to push any buttons.  In our techno-splurge culture we bring our tablets and laptops with us everywhere and expect it to work whenever we find a WiFi network.

When I connect to a network, my laptop gets an IP address but how did it do it?  When you plug in a network device, it will start by broadcasting a DHCP discovery (DHCP-DISCOVER).  The broadcast can be heard by anybody within the same subnet.  If a DHCP server (usually the router in a home environment) hears the request, it responds with a DHCP offer (DHCP-OFFER).  The laptop then formally requests the offer (DHCP-REQ) and the server acknowledges it (DHCP-ACK).

These DHCP messages are sent as a package with many envelopes (DHCP Options) which each have a meaning... but we'll get to that later.

Scene 1:  Local DHCP Server

1:  Laptop:  (Yelling) Is there anybody tell me how I can join?  I need an IP address!

2:  Server:  (Yelling) Sure, how about 192.168.0.3?

(Server reserves 192.168.0.3 for Laptop then sends Laptop an info package with everything it needs to know.)

3:  Laptop:  (Yelling optional)  Server, can I please have 192.168.0.3?

4:  Server:  (Softly to Laptop)  Yes, you can use all the info you found in that package to join.

It turns in transaction 1, Laptop actually requests more than just an IP.  It will often request everything it needs to join the network.
  • #3:  Default Gateway (Router's address)
  • #1:  Subnet Mask (The boundaries of the subnet)
  • #15:  Domain Name (Network's name)
  • #6:  Domain Name Server (Server that knows all the names.)
It can request even more information if it needs to.  A VoIP phone might also ask where the call-manager is, a wireless access point might request the location of a wireless controller (not a Wii-mote in this case).  All of these requests get marked in an envelope (DHCP Option 55) and are sent to the DHCP server.  The DHCP server sees envelope #55 and does its best to include a reply for each item in that request list.

That ends our first adventure into DHCP.  It was a very simple transaction, but it enabled our laptop do a lot of amazing things.  We got an IP address and 4 DHCP options which enable our laptop  to look up names on the network and able to talk to other devices without broadcasting to everybody.

No comments:

Post a Comment