DHCP Client Configuration
Overview
Dynamic Host Configuration Protocol (DHCP Dynamic Host Configuration Protocol) protocol is used for assigning dynamic IP addresses to systems on a network. Dynamic addressing allows a system to have an IP address each time it connects to the network. DHCP makes network administration easier by removing the need to manually assign a unique IP address every time a new system is added to the network. It is especially useful to manage mobile users. Once a system is configured to use DHCP, it can be automatically configured on any network that has a DHCP server.
DHCP uses a client-server model, in which the DHCP server centrally manages the IP addresses used in the network. DHCP clients obtain an IP address on lease from the DHCP server.
DHCP Client Configuration for IPv4
Before configuring the DHCP in client, make sure that DHCP server is ready and also dhcpd is running on the server machine.
Figure 25. DHCP sample topology
#configure terminal |
Enter Configure mode. |
(config)#feature dhcp |
Enable the feature dhcp. This will be enabled by default. |
(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)#exit |
Exit interface mode. |
(config)#commit |
Commit the candidate configuration to the running configuration. |
(config)#interface eth0 |
Enter management 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 management interface. |
(config if)#exit |
Exit interface mode. |
(config)#commit |
Commit the candidate configuration to the running configuration. |
Validation Commands
#show running-config dhcp
interface xe1
ip address dhcp
!
ip dhcp relay information option
#sh ip interface brief
Interface IP-Address Admin-Status Link-Status GMPLS Type
eth0 10.12.44.20 up up -
lo 127.0.0.1 up up -
lo.4 127.0.0.1 up up -
vlan1.1 unassigned up down -
xe1/1 2.2.2.3 up up -
xe1/2 unassigned down down -
xe1/3 unassigned down down -
xe1/4 unassigned up down -
xe2 *40.40.40.40 up down -
xe3/1 20.20.30.1 up up -
DHCP Client Configuration for IPv6
Before configuring the DHCP in client, make sure that DHCP server is ready and also dhcpd is running on the server machine.
Figure 26. DHCP sample topology
#configure terminal |
Enter Configure mode. |
(config)#feature dhcp |
Enable the feature dhcp. This will be enabled by default. |
(config)#interface xe1 |
Specify the interface(xe1) to be configured and enter the interface mode. |
(config-if)#ipv6 dhcp client request dns-nameserver |
The client request for name-server configured in server |
(config-if)#ipv6 dhcp client request domain-search |
The client request for domain names with ip |
(config-if)#ipv6 dhcp client request ntp-server |
The client request for Ntp server details configured in server |
(config-if)#ipv6 dhcp client request rapid-commit |
Enables rapid commit option |
(config-if)#ipv6 dhcp client request vendor-specific-information |
The client request for vendor specific information |
(config-if)#ipv6 dhcp client duid llt |
Set duid type for DHCP Client. Possible values are llt or ll |
(config-if)#ipv6 dhcp client dad-wait-time 300 |
Max time that the client process should wait for the duplicate address detection to complete before initiating DHCP requests. Values range from 1 - 600 |
(config-if)#ipv6 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. |
(config)#interface eth0 |
Enter management interface mode. |
(config-if)#ip address dhcp |
The client requests for the IP address to the server, once it receives the Acknowledgement from the server, it assigns the IP address to the management interface. |
(config if)#exit |
Exit interface mode. |
(config)#commit |
Commit the candidate configuration to the running. configuration |
Validation Commands
OcNOS#show ipv6 interface brief
Interface IPv6-Address Admin-Sta
tus
ce20 fe80::eac5:7aff:fe28:a67b [up/up]
ce21 fe80::eac5:7aff:fe28:a67c [up/down]
eth0 fe80::eac5:7aff:fe8e:c365 [up/up]
*3001::1
xe1 fe80::eac5:7aff:fe28:a66b [up/up]
OcNOS#show ipv6 dhcp vendor-opts
Interface name vendor-opts
=============== ====================
xe1 0:0:9:bf:0:1:0:c:48:65:6c:6c:6f:20:77:6f:72:6c:64:21
OcNOS#show running-config dhcp
interface eth0
ip address dhcp
!
interface xe1
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 dhcp client duid llt
ipv6 dhcp client dad-wait-time 300
ipv6 address dhcp
!
!