TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Implement DNS in a Weekend

647 pointsby asicspabout 2 years ago

24 comments

paulclingerabout 2 years ago
I&#x27;ve done something along these lines with a very simple DNS and DHCP server implementation as an Arduino library: <a href="https:&#x2F;&#x2F;github.com&#x2F;pkulchenko&#x2F;DHCPLite&#x2F;">https:&#x2F;&#x2F;github.com&#x2F;pkulchenko&#x2F;DHCPLite&#x2F;</a>. It is fairly short and while I don&#x27;t claim it being fully correct, it was tested with different clients successfully; it was great learning experience.
ianbutlerabout 2 years ago
I love this. DNS is something that, if you&#x27;re online and visiting websites or even sshing into boxes a lot of the time, you&#x27;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.
评论 #35921480 未加载
评论 #35926151 未加载
spmurrayzzzabout 2 years ago
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&#x27;ve found its an easily repeatable exercise and can be done in a couple of hours.
deividabout 2 years ago
Cool! I&#x27;d implemented a very low quality DNS server in rust to solve a hackattic challenge<p><a href="https:&#x2F;&#x2F;github.com&#x2F;DavidVentura&#x2F;hackattic&#x2F;blob&#x2F;master&#x2F;src&#x2F;serving_dns.rs">https:&#x2F;&#x2F;github.com&#x2F;DavidVentura&#x2F;hackattic&#x2F;blob&#x2F;master&#x2F;src&#x2F;se...</a><p>It&#x27;ll be interesting to see if the server implementation is complete enough to work with this client
评论 #35919312 未加载
jonwinstanleyabout 2 years ago
Julia&#x27;s posts are always so informative; DNS being one of those topics which I presume so many developers are like myself and have &quot;just enough knowledge to be dangerous&quot; :-)
quaintdevabout 2 years ago
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.
评论 #35923187 未加载
GOATS-about 2 years ago
I host a pi-hole instance in the cloud. It&#x27;s only accessible to my Tailscale network, which means that I can&#x27;t reach it on my TV - unless I write a DNS proxy. Maybe this&#x27;ll be enough to get my ass in gear and actually write it for once.
评论 #35917613 未加载
评论 #35920494 未加载
评论 #35918200 未加载
simonwabout 2 years ago
This is fabulous.<p>It would be convenient if I didn&#x27;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.
评论 #35924641 未加载
评论 #35920473 未加载
rahimnathwaniabout 2 years ago
Tangential, but this made me remember:<p>- Some time ago on HN I saw a free ad blocking DNS server (<a href="https:&#x2F;&#x2F;controld.com&#x2F;free-dns" rel="nofollow">https:&#x2F;&#x2F;controld.com&#x2F;free-dns</a>)<p>- I had wondered what protocol the &#x27;Private DNS&#x27; setting on my Pixel uses, but never got around to checking.<p>It turns out that it setting the &#x27;Private DNS provider hostname&#x27; to x-oisd.freedns.controld.com just works: DNS-over-TLS and ad blocking.
nayrfabout 2 years ago
This looks great. I&#x27;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&#x27;d really appreciate it. It&#x27;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.
评论 #35924206 未加载
Alpiabout 2 years ago
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 &#x27;A from-scratch tour of Bitcoin in Python&#x27; <a href="https:&#x2F;&#x2F;karpathy.github.io&#x2F;2021&#x2F;06&#x2F;21&#x2F;blockchain&#x2F;" rel="nofollow">https:&#x2F;&#x2F;karpathy.github.io&#x2F;2021&#x2F;06&#x2F;21&#x2F;blockchain&#x2F;</a> and &#x27;Let&#x27;s build GPT: from scratch, in code, spelled out&#x27; <a href="https:&#x2F;&#x2F;youtu.be&#x2F;kCc8FmEb1nY" rel="nofollow">https:&#x2F;&#x2F;youtu.be&#x2F;kCc8FmEb1nY</a> from Andrej Karpathy<p>I wonder if anybody tried to collect all such projects together and built his own &#x27;Internet in just 100 lines of code&#x27;
评论 #35919409 未加载
评论 #35917929 未加载
评论 #35919141 未加载
评论 #35917954 未加载
评论 #35926499 未加载
评论 #35925298 未加载
评论 #35917742 未加载
评论 #35917768 未加载
评论 #35919344 未加载
m3047about 2 years ago
Amazingly the DNS operator community doesn&#x27;t offer a checklist for DNS implementations. I asked on dns-operations@.
gregorsabout 2 years ago
I really enjoyed this short series on making a dns server in python. It&#x27;s very to the point and watchable. You can get through it in an evening or two.<p><a href="https:&#x2F;&#x2F;www.youtube.com&#x2F;playlist?list=PLBOh8f9FoHHhvO5e5HF_6mYvtZegobYX2">https:&#x2F;&#x2F;www.youtube.com&#x2F;playlist?list=PLBOh8f9FoHHhvO5e5HF_6...</a>
gtirloniabout 2 years ago
Julia&#x27;s zines[0] are great. Got mine this week and it&#x27;s a delight to read.<p>0 - <a href="https:&#x2F;&#x2F;wizardzines.com" rel="nofollow">https:&#x2F;&#x2F;wizardzines.com</a>
评论 #35918182 未加载
评论 #35917301 未加载
评论 #35918030 未加载
评论 #35917172 未加载
playingalongabout 2 years ago
To be clear it&#x27;s a DNS resolver, i.e. the client.
评论 #35920189 未加载
评论 #35919853 未加载
bullenabout 2 years ago
I&#x27;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, &quot;someIP&quot;), Section.ANSWER); ... response.getHeader().setFlag(Flags.AA); return response.toWire(512);</code></pre>
评论 #35921000 未加载
mlhpdxabout 2 years ago
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&#x2F;alter the logic is useful from time to time (ala PiHole).
Manjuuuabout 2 years ago
Yes. We need more of those little tutorials demystifying things we take for granted.
javajoshabout 2 years ago
Over time I&#x27;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.
digitalsanctumabout 2 years ago
I just have to say I love everything Julia produces. Very inspiring!
craniumabout 2 years ago
I can&#x27;t check the code on my phone right now, but does it handle mDNS queries (xyz.local)? It&#x27;s kind of a special case but really useful in a home setup.
danabramsabout 2 years ago
Julia Evans&#x27;s writing is just so much fun.
shidoshiabout 2 years ago
Julia is the best ever.
dangabout 2 years ago
Url changed from <a href="https:&#x2F;&#x2F;jvns.ca&#x2F;blog&#x2F;2023&#x2F;05&#x2F;12&#x2F;introducing-implement-dns-in-a-weekend&#x2F;" rel="nofollow">https:&#x2F;&#x2F;jvns.ca&#x2F;blog&#x2F;2023&#x2F;05&#x2F;12&#x2F;introducing-implement-dns-in...</a>, which points to this.