This is only an article to show a simulation about how to implement DHCP using only one PC, one switch and one router. The simulation itself is just for exercise and education purpose but it can be a useful resource in real implementation. In this context, use any application simulator to start simulating it either using Cisco Packet Tracer or any other application simulator such as GNS3. The scenario is just to get a PC an IP Address from the DHCP service in the router. Connect one PC to one switch and then connect the switch to the router. So, there is no direct connection from the PC to the router. Below is the actual network schema using a Cisco Packet Tracer :
In order to implement the above simulation, there are several steps to achieve it. Those steps are configuring the switch and then configuring the router. Last but not least, configuring the PC. Configuring switch is an important step in order to configure each port where there are connections to the router and the PC. The configuration process in router is also important in order to set the DHCP configuration. Furthermore, the process for configuring the PC in the last step is also important to be able to request for an IP via DHCP service provided by the router.
Configure the switch
To be able to configure the switch, below are those steps :
1. Access the switch.
2. Change from the User Level Mode into a Privileged Level Mode by typing the following command :
3. Next, switch to the Global Configuration Command Mode by typing the following line :
Switch#conf t Enter configuration commands, one per line. End with CNTL/Z. Switch(config)#
4. After that, change from the Global Configuration Command Mode into an Interface Configuration Command Mode Level Mode. In this context, the interface is fa0/1 as it exist in the network schema image above. Just type the following command :
Switch(config)#int fa0/1 Switch(config-if)#
5. The last step in this part is don’t forget to change the mode of the port into an access mode as typing the following command :
Switch(config-if)#switchport mode access Switch(config-if)#
So, the process for configuring the switch is actually ends.
Configure the router
In this part, there are several steps for configuring the router. The following are those steps :
1. Access the router.
2. As also in the switch device, do similar thing in router. Change from the User Level Mode into a Privileged Level Mode by typing the following command :
3. Next step, similar also with the switch device. In router, change it to the Global Configuration Command Mode by typing the following line :
Router# conf t Router(config)#
4. Get into the Interface Configuration Command Mode. Choose the interface where it connects to the switch where in this context it is the ‘fa0/0’. Don’t forget to assign an IP Address for an example it is ‘192.168.1.1’ with a netmask of ‘255.255.255.0’. Just type the following command :
Router(config)#int fa0/0 Router(config-if)#ip address 192.168.1.1 255.255.255.0 Router(config-if)#exit
5. Set the DHCP Pool in order to define the IP Address that will be distributed to the client which in this example is the PC. The following is the set of the command to do it :
Router(config)#ip dhcp pool dhcp Router(dhcp-config)#network 192.168.1.0 255.255.255.0 Router(dhcp-config)#default-router 192.168.1.1 Router(dhcp-config)#exit Router(config)#ip dhcp excluded-address 192.168.1.1 Building configuration... [OK] Router(config)#exit Router#
The above one define a DHCP Pool with the name of ‘dhcp’. Those DHCP pool is having a network of ‘192.168.1.0’ with the netmask of ‘255.255.255.0’. The router IP Address is ‘192.168.1.1’. Last but not least, define ‘192.168.1.1’ to be an IP that will never be distributed to the other device which in this context it is a PC.
Configure the PC
Finally, the last thing to do is do not ever forget to configure the PC so that it will set into a DHCP mode. It exist as in the following image :