# Wireshark/DHCP

Wireshark is a free and open source packet analyzer used for network troubleshooting and analysis. These activities will show you how to use Wireshark to capture and analyze Dynamic Host Configuration Protocol (DHCP) traffic.

## Readings

* Wikipedia: Dynamic Host Configuration Protocol

## Preparation

To prepare for this activity:
* Start Windows.
* Log in if necessary.
* Install Wireshark.

## Activity 1 - Capture DHCP Traffic

To capture DHCP traffic:
* Start a Wireshark capture.
* Open a command prompt.
* Type ipconfig /renew and press Enter.
* Type ipconfig /release and press Enter.
* Type ipconfig /renew and press Enter.
* Close the command prompt.
* Stop the Wireshark capture.

## Activity 2 - Analyze DHCP Request Traffic

To analyze DHCP Request (lease renewal) traffic:
* Observe the traffic captured in the top Wireshark packet list pane. To view only DHCP traffic, type udp.port == 68 (lower case) in the Filter box and press Enter.
* In the top Wireshark packet list pane, select the first DHCP packet, labeled DHCP Request.
* Observe the packet details in the middle Wireshark packet details pane. Notice that it is an Ethernet II / Internet Protocol Version 4 / User Datagram Protocol / Bootstrap Protocol frame.
* Expand Ethernet II to view Ethernet details.
* Observe the Destination and Source fields. The destination should be your DHCP server's MAC address and the source should be your MAC address. You can use ipconfig /all and arp -a to confirm.
* Expand Internet Protocol Version 4 to view IP details.
* Observe the Source address. Notice that the source address is your IP address.
* Observe the Destination address. Notice that the destination address is the IP address of the DHCP server.
* Expand User Datagram Protocol to view UDP details.
* Observe the Source port. Notice that it is bootpc (68), the BOOTP client port.
* Observe the Destination port. Notice that it is bootps (67), the BOOTP server port.
* Expand Bootstrap Protocol to view BOOTP details.
* Observe the DHCP Message Type. Notice that it is a Request (3).
* Observe the Client IP address, Client MAC address, and DHCP option fields. This is the request to the DHCP server.

## Activity 3 - Analyze DHCP ACK Traffic

To analyze DHCP ACK (server acknowledgement) traffic:
* In the top Wireshark packet list pane, select the second DHCP packet, labeled DHCP ACK.
* Observe the packet details in the middle Wireshark packet details pane. Notice that it is an Ethernet II / Internet Protocol Version 4 / User Datagram Protocol / Bootstrap Protocol frame.
* Expand Ethernet II to view Ethernet details.
* Observe the Destination and Source fields. The destination should be your MAC address and the source should be your DHCP server's MAC address.
* Expand Internet Protocol Version 4 to view IP details.
* Observe the Source address. Notice that the source address is the DHCP server IP address.
* Observe the Destination address. Notice that the destination address is your IP address.
* Expand User Datagram Protocol to view UDP details.
* Observe the Source port. Notice that it is bootps (67), the BOOTP server port.
* Observe the Destination port. Notice that it is bootpc (68), the BOOTP client port.
* Expand Bootstrap Protocol to view BOOTP details.
* Observe the DHCP Message Type. Notice that it is an ACK (5).
* Observe the Client IP address and Client MAC address fields. This is the acknowledgement from the DHCP server.
* Observe the DHCP options and expand to view the details for IP Address Lease Time, Subnet Mask, Router (Default Gateway), Domain Name Server, and Domain Name, as well as any other options if included.

## Activity 4 - Analyze DHCP Release Traffic

To analyze DHCP Release traffic:
* In the top Wireshark packet list pane, select the third DHCP packet, labeled DHCP Release.
* Observe the packet details in the middle Wireshark packet details pane. Notice that it is an Ethernet II / Internet Protocol Version 4 / User Datagram Protocol / Bootstrap Protocol frame.
* Expand Ethernet II to view Ethernet details.
* Observe the Destination and Source fields. The destination should be your DHCP server's MAC address and the source should be your MAC address. You can use ipconfig /all and arp -a to confirm.
* Expand Internet Protocol Version 4 to view IP details.
* Observe the Source address. Notice that the source address is your IP address.
* Observe the Destination address. Notice that the destination address is the IP address of the DHCP server.
* Expand User Datagram Protocol to view UDP details.
* Observe the Source port. Notice that it is bootpc (68), the BOOTP client port.
* Observe the Destination port. Notice that it is bootps (67), the BOOTP server port.
* Expand Bootstrap Protocol to view BOOTP details.
* Observe the DHCP Message Type. Notice that it is a Release (7).
* Observe the Client IP address and Client MAC address fields. This is the address that will be released on the DHCP server.

## Activity 5 - Analyze DHCP Discover Traffic

