Sunday, March 27, 2016

Configuring a Cisco router to act as a DHCP server on the LAN


Typically, an enterprise's LAN may contain one or more dedicated DHCP servers to serve IP addresses on one or more subnets.  These servers may also serve as domain controllers and provide DNS for the LAN.  Sometimes at a smaller branch office location, there may not be a dedicated DHCP server.  You can use your Cisco router running IOS to act as the DHCP server at such locations.

Setting up a DHCP server on the router is fairly straightforward, you define a name for the DHCP pool, specify the network and mask for the subnet you are providing DHCP services for, specify the default gateway for the DHCP scope, DNS servers and optionally lease times etc.
You can also setup any DHCP reservations.  Router will skip the range of reserved IPs when assigning IP addresses on the LAN


ip dhcp exluded-address 10.10.10.2 10.10.10.50
!
ip dhcp pool local-pool
network 10.10.10.0 255.255.255.0
default-router 10.10.10.1
dns-server <IP-Address>
!
interface GigabitEthernet0/1
desc LAN
ip address 10.10.10.1 255.255.255.0
no shutdown
!


Above code creates a DHCP reservation for IPs ranging between 10.10.10.2 to 10.10.10.50
(10.10.10.1 is an IP address assigned to the router's LAN interface therefore it's automatically skipped).
DHCP pool called local-pool is configured to assign IPs on subnet 10.10.10.0 with a /24 mask
Router's LAN interface is setup as the default gateway for the subnet
DNS-Server is set. You can set this to any servers of your choice.

Also note, if you have more than one subnets on the network for which you want to setup separate DHCP scopes for, you may have to create a trunk between the router's LAN interface and the switch.  This can be achieved using the Router on a Stick solution.

No comments:

Post a Comment