Lab 7 - Configuring DHCP Server On Cisco Routers
Lab 7 - Configuring DHCP Server On Cisco Routers
Topology
In this lab, there are two networks: Left_network and Right_Network. Both networks are connected to
the router's Fast Ethernet 0/0 and 0/1 interfaces, respectively.
In our example, since the Left_Network and Right_Network are respectively connected to the Fast
Ethernet 0/0 and 0/1 interfaces of the router, both networks will use the IP addresses of their respective
interfaces as the default gateway IPs.
In simple terms, Fast Ethernet 0/0 and Fast Ethernet 0/1 of the router are the default gateways of the
Left_Network and Right_Network respectively. Before configuring the router to act as a DHCP
server, we have to configure and enable these interfaces.
To configure and enable these interfaces, access the command prompt of the router, and execute
the following commands.
Router>enable
Router# configure terminal
Router(config)# interface FastEthernet 0/0
Router(config-if)# ip address 192.168.1.1 255.255.255.0
Router(config-if)# no shutdown
Router(config-if)#exit
Router(config)# interface FastEthernet 0/1
Router(config-if)# ip address 192.168.2.1 255.255.255.0
Router(config-if)# no shutdown
Router(config-if)#exit
For each network that will obtain IP configuration from the DHCP server, we have to create and
configure a DHCP pool on the router. In our example, we have two networks, so we have to create two
DHCP pools, one for each network.
Use the following commands to create and configure a DHCP pool for the Left_Network.
Router>enable
Router# configure terminal
Router(config)#ip dhcp excluded-address 192.168.1.1 192.168.1.10
Router(config)#ip dhcp pool Left_Network
Router(dhcp-config)#network 192.168.1.0 255.255.255.0
Router(dhcp-config)#default-router 192.168.1.1
Router(dhcp-config)#dns-server 192.168.1.2
Router(dhcp-config)#exit
The following table describes the above commands.
Command Description
ip dhcp excluded-address This command tells the DHCP server not to assign the addresses
192.168.1.1 192.168.1.10 from 192.168.1.1 to 192.168.1.10 to DHCP clients.
This command creates a DHCP pool named, Left_Network and
ip dhcp pool Left_Network
changes command mode to DHCP pool configuration mode.
This command assigns the default gateway to clients of this
default-router 192.168.1.1
DHCP pool.
dns-server 192.168.1.2 This command sets a primary DNS server for the clients.
network 192.168.1.0 255.255.255.0 This command specifies the range of IP addresses for the pool.
exit This command exits DHCP pool configuration mode.
Create and configure a DHCP pool for the Right_Network using the same commands as shown
below.
To configure a device as a DHCP client, change its IP configuration option to DHCP. To do this, click
the device. In opened Windows, click the IP configuration option from the Desktop menu and set the
IP configuration option to DHCP.
The following image shows how to verify this on a host of the Right_Network.
Verifying the DHCP Server
To verify that the DHCP server is working properly and to see the IP addresses that are provided by the
DHCP server, run the following command in privileged-exec mode.