Practical No.
Configure DHCP and DNS using packet tracer
Four steps occur sequentially when a client requests addressing information:
1. When client wants to get ip address via DHCP, it generates dhcp discover.
The client broadcasts a DHCPDISCOVER message on its local physical subnet.
The DHCPDISCOVER message may include options that suggest values for the network address
and lease duration.DHCPDISCOVER is a UDP broadcast message type.
2. One or more servers may answer on it with dhcp offer.
Each server may respond with a DHCPOFFER message that includes an available network
address in the "ipaddr" field (and other configuration parameters in DHCP options).
The server unicasts the DHCPOFFER message to the client (using the DHCP/BOOTP relay agent
if necessary) if possible, or may broadcast the message to a broadcast address (preferably
255.255.255.255) on the client's subnet.
3. The client chooses one ip address and responds to the server with aDHCPREQUEST.
DHCPREQUEST is a UDP broadcast message type.
4. The server acknowledges the request with a DHCPACK.
Features of DHCP:
1. DHCP messages from a client to a server are sent to the DHCP server port (UDP port 67), and
DHCP messages from a server to a client are sent to the DHCP client port (UDP port 68).
2. DHCP is used to provide IP information to hosts on your network. DHCP can provide a lot of
information, but the most common is IP address, subnet mask, default gateway, and DNS
information.
3. The DHCP Discover message uses UDP as it is the transport layer protocol. i.e. DHCP is
connectionless.
4. DHCP also called the Host-to-Host layer.
5. The DHCP Discover message uses FF-FF-FF-FF-FF as the Layer 2 destination address.
6. A client that sends out a DHCP Discover message in order to receive an IP address sends out a
broadcast at both layer 2 and layer 3. The layer 2 broadcast is all Fs in hex, or
FF:FF:FF:FF:FF:FF. The layer 3 broadcast is 255.255.255.255, which means all networks and all
hosts.
7. DHCP clients lease their IP addresses from DHCP servers. When this lease expires, that IP
address can no longer be utilized by the DHCP client. For that reason, DHCP client must
periodically renew their IP address leases, preferably before the lease has expired or is about to
expire.The default lease period is 30 days.The default ping timeout is 500 milliseconds.
8. DHCP allows for both private and public addressing.
9. A DHCP server uses a ping to detect address conflicts.
DHCP Commands:
1. ipdhcp pool command creates a DHCP address pool.
Or
To create a DHCP server pool, use the ipdhcp pool command.
2. network command is used to specify the range of addresses.
3. ip address dhcp command is used to acquire a DHCP address on a router’s interface.
4. showipdhcp binding command is used to see the assigned DHCPaddresses.
5. clearipdhcp binding * command is used to clear DHCPaddresses on the server.
6. DHCP's other commands domain-name, dns-server, netbios-name-server,defaultrouter, and lease.
7. ipconfig/release command is used to terminate a PC’s DHCP-assigned lease.
________________________________________________________
PRINT-OUT
________________________________________________________
DHCP Lab with Packet Tracer
Configure DHCP services on a Cisco Router with following information
Network: 192.168.10.0 255.255.255.0
Gateway Address: 192.168.10.1
DNS Server: 4.2.2.2
DHCP pool: 192.168.10.2 to 192.168.10.4
Excluded Address: 192.168.10.5 to 192.168.10.80
Configure router
Router>en
Router#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#int fa 0/0
Router(config-if)#ip address 192.168.10.1 255.255.255.0
Router(config-if)#no shut
Router(config-if)#exit
Configure DHCP
Router(config)#ip dhcp ?
excluded-address Prevent DHCP from assigning certain addresses
pool Configure DHCP address pools
Router(config)#ip dhcp pool ?
WORD Pool name
Router(config)#ipdhcp pool mypool
Router(dhcp-config)# network 192.168.10.0 255.255.255.0
Router(dhcp-config)#default-router 192.168.10.1
Router(dhcp-config)#dns-server 4.2.2.2
Router(dhcp-config)#exit
Router(config)#ip dhcp ?
excluded-address Prevent DHCP from assigning certain addresses
pool Configure DHCP address pools
Router(config)#ipdhcp excluded-address 192.168.10.5 192.168.10.80
Router(config)#^Z
Router#
Click PC1/ IP Configuration /DHCP
Click PC2/ IP Configuration /DHCP
Click PC3/ IP Configuration /DHCP
View the assigned DHCP addresses
Router#show ip dhcp binding
IP address Client-ID/ Lease expiration Type
Hardware address
192.168.10.2 00E0.F9BE.AD2D -- Automatic
192.168.10.3 0090.2185.88DD -- Automatic
192.168.10.4 0001.6450.50D8 -- Automatic
192.168.10.81 0000.0CB7.1E82 -- Automatic
192.168.10.82 000A.F3C8.D94A -- Automatic
Router#
Click PC1/ Command Prompt
PC>ipconfig /all
Physical Address................: 00E0.F9BE.AD2D
IP Address......................: 192.168.10.2
Subnet Mask.....................: 255.255.255.0
Default Gateway.................: 192.168.10.1
DNS Servers.....................: 4.2.2.2
PC>
Click PC2/ Command Prompt
PC>ipconfig /all
Physical Address................: 0090.2185.88DD
IP Address......................: 192.168.10.3
Subnet Mask.....................: 255.255.255.0
Default Gateway.................: 192.168.10.1
DNS Servers.....................: 4.2.2.2
PC>
Click PC3/ Command Prompt
PC>ipconfig /all
Physical Address................: 0001.6450.50D8
IP Address......................: 192.168.10.4
Subnet Mask.....................: 255.255.255.0
Default Gateway.................: 192.168.10.1
DNS Servers.....................: 4.2.2.2
PC>
DHCP and DNS on packet tracer:
Here in this tutorial, we are going to set a dns (domain name system) server and a dhcp server. And
then from our PC we will use dns service.
Set up IP on server 0 i.e DHCP server
Set up DHCP on server 0.
Set up IP on server 1 i.e DNS server.
Now, go to PC and select DHCP.
Configure dhcp on the other PCs also.
Go to Web Browser and enter Server 0 ip address. You can access the website of the server.
Now, let us set DNS on DNS server. Create the following record and click on add.
Now, again go to PC and in the web browser enter the name that you set in DNS