Test the DNS infrastructure using our own C codes, while capturing packets with Wireshark
Dest Port:…53 …
DNS resource record
Copyright By PowCoder代写 加微信 powcoder
packet www.google.co.nz UDP segment
www.google.co.nz Type = A, class = IN
Make sure that you have compiled the DNS demonstration codes. Go to the folder where the program resides and then open a command prompt. Type make to build the program.
Flush the cached DNS records in your machine , so that we can force the DNS client to request for a host name to IP address mapping.
ipconfig /flushdns
Switch to Wireshark, specify an adapter to capture packets from (in my case, I have selected a WiFi network interface) by double‐clicking on it.
This will start Wireshark capturing packets from the WiFi network already.
Next, switch back to where your program resides, then run the program with the following parameters. Let’s query the DNS server for the IPv4 address mapping of www.google.co.nz. This will send a query of Type = A since we specified that we want the IPv4 address.
We are also using port 80 to contact the webserver as it requires HTTP connection.
dns www.google.co.nz 80 ipv4
Step 4 (continuation)
Once the program returns the host name translation, Take note of the IPv4 address found. Here we can see that www.google.co.nz has an IPv4 address of 172.217.24.35. Let’s copy this address, then switch back to Wireshark to stop it already from sniffing packets.
Simply click the STOP button, then start digging for some information.
Identify the DNS resource record carrying the IPv4 address of google (172.217.24.35). Press Ctrl + F, then paste the IPv4 address we found.
Immediately, we can see that the DNS resource records corresponding to the Query and the Answer we are looking for.
We can also see that the DNS client sent a Query of Type A, requesting for the IPv4 translation.
Lastly, we can examine which Transport protocol carried the DNS Answer record – it is encapsulated inside a UDP packet, and is using port 53 to communicate with the client.
程序代写 CS代考 加微信: powcoder QQ: 1823890830 Email: powcoder@163.com