# Wireshark/UDP

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 User Datagram Protocol (UDP) traffic.

## Readings

* Wikipedia: User Datagram Protocol

## Preparation

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

## Activity 1 - Capture UDP Traffic

To capture UDP traffic:
* Start a Wireshark capture.
* Open a command prompt.
* Type ipconfig /renew and press Enter to renew your DHCP assigned IP address. If you have a static address, this will not generate any UDP traffic.
* Type ipconfig /flushdns and press Enter to clear your DNS name cache.
* Type nslookup 8.8.8.8 and press Enter to look up the hostname for IP address 8.8.8.8.
* Close the command prompt.
* Stop the Wireshark capture.

## Activity 2 - Analyze UDP DHCP Traffic

To analyze UDP DHCP traffic:
* Observe the traffic captured in the top Wireshark packet list pane. To view only UDP traffic related to the DHCP renewal, type udp.port == 68 (lower case) in the Filter box and press Enter.
* 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 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 DHCP server 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.
* 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.

## Activity 3 - Analyze UDP DNS Traffic

To analyze UDP DNS traffic:
* Observe the traffic captured in the top Wireshark packet list pane. To view only UDP traffic related to the DHCP renewal, type udp.port == 53 (lower case) in the Filter box and press Enter.
* Select the first DNS packet, labeled Standard query.
* 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 / Domain Name System (query) frame.
* Expand Ethernet II to view Ethernet details.
* Observe the Destination and Source fields. The destination should be your DNS server's MAC address if it is local, or your default gateway's MAC address if the DNS server is remote. The source should be your MAC address. You can use ipconfig /all 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 DNS server IP address.
* Expand User Datagram Protocol to view UDP details.
* Observe the Source port. Notice that it is a dynamic port selected for this DNS query.
* Observe the Destination port. Notice that it is domain (53), the DNS server port.
* In the top Wireshark packet list pane, select the second DNS packet, labeled Standard query response.
* 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 / Domain Name System (response) 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 DNS server's MAC address if it is local, or your default gateway's MAC address if the DNS server is remote.
* Expand Internet Protocol Version 4 to view IP details.
* Observe the Source address. Notice that the source address is the DNS 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 domain (53) the DNS server port.
* Observe the Destination port. Notice that it is the same dynamic port used to make the DNS query in the first packet.
* Close Wireshark to complete this activity. Quit without Saving to discard the captured traffic.