DHCP Server Configuration
Overview
A DHCP Dynamic Host Configuration Protocol Server is a network server that automatically provides and assigns IP addresses, default gateways and other network parameters to client devices. It relies on the standard protocol known as Dynamic Host Configuration Protocol or DHCP to respond to broadcast queries by clients.
DHCP Server Configuration for IPv4
Before configuring make sure that DHCP server is ready.
Topology
Figure 27. DHCP IPv4 topology
Configuration
DHCP IPv4 Client Interface
#configure terminal |
Enter Configure mode. |
(config)#interface xe1 |
Specify the interface (xe1) to be configured and enter the interface mode. |
(config-if)#ip address dhcp |
The client requests for the IP address to the server, once it receives the acknowledgment from the server, it assigns the IP address to the interface in which this command is enabled. |
(config-if)#ip dhcp client request dns-nameserver |
The client requests for the DNS name server. |
(config-if)#ip dhcp client request ntp-server |
The client requests for the NTP server . |
(config-if)#ip dhcp client request host-name |
The client requests for the Name of the client. |
(config-if)#ip dhcp client request log-server |
The client requests for the log server. |
(config if)#exit |
Exit interface mode. |
DHCP IPv4 Server Interface
#configure terminal |
Enter Configure mode. |
(config)#interface xe2 |
Specify the interface (xe2) to be configured and enter the interface mode. |
(config-if)#ip address 10.10.10.1/24 |
Configure the IP address to the server interface. |
(config-if)#ip address dhcp |
The client requests for the IP address to the server, once it receives the acknowledgment from the server, it assigns the IP address to the interface in which this command is enabled. |
(config if)#exit |
Exit interface mode. |
(config)#commit |
Commit the candidate configuration to the running configuration. |
DHCP IPv4 Server Feature
#configure terminal |
Enter Configure mode. |
(config)#ip vrf vrf1 |
Configure IP VRF |
(config-vrf)#ip dhcp server max-lease-time 100 |
Configure max lease time. |
(config-vrf)#ip dhcp server default-lease-time 100 |
Configure default lease time. |
(config-vrf)#ip dhcp server pool test |
Configure DHCP server pool name. |
(dhcp-config)#network 3.3.3.0 netmask 255.255.255.0 |
Configure network and netmask. |
(dhcp-config)#address range low-address 3.3.3.1 high-address 3.3.3.4 |
Configure address IPv4 range. |
(dhcp-config)#routers 3.3.3.1 |
IPv4 DHCP Server option to provide router details to a DHCP client |
(dhcp-config)#boot-file test |
Configure boot-file name. |
(dhcp-config)#host-name dhcp-server |
Configure host name. |
(dhcp-config)#ntp-server 4.4.4.5 |
Configure NTP server. |
(dhcp-config)#log-server 5.5.5.6 |
Configure log server. |
(dhcp-config)#dns-server 5.5.5.5 |
Configure DNS server. |
(dhcp-config)#tftp-server 5.5.5.6 |
Configure TFTP server. |
(dhcp-config)#boot-file test |
Configure boot-file name. |
DHCP Server Configuration for IPv6
Before configuring make sure that DHCP server is ready.
Topology
Figure 28. DHCP IPv6 topology
Configuration
DHCP IPv6 Client Interface
#configure terminal |
Enter Configure mode. |
(config)#interface xe47 |
Specify the interface (xe47) to be configured and enter the interface mode. |
(config-if)#ipv6 address dhcp |
The client requests for the IPv6 address to the server, once it receives the acknowledgment from the server, it assigns the IP address to the interface in which this command is enabled. |
(config-if)#ipv6 dhcp client request dns-nameserver |
The client requests for the DNS name server. |
(config-if)#ipv6 dhcp client request ntp-server |
The client requests for the NTP server. |
(config-if)#ipv6 dhcp client request domain-search |
The client request for IPv6 domain search. |
(config-if)#ipv6 dhcp client request vendor-specific-information |
The client request for IPv6 vendor-specific-information. |
(config-if)#ipv6 dhcp client request rapid-commit |
The client request to enable rapid-commit. |
(config if)#exit |
Exit interface mode. |
(config)#commit |
Commit the candidate configuration to the running configuration. |
DHCP IPv6 Server Interface
#configure terminal |
Enter Configure mode. |
(config)#interface xe2 |
Specify the interface (xe2) to be configured and enter the interface mode. |
(config-if)#ipv6 address dhcp |
The client requests for the IPv6 address to the server, once it receives the acknowledgment from the server, it assigns the IP address to the interface in which this command is enabled. |
(config-if)#ipv6 address 2001::1/64 |
Configure the IPv6 address to the server interface. |
(config if)#ipv6 dhcp server |
Configure an interface as a DHCP server starting interface. |
(config if)#exit |
Exit interface mode. |
(config)#commit |
Commit the candidate configuration to the running configuration. |
DHCP IPv6 Server Feature
#configure terminal |
Enter Configure mode |
(config)#ip vrf vrf1 |
Configure IP VRF name |
(config-vrf)#ipv6 dhcp server preference |
Configure IPv6 DHCP server preference |
(config-vrf)#ipv6 dhcp server rapid-commit |
Configure IPv6 DHCP server rapid-commit |
(config-vrf)#ipv6 dhcp server pool test |
Configure IPv6 DHCP server pool name |
(dhcp6-config)#network 2001:: netmask 64 |
Configure IPv6 network and netmask |
(dhcp6-config)#address range low-address 2001::1 high-address 2001::124 |
Configure IPv6 address range |
(dhcp6-config)#vendor-options 00:00:09:bf:63 |
Configure IPv6 vendor option |
(dhcp6-config)#ntp-server 4001::1 |
Configure IPv6 NTP server |
(dhcp6-config)#dns-server 3001::1 |
Configure IPv6 DNS server |
(dhcp-config)#log-server 5.5.5.6 |
Configure log server |
(dhcp6-config)#domain-name abcd |
Configure domain name |
(dhcp-config)#tftp-server 5.5.5.6 |
Configure TFTP server |
(dhcp-config)#boot-file test |
Configure boot-file name |
Validation
Client
OcNOS#sh running-config dhcp
interface eth0
ip address dhcp
!
interface xe2
ipv6 dhcp client request dns-nameserver
ipv6 dhcp client request domain-search
ipv6 dhcp client request ntp-server
ipv6 dhcp client request rapid-commit
ipv6 dhcp client request vendor-specific-information
ipv6 address dhcp
!
OcNOS#show ipv6 int br
Interface IPv6-Address Admin-Sta
tus
ce49 unassigned [up/down]
eth0 fe80::e69d:73ff:fe05:8100 [up/up]
lo ::1 [up/up]
lo.management ::1 [up/up]
xe45 unassigned [up/down]
xe46 unassigned [up/down]
xe47 *2001::124
fe80::e69d:73ff:fe84:8137 [up/up]
xe48 unassigned [up/down]
Server
OcNOS#show running-config dhcp
interface eth0
ip address dhcp
!
!
ipv6 dhcp server rapid-commit
ipv6 dhcp server preference
ipv6 dhcp server pool test
network 2001:: netmask 64
address range low-address 2001::1 high-address 2001::124
vendor-options 00:00:09:bf:63
ntp-server 4001::1
dns-server 3001::1
domain-name abcd
interface xe2
ipv6 dhcp server
!