I have started writing my own TCP/IP stack (and updating the Wiki along the way)
If a few protocols work (DHCP, ARP), DNS or TCP calls always fail. I see the packet being sent out (and Wireshark does not see any irregularity with it), but there is no response. A few more details:
- My OS seems to implement DHCP successfully as it gets an IP address from the router, so the UDP layer seems fine (e.g. the computed UDP checksum is valid)
- It can successfully ping the DNS server on the Internet
- My OS is running on VirtualBox, but a Linux VM (with the exact same networking settings) can successfully make the same DNS or TCP calls to the same host on the Internet (so it doesn't seem to be a firewall issue). I compared the two DNS packets and they are pretty much the same, save the transaction IDs.
Is there anything else I could be missing?
Networking issue when trying to implement DNS
Re: Networking issue when trying to implement DNS
Is the TCP handshake with the DNS server completing successfully? Is there any routing involved or is the DNS server on the same subnet as your client? What mode have you set the network adapter in the two VMs?
Re: Networking issue when trying to implement DNS
The TCP handshake doesn't complete. The client sends the SYN packet and nothing gets received.
The DNS server is outside of my network (I'm using Level 3 DNS). Both VMs are using a bridged network.
The DNS server is outside of my network (I'm using Level 3 DNS). Both VMs are using a bridged network.
Re: Networking issue when trying to implement DNS
So the DNS aspect is a red herring. Your real problem is that you are not making a TCP connection with a remote computer. The first thing that I would do would be to try to contact a computer on your local network to check whether the problem is a fundamental problem with your TCP stack or just a problem with routed packets.
Re: Networking issue when trying to implement DNS
It's unclear whether these are the same issue or two different issues.
But I'm not sure the DNS issue is a red herring as it's relying on UDP and not TCP.
I tried to access local machines using TCP, and have the same issue (no packet is being returned)
But I'm not sure the DNS issue is a red herring as it's relying on UDP and not TCP.
I tried to access local machines using TCP, and have the same issue (no packet is being returned)
Re: Networking issue when trying to implement DNS
If you are using VirtualBox, then you should be able to start troubleshooting by running two VMs, and having them communicate with each other over the same subnet (i.e. set them both to "Internal Network" in the settings dialog.)
Then hard-code the IP addresses on both ends, and, ideally, run wireshark on one of the VMs.
If this doesn't work then try UDP, and then try simple Ethernet packets. If you still don't get a response, then you've got problems with your TCP/IP stack somewhere.
When all else fails, start hard coding values until it works.
Then hard-code the IP addresses on both ends, and, ideally, run wireshark on one of the VMs.
If this doesn't work then try UDP, and then try simple Ethernet packets. If you still don't get a response, then you've got problems with your TCP/IP stack somewhere.
When all else fails, start hard coding values until it works.
Project: OZone
Source: GitHub
Current Task: LIB/OBJ file support
"The more they overthink the plumbing, the easier it is to stop up the drain." - Montgomery Scott
Source: GitHub
Current Task: LIB/OBJ file support
"The more they overthink the plumbing, the easier it is to stop up the drain." - Montgomery Scott
Re: Networking issue when trying to implement DNS
The idea of using Wireshark inside the other VM was a great idea, thanks.
Once I got sure that the message was actually received by the target, I dug deeper. I finally realized that, contrary to what I thought, Wireshark did not verify the checksums. Once I turned verification on, it showed me that the UDP and TCP checksums were wrong (my UDP checksum was right during my DHCP call, but not my DNS call)
Once I fixed the UDP checksum, the DNS call now works fine. Once my DNS implementation is complete I will work on TCP.
Thanks for the suggestion.
Once I got sure that the message was actually received by the target, I dug deeper. I finally realized that, contrary to what I thought, Wireshark did not verify the checksums. Once I turned verification on, it showed me that the UDP and TCP checksums were wrong (my UDP checksum was right during my DHCP call, but not my DNS call)
Once I fixed the UDP checksum, the DNS call now works fine. Once my DNS implementation is complete I will work on TCP.
Thanks for the suggestion.