Let’s assume that we have a topology like in the picture:
- IP addresses of ETH 0/1 and ETH 0/2 on Router A are 172.16.1.128/25 and 172.16.1.1/25 respectively.
- Router B (dhcp client) obtains static IP address, gateway address and DNS server address from DHCP server (router A). A MAC address of interface ETH 0/0 of router B is 0800-6902-01FC.
- DHCP server assigns IP addresses to clients in subnet 172.16.1.0/24 subnetted to 172.16.1.1/25 and 172.16.1.128/25.
- DNS server address and WINS server address are 172.16.1.10/25 and 172.16.1.200/25 respectively.
- For subnet 172.16.1.128/25 configure DNS server address, WINS server address, gateway address and address lease duration for 6 days and 6 hours.
- For subnet 172.16.1.1/25 configure DNS server address, gateway address and address lease duration for 10 days.
Assign IP addresses to interfaces of router A:
[RouterA] interface ethernet 0/1 [RouterA-Ethernet0/1] ip address 172.16.1.128 25 [RouterA-Ethernet0/1]quit [RouterA] interface ethernet 0/2 [RouterA-Ethernet0/2] ip address 172.16.1.1 25
Configure DHCP server:
[RouterA] dhcp enable
Create DHCP address pool 1 with configured static binding, DNS and gateway addresses:
[RouterA] dhcp server ip-pool 1 [RouterA-dhcp-pool-1] static-bind ip-address 172.16.1.150 [RouterA-dhcp-pool-1] static-bind mac-address 0800-6902-01FC [RouterA-dhcp-pool-1] dns-list 172.16.1.10 [RouterA-dhcp-pool-1] gateway-list 172.16.1.254
Exclude IP addresses of gateways, DNS and WINS servers from dynamic allocation:
[RouterA] dhcp server forbidden-ip 172.16.1.10 [RouterA] dhcp server forbidden-ip 172.16.1.200 [RouterA] dhcp server forbidden-ip 172.16.1.126 [RouterA] dhcp server forbidden-ip 172.16.1.254
Configure DHCP address pool 2 with address range and DNS server address:
[RouterA] dhcp server ip-pool 2 [RouterA-dhcp-pool-2] network 172.16.1.0 mask 255.255.255.0 [RouterA-dhcp-pool-2] dns-list 172.16.1.10
Configure DHCP address pool 3 with address range, gateway and lease duration (DNS address is inherited from ip-pool 2):
[RouterA] dhcp server ip-pool 3 [RouterA-dhcp-pool-3] network 172.16.1.1 mask 255.255.255.128 [RouterA-dhcp-pool-3] expired day 10 [RouterA-dhcp-pool-3] gateway-list 172.16.1.126
Configure DHCP address pool 4 with address range, WINS server address, gateway and lease duration (DNS address is inherited from ip-pool 2):
[RouterA] dhcp server ip-pool 4 [RouterA-dhcp-pool-4] network 172.16.1.128 mask 255.255.255.128 [RouterA-dhcp-pool-4] expired day 6 hour 6 [RouterA-dhcp-pool-4] gateway-list 172.16.1.254 [RouterA-dhcp-pool-4] nbns-list 172.16.1.200
After the whole configuration is completed Router B gets 172.16.1.150 IP address from DHCP server. All remaining DHCP clients obtain IP addresses and other network parameters from either 172.16.1.1/25 or 172.16.1.128/25 networks (depends on subnet which they reside in).
display dhcp server ip-in-use command shows IP addresses assigned to DHCP clients.
IP address allocation sequence:
- The IP address manually bound to the client’s MAC address or ID
- The IP address that was ever assigned to the client
- The IP address designated by the Option 50 field in a DHCP-DISCOVER message
- The first assignable IP address found in an extended or a common address pool
- The IP address that was a conflict or passed its lease duration