Lesson 43: Configuring Cisco IOS as DHCP Server and Relay Agent
Cisco DHCP Server Configuration
- Exclude Addresses: Define addresses that should not be leased (e.g., router interfaces, servers).
- Create the Pool: Define the network, default gateway, and DNS servers.
ios Router(config)# ip dhcp excluded-address 192.168.10.1 192.168.10.10
Router(config)# ip dhcp pool STAFF_VLAN Router(config-dhcp)# network 192.168.10.0 255.255.255.0 Router(config-dhcp)# default-router 192.168.10.1 Router(config-dhcp)# dns-server 8.8.8.8 4.4.4.4 Router(config-dhcp)# lease 7
DHCP Relay Agent (ip helper-address)
If the DHCP server is on a remote subnet, the router connected to the client subnet must act as a relay agent.
ios ! Assume DHCP server is 172.16.1.1 and clients are on G0/1 Router(config)# interface GigabitEthernet 0/1 Router(config-if)# ip helper-address 172.16.1.1
This command changes the DHCP broadcast into a unicast packet destined for the server, allowing it to traverse the router.