RouterGod Celebrity Lecture Series
Hank The Angry Drunken Dwarf on IOS DHCP
When we first met Hank the Angry Drunken Dwarf he was bombed out of his mind. When RouterGod staffers are not installing Cisco routers and switches we like to hang out at the Smog Cutter bar in Los Angeles. It was at the Smog Cutter that we met Hank. We were shooting pool in the back, talking about how great it is to be young, Cisco certified and living in Southern California when suddenly Hank appeared. Hank was drunk, smelly, foul mouthed and seemed mad at the world. What a mess. But we took pity on him and stuffed him in the trunk of Doug's 750iL and took him to our office where we scrubbed him down and sobered him up. We enrolled him in a CCNA class and are very proud of Hank's progress, it's only been 5 months and already he can subnet a class B IP address! Let's give Hank a warm, RouterGod welcome as he discusses how Cisco's IOS software implements DHCP:
Shut yer festering pie holes! That's more like it! I'm here to tell you guys about how to configure DHCP on a Cisco router. Shut up! I'll kick yer ass! OK. Listen up. Where was I? Oh yeah, Dynamic Host Configuration Configuration Protocol, DCHP...ahhh..HPCD...wait a minute..DHCP...ha ha, got it. What the F#CK!?!? Who threw that! Knock it off!
Configuring DHCP on a Cisco router can be very useful. Say you work at a place that has a Windows NT server providing DHCP services. The NT server crashes and now no new DHCP requests can be fulfilled. The server guys are going crazy trying to get the NT server back up, they're getting blue screens and there's lots of panic and chaos in the server room. But you step in and calmly mention that you can configure the router to provide DHCP services, a collective roar of applause erupts from the server guys and once again, you're a hero! Another bitch'n scenario is when you have remote sites that connect to a hub site using ISDN. You want the spoke sites to run DHCP locally so they don't need to bring up the link and get addresses from the hub site. Each remote site must have a router so if you configure each spoke router to distribute addresses from a unique pool of addresses you will say that traffic from crossing the link.
OK, first off let's do a little review, since I'm only 4 feet tall, a "little" review is all yer gonna get..ha ha, come on folks, that was funny, I'm here all week, don't forget to tip your waitress...uh. Why do you suppose we need a Dynamic configuration protocol anyway? That's right, it's because the network administrator is a lazy bastard and doesn't want to manually configure every workstation in his network! How DHCP basically works is you have a DHCP server that provides IP addresses to workstations that ask for IP addresses. The DHCP server is configured with a pool of addresses known as SCOPES. The DHCP server will automatically assign reusable IP addresses to clients from the SCOPE of addresses. The DHCP server can also provide other information along with an IP address, like the address of the DNS server, default gateway, WINS server, domain name and what type of NETBios node the client should be. Netbios node type? What the hell is that? Oh now I remember, that tells a Microsoft workstation how it should try to resolve netbios names.
After I get another beer I'll tell you how all this happens, then I, Hank the Angry Drunken Dwarf will actually configure DHCP on a Cisco router. Whoop! Whoop! I can't even spell DHCP and I'm going to configure it. Big time! Oh yeah, Christ, I almost forgot, your DCHP server, actually it's a router running DHCP server emulation on it, can be anywhere. Your DHCP server does not have to be on the same network as the clients requesting DHCP addresses. The clients use broadcasts to find a DHCP server. Ha! Ha! I know what you are thinking, routers don't forward broadcasts, boy, Hank is a dumb ass! Well I say "up yours!" Routers do forward broadcasts if you type in the ip helper-address command, so there! I'm gonna go chug a couple of beers and I'll come back and we'll figure this all out, packet by packet.
OK, I'm back, let's (Hank lets out an impressive belch) bbbbbrrrrrrrriiiiiiipppppp!, excuse me. Let's get down and dirty and see how this DHCP works. First off, some joker in accounting turns on his PC. His PC has an IP protocol stack that has already been configured to receive an IP address and related information dynamically. So this guy's PC will send out a DHCPDISCOVER packet, and this is a broadcast. The Cisco DHCP server receives this broadcast and will respond with a DHCPOFFER which is sent via unicast directly to the requesting station, pretty cool, huh? If there are many DHCP servers, the workstation may get several replies but usually responds to the first DHCPOFFER it receives. If the workstation wants the address offered it will now respond with a DHCPREQUEST again by broadcast, this way any other DHCP servers will hear what's going on and privately withdraw their offers. If the workstation did not want the address offered, it would respond with a DHCPDECLINE message. If the workstation replied with the DHCPREQUEST it would receive a DHCPACK from the server indicating that this address and associated information is now theirs to use.
Workstation --------- DHCPDISCOVER ----------->
Hey you guys, this is interesting: before a Cisco DHCP server responds with a DHCPOFFER it will ping the address it's offering twice just to make sure nobody is using it. That's something you can configure too. When an address is issued to a workstation, it is a lease. The default lease time is 24 hours. When you configure DHCP Server on a Cisco Router, you create a pool of addresses to choose from. You can also exclude a range of addresses within the pool and you can configure it so there is a mapping between a MAC address and an IP address, that way the same machine will always get the same IP address. You can run DHCP on the following routers: 700, 800, 1000, 1400, 1600, 1700, 2500, 2600, 3800, 4000, AS5100, AS5200, AS5300, 7000, 7100, 7200 and 12000 Series and the Catalyst 5000 with RSM and Catalyst 6000 with MultiLayer Switch Feature Card
How do you enable DHCP on a Cisco router? It's easy! It's on by default! DHCP Server is already running and you didn't even know it! Ha! I knew that and you didn't! That's why Hank the Angry Drunken Dwarf gets the big bucks! All you have to do is configure a few variables and men will want to shake your hand and women will want to bear your children. Let's get busy with some configuration tasks. All configuration is done from Global config mode. Let's start with manual bindings. Manual bindings are reserved addresses that are mapped to MAC addresses. Manual bindings also logs address conflicts. We are not going to use this feature so to turn it off you enter:
no ip dhcp conflict logging
The next thing to do is configure the address range to exclude. We want to exclude: 172.16.1.100 172.16.1.103
ip dhcp excluded-address 172.16.1.100 172.16.1.103
Next we want to create a name for our pool of addresses:
ip dhcp pool drunkendwarf
Now we can define the scope of addresses:
network 172.16.0.0 /16
Now we are going to configure a domain name:
Don't forget the DNS Server:
You better have a default gateway!
Now we will configure the address for the WINS server:
Last but not least we'll tell the microsoft clients what node type they are:
Now that wasn't so hard was it? Now I went to public school but according to my arithmetic that's only 9 commands. Hey! Nine is my lucky number! Cats have nine lives, I can remember that. Anyway, that's your lecture on how to setup DHCP on a Cisco router. This subject is covered in great detail at Cisco. Before you leave let's check out what the config looks like:
Back to RouterGod Online Magazine
Copyright 1999 - 2005 RouterGod Online Magazine