This tutorial explains how to configure the DHCP service on a Cisco switch.
CONFIGURATION STEPS :
Step 1 | Enter into Global Configuration mode | SW1>enable SW1#configure terminal |
Step 2 | Create a range of excluded IP ranges from the subnet which you don’t want to allocate for end user devices | SW1(config)#ip dhcp excluded-address [start address] [end address] |
Step 3 | Create a DHCP pool with the intended name. With this command, you will now Enter into the DHCP pool configuration mode | SW1(config)#ip dhcp pool [pool-name] |
Step 4 | Define the network and subnet mask | SW1(dhcp-config)#network [network ID] [subnet mask] |
Step 5 | Define the default gateway | SW1(dhcp-config)#default-router [IP address of default gateway] |
Step 6 | Specify the DNS server | SW1(dhcp-config)#dns-server [IP address of DNS server] |
Step 7 | Exit DHCP pool configuration mode | SW1(dhcp-config)#exit |
Step 8 | Enter VLAN configuration mode of the VLAN (VLAN 1 is used here as an example) | SW1(config)#interface vlan 1 |
Step 9 | Configure an IP address (from the same range) to the VLAN interface | SW1(config-if)#ip address [ip address] [subnet mask] |
Step 10 | Bring up the VLAN | SW1(config-if)#no shutdown |
Step 11 | Exit to privileged-exec mode | SW1(config-if)#exit SW1(config)#exit |
Step 12 | Save the configuration. | SW1#copy running-config startup-config |
Example Configuration:
Verifying the DHCP IP lease from PC1