Configuring an Interface to Acquire Dynamic IP

If in a topology consisting of Switch1 (the DHCP server) and Switch 2 (the DHCP client), VLAN 1 of Switch 2 needs to be allocated with a dynamic IP, perform the following:

Enabling DHCP server in Switch 1 and creating an address pool

  1. Enter Global Configuration Mode.
    iS5comm# configure terminal
  2. Enable the DHCP Server.
    iS5comm(config)# service dhcp-server
  3. Create pool 1 and enter the DHCP Pool configuration mode.
    iS5comm(config)# ip dhcp pool 1
  4. Configure the network as 12.0.0.0, mask 255.0.0.0
    iS5comm(dhcp-config)# network 12.0.0.0 255.0.0.0
  5. Exit the DHCP Pool Configuration mode.
    iS5comm(dhcp-config)# end

Viewing the configuration

View the configuration using the following commands.
iS5comm# show ip dhcp server pools
Pool Id : 1
-------------------------------------------
Subnet : 12.0.0.0
Subnet Mask : 255.0.0.0
Lease time : 3600 secs
Utilization threshold : 75%
Start Ip : 12.0.0.1
End Ip : 12.255.255.255
iS5comm# show ip dhcp server information
DHCP server status : Enable
Send Ping Packets : Disable
Debug level : None
Server Address Reuse Timeout : 5 secs
Next Server Address : 0.0.0.0
Boot file name :
Note:

DHCP server must be enabled.

Note:

There must be a pool available in the server for client’s subnet.

Acquiring a dynamic IP for the VLAN 1

Execute the following commands in Switch 2 (the client) to acquire a dynamic IP for the VLAN 1.

  1. Enter Configuration Mode.
    iS5comm# configure terminal
  2. Enter VLAN configuration mode for VLAN 1.
    iS5comm(config)# interface vlan 1
  3. Change the IP allocation mode to dynamic
    iS5comm(config-if)# ip address dhcp
  4. Exit from the Interface configuration mode.
    iS5comm(config-if)# end

    Wait till protocol operation completes (20 seconds approx.).

Verification of the dynamic IP allocation, binding and statistics

  1. View the dynamic IP allocated to the Client in Switch 2 using the following command.
    iS5comm#show ip interface
    The output in the Switch 2 is
    vlan1 is up, line protocol is up
    Internet Address is 12.0.0.2/8
    Broadcast Address 12.255.255.255
    IP address allocation method is dynamic
    IP address allocation protocol is dhcp
  2. View the DHCP client statistics in Switch 2 using the following command.
    iS5comm#show ip dhcp client stats
    Dhcp Client Statistics
    --------------------------
    Interface : vlan1
    Client IP Address : 12.0.0.2
    Client Lease Time : 3600
    Client Remain Lease Time : 2989
    Message Statistics
    ------------------
    DHCP DISCOVER : 1
    DHCP REQUEST : 1
    DHCP DECLINE : 0
    DHCP RELEASE : 0
    DHCP INFORM : 0
    DHCP OFFER : 1
  3. View the DHCP server binding table to observe the allocated IP addresses using the following command.
    iS5comm#show ip dhcp server binding
    Ip Hw Binding Expire
    Address Type Address State Time
    ---------- ------- -------------- ------- ---------
    12.0.0.2 Ethernet 00:02:02:03:04:01 Assigned Jan 7 11:22:37 2007
  4. View the DHCP packets statistics in Switch 1 using the following command.
    iS5comm#show ip dhcp server statistics
    Address pools : 1
    Message Received
    ------ --------
    DHCPDISCOVER 1
    DHCPREQUEST 1
    DHCPDECLINE 0
    DHCPRELEASE 0
    DHCPINFORM 0
    Message Sent
    ------ ----
    DHCPOFFER 1
    DHCPACK 1
    DHCPNAK 0