To analyze DHCP Discover (lease request) traffic:
* In the top Wireshark packet list pane, select the fourth DHCP packet, labeled DHCP Discover.
* Observe the packet details in the middle Wireshark packet details pane. Notice that it is an Ethernet II / Internet Protocol Version 4 / User Datagram Protocol / Bootstrap Protocol frame.
* Expand Ethernet II to view Ethernet details.
* Observe the Destination and Source fields. The destination should be the broadcast address ff:ff:ff:ff:ff:ff and the source should be your MAC address. When the client doesn't have an IP address or server information, it has to broadcast to discover a DHCP server.
* Expand Internet Protocol Version 4 to view IP details.
* Observe the Source address. Notice that the source address is 0.0.0.0, indicating no current IP address.
* Observe the Destination address. Notice that the destination address 255.255.255.255, the broadcast IP address.
* Expand User Datagram Protocol to view UDP details.
* Observe the Source port. Notice that it is bootpc (68), the BOOTP client port.
* Observe the Destination port. Notice that it is bootps (67), the BOOTP server port.
* Expand Bootstrap Protocol to view BOOTP details.
* Observe the DHCP Message Type. Notice that it is a Discover (1).
* Observe the Client IP address, Client MAC address, and DHCP option fields. This is the request to the DHCP server.

## Activity 6 - Analyze DHCP Offer Traffic

To analyze DHCP Offer (server offer) traffic:
* In the top Wireshark packet list pane, select the fifth DHCP packet, labeled DHCP Offer.
* Observe the packet details in the middle Wireshark packet details pane. Notice that it is an Ethernet II / Internet Protocol Version 4 / User Datagram Protocol / Bootstrap Protocol frame.
* Expand Ethernet II to view Ethernet details.
* Observe the Destination and Source fields. The destination should be your MAC address and the source should be your DHCP server's MAC address.
* Expand Internet Protocol Version 4 to view IP details.
* Observe the Source address. Notice that the source address is the DHCP server's IP address.
* Observe the Destination address. Notice that the destination address is 255.255.255.255 (broadcast) address.
* Expand User Datagram Protocol to view UDP details.
* Observe the Source port. Notice that it is bootps (67), the BOOTP server port.
* Observe the Destination port. Notice that it is bootpc (68), the BOOTP client port.
* Expand Bootstrap Protocol to view BOOTP details.
* Observe the DHCP Message Type. Notice that it is an Offer (2).
* Observe the Client IP address and Client MAC address fields. This is the offer from the DHCP server.
* Observe the DHCP options and expand to view the details for IP Address Lease Time, Subnet Mask, Router (Default Gateway), Domain Name Server, and Domain Name, as well as any other options if included.

## Activity 7 - Analyze DHCP Request Traffic

To analyze DHCP Request (lease request) traffic:
* In the top Wireshark packet list pane, select the sixth DHCP packet, labeled DHCP Request.
* Observe the packet details in the middle Wireshark packet details pane. Notice that it is an Ethernet II / Internet Protocol Version 4 / User Datagram Protocol / Bootstrap Protocol frame.
* Expand Ethernet II to view Ethernet details.
* Observe the Destination and Source fields. The destination should be the broadcast address ff:ff:ff:ff:ff:ff and the source should be your MAC address. When the client doesn't have an IP address or server information, it has to broadcast to request an address lease.
* Expand Internet Protocol Version 4 to view IP details.
* Observe the Source address. Notice that the source address is 0.0.0.0, indicating no current IP address.
* Observe the Destination address. Notice that the destination address 255.255.255.255, the broadcast IP address.
* Expand User Datagram Protocol to view UDP details.
* Observe the Source port. Notice that it is bootpc (68), the BOOTP client port.
* Observe the Destination port. Notice that it is bootps (67), the BOOTP server port.
* Expand Bootstrap Protocol to view BOOTP details.
* Observe the DHCP Message Type. Notice that it is a Request (3).
* Observe the Client IP address, Client MAC address, and DHCP option fields. This is the request to the DHCP server.

## Activity 8 - Analyze DHCP ACK Traffic

To analyze DHCP ACK (server acknowledgement) traffic:
* In the top Wireshark packet list pane, select the seventh DHCP packet, labeled DHCP ACK.
* Observe the packet details in the middle Wireshark packet details pane. Notice that it is an Ethernet II / Internet Protocol Version 4 / User Datagram Protocol / Bootstrap Protocol frame.
* Expand Ethernet II to view Ethernet details.
* Observe the Destination and Source fields. The destination should be your MAC address and the source should be your DHCP server's MAC address.
* Expand Internet Protocol Version 4 to view IP details.
* Observe the Source address. Notice that the source address is the DHCP server IP address.
* Observe the Destination address. Notice that the destination address is the broadcast address 255.255.255.255.
* Expand User Datagram Protocol to view UDP details.
* Observe the Source port. Notice that it is bootps (67), the BOOTP server port.
* Observe the Destination port. Notice that it is bootpc (68), the BOOTP client port.
* Expand Bootstrap Protocol to view BOOTP details.
* Observe the DHCP Message Type. Notice that it is an ACK (5).
* Observe the Client IP address and Client MAC address fields. This is the acknowledgement from the DHCP server.
* Observe the DHCP options and expand to view the details for IP Address Lease Time, Subnet Mask, Router (Default Gateway), Domain Name Server, and Domain Name, as well as any other options if included.
* Close Wireshark to complete this activity. Quit without Saving to discard the captured traffic.