I've done something along these lines with a very simple DNS and DHCP server implementation as an Arduino library: <a href="https://github.com/pkulchenko/DHCPLite/">https://github.com/pkulchenko/DHCPLite/</a>. It is fairly short and while I don't claim it being fully correct, it was tested with different clients successfully; it was great learning experience.
I love this. DNS is something that, if you're online and visiting websites or even sshing into boxes a lot of the time, you're using, unless of course you carry around a list of IP addresses like the olden times. It is one of the many things that underpin the modern web and we take it for granted.
This is great. Incidentally, writing toy recursive resolvers is one of the primary methods I use to help me learn new languages. If you take the time to develop an understanding of the domain, I've found its an easily repeatable exercise and can be done in a couple of hours.
Cool! I'd implemented a very low quality DNS server in rust to solve a hackattic challenge<p><a href="https://github.com/DavidVentura/hackattic/blob/master/src/serving_dns.rs">https://github.com/DavidVentura/hackattic/blob/master/src/se...</a><p>It'll be interesting to see if the server implementation is complete enough to work with this client
Julia's posts are always so informative; DNS being one of those topics which I presume so many developers are like myself and have "just enough knowledge to be dangerous" :-)
I have a slightly off topic but related query to new HTTPS RR and SVCB record types of DNS. Will these records allow me to host sites without a reverse proxy since both records can include port info.
I host a pi-hole instance in the cloud. It's only accessible to my Tailscale network, which means that I can't reach it on my TV - unless I write a DNS proxy. Maybe this'll be enough to get my ass in gear and actually write it for once.
This is fabulous.<p>It would be convenient if I didn't have to download the code to run it though - if it was in a GitHub repo it could provide links to hosted notebook services such as JupyterHub and Colab - then lazy people like myself could click those links to try out the notebooks in their browsers without downloading, unzipping and running Jupyter locally.
Tangential, but this made me remember:<p>- Some time ago on HN I saw a free ad blocking DNS server (<a href="https://controld.com/free-dns" rel="nofollow">https://controld.com/free-dns</a>)<p>- I had wondered what protocol the 'Private DNS' setting on my Pixel uses, but never got around to checking.<p>It turns out that it setting the 'Private DNS provider hostname' to x-oisd.freedns.controld.com just works: DNS-over-TLS and ad blocking.
This looks great. I've seen a few things in rest of comments but if anyone could share anything similar about networking or computer science topics in general I'd really appreciate it. It's weird looking back I learned so much stuff as a kid in the 90s that I wish I knew better now, from trying to be a wannabe hacker and always breaking stuff I had to figure out how to fix if I wanted to use it again. I never went to college for Comp Science or worked in IT or coding but now I want to make a career change. Even though I always had some personal projects or occasional freelance type web dev, I guess the more complicated stuff was abstracted away over the years and it was easier to do more with knowing less.
I love all the series about writing your own X in 100 lines of code.
It gives you the understanding of technology and removes a lot of unnecessary details.<p>The great examples of this are
'A from-scratch tour of Bitcoin in Python'
<a href="https://karpathy.github.io/2021/06/21/blockchain/" rel="nofollow">https://karpathy.github.io/2021/06/21/blockchain/</a>
and 'Let's build GPT: from scratch, in code, spelled out'
<a href="https://youtu.be/kCc8FmEb1nY" rel="nofollow">https://youtu.be/kCc8FmEb1nY</a>
from Andrej Karpathy<p>I wonder if anybody tried to collect all such projects together and built his own 'Internet in just 100 lines of code'
I really enjoyed this short series on making a dns server in python. It's very to the point and watchable. You can get through it in an evening or two.<p><a href="https://www.youtube.com/playlist?list=PLBOh8f9FoHHhvO5e5HF_6mYvtZegobYX2">https://www.youtube.com/playlist?list=PLBOh8f9FoHHhvO5e5HF_6...</a>
Julia's zines[0] are great. Got mine this week and it's a delight to read.<p>0 - <a href="https://wizardzines.com" rel="nofollow">https://wizardzines.com</a>
I'll dig up my old comment about how easy DNS is to work with using DNS4J:<p><pre><code> Message query = new Message(data);
Header header = query.getHeader();
Record question = query.getQuestion();
Message response = new Message(query.getHeader().getID());
response.getHeader().setFlag(Flags.QR);
response.addRecord(question, Section.QUESTION);
Name name = question.getName();
int type = question.getType();
int dclass = question.getDClass();
String host = name.toString(true).toLowerCase();
...
response.addRecord(new ARecord(name, dclass, 300, "someIP"), Section.ANSWER);
...
response.getHeader().setFlag(Flags.AA);
return response.toWire(512);</code></pre>
Enjoyed. I’ve been experimenting with parsing network protocols a lot lately with an eye to separating the parsing from the “logic” (usually combined in one handler). DNS (and DHCP) are the two I started with - having the flexibility to easily extend/alter the logic is useful from time to time (ala PiHole).
Over time I've learned to stop taking people like Julia Evans for granted.
Sometimes it feels like the Internet is an endless supply of brilliance and generosity and talent. But its not true! Not everyone creates, and not everyone who creates shares, and not everyone who shares shares freely. I feel overwhelmed by gratitude for Julia and (what I estimate to be) the mere ~100 creators in the world like her.
I can't check the code on my phone right now, but does it handle mDNS queries (xyz.local)? It's kind of a special case but really useful in a home setup.
Url changed from <a href="https://jvns.ca/blog/2023/05/12/introducing-implement-dns-in-a-weekend/" rel="nofollow">https://jvns.ca/blog/2023/05/12/introducing-implement-dns-in...</a>, which points to this.