Lab - Using Wireshark To Examine A UDP DNS Capture: (Instructor Version)
Lab - Using Wireshark To Examine A UDP DNS Capture: (Instructor Version)
Version)
Instructor Note: Red font color or gray highlights indicate text that appears in the instructor copy only.
Topology
Objectives
Part 1: Record a PC’s IP Configuration Information
Part 2: Use Wireshark to Capture DNS Queries and Responses
Part 3: Analyze Captured DNS or UDP Packets
Background / Scenario
When you use the Internet, you use the Domain Name System (DNS). DNS is a distributed network of
servers that translates user-friendly domain names like www.google.com to an IP address. When you type a
website URL into your browser, your PC performs a DNS query to the DNS server’s IP address. Your PC’s
DNS query and the DNS server’s response make use of the User Datagram Protocol (UDP) as the transport
layer protocol. UDP is connectionless and does not require a session setup as does TCP. DNS queries and
responses are very small and do not require the overhead of TCP.
In this lab, you will communicate with a DNS server by sending a DNS query using the UDP transport
protocol. You will use Wireshark to examine the DNS query and response exchanges with the same server.
Instructor Note: Using a packet sniffer, such as Wireshark, may be considered a breach of the security
policy of the school. It is recommended that permission be obtained before running Wireshark for this lab. If
using a packet sniffer is an issue, the instructor may wish to assign the lab as homework or perform a walk-
through demonstration.
Required Resources
CyberOps Workstation Virtual Machine
Internet access
Cisco and/or its affiliates. All rights reserved. Cisco Confidential Page 1 of 7 www.netacad.com
Lab - Using Wireshark to Examine a UDP DNS Capture
and the DNS server IP address specified for the PC. Record this information in the table provided. The
information will be used in parts of this lab with packet analysis.
a. Open a terminal in the VM. Enter ifconfig at the prompt to display interface information.
[analyst@secOps ~]$ ifconfig
enp0s3: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.1.19 netmask 255.255.255.0 broadcast 192.168.1.255
inet6 fe80::997f:9b16:5aae:1868 prefixlen 64 scopeid 0x20<link>
ether 08:00:27:c9:fa:a1 txqueuelen 1000 (Ethernet)
RX packets 1381 bytes 87320 (85.2 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 24 bytes 1857 (1.8 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
device interrupt 19 base 0xd000
<some output omitted>
b. At the terminal prompt, enter cat /etc/resolv.conf to determine the DNS server.
[analyst@secOps ~]$ cat /etc/resolv.conf
# Generated by resolvconf
nameserver 192.168.1.1
c. At the terminal prompt, enter netstat -r to display the IP routing table to the default gateway IP address.
[analyst@secOps ~]$ netstat -r
Kernel IP routing table
Destination Gateway Genmask Flags MSS Window irtt Iface
default 192.168.1.1 0.0.0.0 UG 0 0 0 enp0s3
192.168.1.0 0.0.0.0 255.255.255.0 U 0 0 0 enp0s3
Note: The DNS IP address and default gateway IP address are often the same, especially in small
networks. However, in a business or school network, the addresses would most likely be different.
Cisco and/or its affiliates. All rights reserved. Cisco Confidential Page 2 of 7 www.netacad.com
Lab - Using Wireshark to Examine a UDP DNS Capture
b. In the Wireshark window, select enp0s3 from the interface list and click Start.
c. After selecting the desired interface, click Start to capture the packets.
d. Open a web browser and type www.google.com. Press Enter to continue.
e. Click Stop to stop the Wireshark capture when you see Google’s home page.
b. In the packet list pane (top section) of the main window, locate the packet that includes Standard query
and A www.google.com. See frame 22 above as an example.
Cisco and/or its affiliates. All rights reserved. Cisco Confidential Page 3 of 7 www.netacad.com
Lab - Using Wireshark to Examine a UDP DNS Capture
The IP packet and header encapsulates the UDP segment. The UDP segment contains the DNS query
as the data.
d. Click the arrow next to User Datagram Protocol to view the details. A UDP header only has four fields:
source port, destination port, length, and checksum. Each field in a UDP header is only 16 bits as
depicted below.
e. Click the arrow next to User Datagram Protocol to view the details. Notice that there are only four fields.
The source port number in this example is 39964. The source port was randomly generated by the VM
Cisco and/or its affiliates. All rights reserved. Cisco Confidential Page 4 of 7 www.netacad.com
Lab - Using Wireshark to Examine a UDP DNS Capture
using port numbers that are not reserved. The destination port is 53. Port 53 is a well-known port
reserved for use with DNS. DNS servers listen on port 53 for DNS queries from clients.
In this example, the length of the UDP segment is 40 bytes. The length of the UDP segment in your
example may be different. Out of 40 bytes, 8 bytes are used as the header. The other 32 bytes are used
by DNS query data. The 32 bytes of DNS query data is in the following illustration in the packet bytes
pane (lower section) of the Wireshark main window.
The checksum is used to determine the integrity of the UDP header after it has traversed the Internet.
The UDP header has low overhead because UDP does not have fields that are associated with the three-
way handshake in TCP. Any data transfer reliability issues that occur must be handled by the application
layer.
Cisco and/or its affiliates. All rights reserved. Cisco Confidential Page 5 of 7 www.netacad.com
Lab - Using Wireshark to Examine a UDP DNS Capture
Frame size
Source IP address
Destination IP address
Source port
Destination port
Is the source IP address the same as the local PC’s IP address you recorded in Part 1? _____________
Yes
Is the destination IP address the same as the default gateway noted in Part 1? _____________
Yes, if the default gateway is also performing DNS.
b. In the Ethernet II frame for the DNS response, what device is the source MAC address and what device is
the destination MAC address?
____________________________________________________________________________________
The source MAC address is the default gateway and the destination MAC address is the VM.
Cisco and/or its affiliates. All rights reserved. Cisco Confidential Page 6 of 7 www.netacad.com
Lab - Using Wireshark to Examine a UDP DNS Capture
c. Notice the source and destination IP addresses in the IP packet. What is the destination IP address?
What is the source IP address?
Destination IP address: _______________________Source IP address: ________________________
The answer will vary. In this example, the destination is 192.168.1.19 and the source is 192.168.1.1.
What happened to the roles of source and destination for the VM and default gateway?
____________________________________________________________________________________
____________________________________________________________________________________
The VM and the default gateway have reversed their roles in DNS query and response packets.
d. In the UDP segment, the role of the port numbers has also reversed. The destination port number is
39964. Port number 39964 is the same port that was generated by the VM when the DNS query was sent
to the DNS server. Your VM listens for a DNS response on this port.
The source port number is 53. The DNS server listens for a DNS query on port 53 and then sends a DNS
response with a source port number of 53 back to the originator of the DNS query.
When the DNS response is expanded, notice the resolved IP addresses for www.google.com in the
Answers section.
Reflection
What are the benefits of using UDP instead of TCP as a transport protocol for DNS?
_______________________________________________________________________________________
_______________________________________________________________________________________
UDP as a transport protocol provides quick session establishment, quick response, minimal overhead, no
need for retries, segment reassembly, and acknowledgment of received packets.
Cisco and/or its affiliates. All rights reserved. Cisco Confidential Page 7 of 7 www.netacad.com