EmilHernvall / dnsguide

A guide to writing a DNS Server from scratch in Rust
MIT License
3.92k stars 246 forks source link

[bug] `netcat` usage may be inproper for GNU's `netcat` in chaper 1. #17

Open ClSlaid opened 2 years ago

ClSlaid commented 2 years ago

I'm following your guide on my way to implementing my rust DNS server, but serval trials with your script on catching DNS querying packets lasted an empty query-packet.txt.

nc -u -l 1053 google.com

I'm using Arch Linux and my netcat version is GNU netcat 0.7.1. The proper way to catch the packet shall be as the following script, instead.

# use `-p` option explicitly
nc -u -l -p 1053 google.com

You might be using other versions of netcat, or the (GNU version) netcat itself had an update on its CLI. After all the script does not work on my environment, please take a look.

EmilHernvall commented 2 years ago

There's a few different versions of netcat around, and they seem to take incompatible arguments. I don't remember on top of my head which version I used, but I'll check and add a note about it.