Fadel,
It really isn’t very difficult to set up your switch to be
a DHCP server, but before I go into the configuration
aspect, I want to question you about it. Do you really want
to do that?
It kinda disturbs me that you mention your “core switch” in
the same thought with wanting to set it up as a DHCP
server. The core of your network should be concerned with
nothing but moving things around as fast as possible. And
you want to now assign a new task to that switch as well.
| -- advertisement (story continued below) -- |
|
|
Judging by the fact that you mentioned “a VLAN” in the
singular, I assume that you’re a relatively small
organization without very many users/machines to assign
addresses to. So we’ll work under that premise where the
processing power is still within the realm of sanity.
So now, onto the configuration! Everything with the DHCP
server configuration is done in global mode (IOS-based
switches). If your network uses 172.27.5.1 to 172.27.5.254for its host addresses, then the configuration would be:
Switch(config)#ip dhcp pool CoreNet
Switch(dhcp-config)#network 172.27.5.0/24
Switch(dhcp-config)#default-router
172.27.5.1
Switch(dhcp-config)#dns-server 172.27.5.10 172.27.5.20 172.27.5.30
Switch(dhcp-config)#netbios-name-server 172.27.5.15 172.27.5.25
Switch(dhcp-config)#domain-name
mycore.net
That enables your switch to start responding to DHCP
broadcasts to the network shown in the network command. It
will specify the default gateway (default-router) to be
used by the hosts, as well as a domain name, DNS servers
and WINS servers.
It’s also a good idea to exclude pre-assigned addresses
from the pool. That’s a separate set of global commands,
and not a pool configuration option. Notice that the
servers listed above top out at .30. Hopefully, in the
design of your network, there’s already a set delineation
between “server IP addresses” and “host IP addresses.” This
is a good design practice to make your life easier in the
long-term maintenance of the network.
Switch(config)#ip dhcp excluded-address 172.27.5.1 172.27.5.35
One of the bad reasons for using your switch as the DHCP
server is that it assigns addresses in a sequential order,
but really does nothing in terms of keeping a database by
default. So if the power recycles on your switch for any
reason, it will start assigning addresses out at the very
beginning of the pool again.
For this, we like the switch to ping addresses before
assigning them to a client. You may determine how many ping
packets are sent out. The timeout value is in milliseconds.
Switch(config)#ip dhcp ping packet 5
Switch(config)#ip dhcp ping timeout 500
In order to see if anything goes bad, I would also
recommend logging the information about IP address
conflicts.
Switch(config)#ip dhcp conflict logging
Now, with that all being said, it’s a much better decision
to place a small machine on your network to be the DHCP
server in a “real” fashion. DHCPD is a free service within
the Unix operating system (many of them also free). There’s
a DHCP server that comes with Windows NT Server (not very
robust) and Windows Server 2000/2003 (much better).
Due to the fact that other servers (without paying any more
money) do a much better job at processing under the load of
DHCP requests, like when users all come in at the beginning
of business hours, it’s recommended that you get a service
that will work better. Purpose-built DHCP servers will also
maintain a database that survives power cycles. They allow
reservations by MAC address, and many other options to
certain machines (servers?) continue to receive the same IP
assignment all the time no matter the reboot status of the
server.
Think about these options during your network
implementation. But ultimately, yes, it’s certainly
possible to have your switch act as the DHCP server.
Hope this helps.
-- Scott
Send your toughest CCIE-level technical questions to editor@tcpmag.com.