DHCP Configuration
The DHCP is configured on a router. We then also state that router as a DHCP server. Remember that from a subnet, you must assign DHCP lease range that starts from .101 till .254 ( for example like 192.168.0.101 till 192.168.0.254). The range till 100 is used for static IP addressing such as those IP addresses that are given to switches, gateways, VLAN's, DNS servers etc. This is a standard way for using DHCP and is performed by many companies in the world.To enable dhcp server you must write the following command on the router :
Ip dhcp pool name of pool
DHCP server settings
Following are the settings that we need to make on a DHCP server .The subnet ID and the mask
The DHCP server needs to know all the addresses in the subnet.
Reserved addresses
Addresses that are reserved or excluded from the DHCP server which are needed to be used for static IP addressing. The command that is used for reserved addresses is :
ip dhcp excluded-address lowest address highest address
Default-router
The IP address of the router which is being used on that subnet.
DNS IP address
The IP address which is giving to a DNS server in the network.
Now take 2 PC's, 1 switch and 1 router. Connect the PC's and router with the switch using a straight cable as shown below
Now for the configuration
Router(config)# ip dhcp pool network
Router(dhcp-config)# network 192.168.5.0 255.255.255.0
Router(dhcp-config)# default-router 192.168.5.1
Router(dhcp-config)# dns-server 192.168.5.5
Router(dhcp-config)# exit
Now again go to config mode so we can write the command for reserve static IP addresses
Router(config)# ip dhcp excluded-address 192.168.5.1 192.168.5.100
Now go to router interface 0/0 and assign the IP address to the interface which you have also given to the default router in the DHCP settings too.
Router(config)# interface fa 0/0
Router(config-if)# ip address 192.168.5.1 255.255.255.0
Router(config-if)# no shutdown
Now go to PC1 and PC2 and click on DHCP in IP configuration
You can see that the IP address, subnet mask, default gateway and DNS server has been assigned dynamically by the DHCP successfully.
No comments:
Post a Comment