# DHCP Wireshark Lab > [name=Aneesh Melkot (1001750503)] [color=#4D92B8] ![](https://i.imgur.com/As2RpUj.png) ## Contents [TOC] ## DHCP Experiment ### Release IP Current IP is released using ```bash! $ ipconfig/release ``` This will make IP 0.0.0.0 ![](https://i.imgur.com/KXGlpmo.png) ### Start Packet Sniffer Lets start up wireshark and turn on packet capture. ![](https://i.imgur.com/A6w7rL2.png) ### Renew IP x 2 IP can be renewed using ```bash! $ ipconfig/renew ``` ![](https://i.imgur.com/T6FXb8U.png) ![](https://i.imgur.com/oVZMMba.png) ### Release IP ![](https://i.imgur.com/DSrUJba.png) ### Renew IP Again ![](https://i.imgur.com/Q9ygCrH.png) ### Bootp filter Here we can see our packet capture window with the `bootp` filter applied to show only DHCP packets. ![](https://i.imgur.com/xDAA7Mw.png) ## Experiment Questions ### Q1 DHCP on UDP or TCP? DHCP is sent over **UDP**. This can be seen below - ![](https://i.imgur.com/hRyOUSf.png) ### Q2 Timing Diagram Here we can see the full timing diagram. Red box depicts the first 4 DHCP packets. ![](https://i.imgur.com/cFMvOEt.png) #### Ports Type | Src | Dest :--:|:--:|:--:| Discover|68|67 Offer|67|68 Request|68|67 ACK|67|68 ### Q3 Link layer address of host Thi link layer address is the MAC address highlighted below. ![](https://i.imgur.com/JoOXVln.png) My machine's MAC is `94:08:53:be:94:f9`. ### Q4 DHCP Discover vs DHCP Request In one of its Options (53) the DHCP Message Type is set to `Discover (1)` for Discover packets ![](https://i.imgur.com/RkXDkZD.png) The same option is set as `Request (3)` for Request packets. ![](https://i.imgur.com/ICSuOix.png) ### Q5 Transaction ID ![](https://i.imgur.com/RWkYWig.png) As can be seen in the above image, the TX IDs are as follows - Group|XID :--:|:--:| 1| 0xe8cf7c7 2| 0x310009f7 > The client selects the **transaction ID** (xid) (often at random), and the server copies it in the answers. It serves a client-specific purpose, often enabling the client to identify the related dhcp answer to each request. [color=#4D92B8] ### Q6 SRC/DST IP Addressess ![](https://i.imgur.com/IZ6AFQ2.png) As can be seen above, here is the src dest IPs Type|SRC IP|DST IP :--:|:--:|:--: Discover | 0.0.0.0 | 255.255.255.255 Offer | 192.168.4.1 | 192.168.4.65 Request | 0.0.0.0 | 255.255.255.255 ACK | 192.168.4.1 | 192.168.4.65 ### Q7 DHCP Server IP Address My DHCP server's IP is `192.168.4.1`. ![](https://i.imgur.com/WdsKqAR.png) ### Q8 DHCP Offered IP As can be seen below the DHCP Server assigened `192.168.4.65` to my client machine. ![](https://i.imgur.com/3dKs4Tc.png) ### Q9 Relay Agent Any TCP/IP host that is used to transfer requests and responses between the DHCP server and client when the server is present on a separate network is referred to as a DHCP relay agent. After receiving DHCP messages, relay agents create a fresh message to broadcast over a different INTERFACE. Additionally, if enabled, the Relay agent information is sent with **Option 82** and the **giaddr** (gateway address of the packet) field are added by the DHCP relay agent. When the server reply is transmitted to the host, the options field is erased. ![](https://i.imgur.com/XtktFna.png) > There is no relay agent in my experiment. A value of `0.0.0.0` indicates that there is no relay agent as well.[color=#4D92B8] ### Q10 Router & Subnet Mask - The `router line` indicates where the client should send messages by default. - The `subnet mask` line tells the client which subnet mask to use. ### Q11 DHCP Trace File IP As can be seen below, the client is offered `192.168.1.101` in the attached DHCP Trace. ![](https://i.imgur.com/Z7SMbQZ.png) As can be seen below, the client **accepts** the IP address as it sends the same IP in the subsequent Request message. ![](https://i.imgur.com/UD4Wxbf.png) ### Q12 Lease Time A lease time is supplied along with the configuration information that DHCP transmits to a client. The client is permitted to use the allocated IP address for this amount of time. The length of the lease period can be adjusted in accordance with your unique requirements. This can be seen below. ![](https://i.imgur.com/RVeaOrW.png) > Lease time is **4 hours** in my case. [color=#4D92B8] ### Q13 DHCP Release Message - DHCP Release Message is the request to release the IP back to the DHCP Server. - There is no ACK for this. - Nothing happens if the release message is lost. The client will continue operation unitl its IP lease expires. ### Q14 ARP - Yes there numerous ARP messages sent out in my trace. - An ARP request is sent when a device needs a MAC address associated with an IP address, and it does not have an entry for the IP address in its ARP table. This is used to map MACs to IPs in the local network. The ARP packets can be seen below. ![](https://i.imgur.com/Kwe019j.png)