Live data from Hacker News

Implement DNS in a Weekend

implement-dns.wizardzines.com

41–50 of 77 posts

Re: Implement DNS in a Weekend

#42
This is fabulous.

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.

Re: Implement DNS in a Weekend

#44

To be clear it's a DNS resolver, i.e. the client.

A DNS resolver is both a client and a server -- for example Google's 8.8.8.8 (which this is a toy version of) is a server (you can query it with `dig @8.8.8.8 example.com`), but also a client of the various authoritative DNS servers that it fetches and caches records from.

I implemented this as a command line tool because that's much easier to do in a Jupyter notebook environment, but you can also pretty easily transform it into a UDP server running on localhost and query it with dig in the same way that you would with 8.8.8.8. That's one of the bonus exercises at the end (Exercise 7).

I might end up bringing "convert it into a server" into the main content though because it's pretty easy to do and I think it makes the whole thing seem more "real".

Re: Implement DNS in a Weekend

#45
post #12

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. The great examples of this are 'A from-scratch tour of Bitcoin in Python' https://karpathy.github.io/2021/06/21/blockchain/ and 'Let's build GPT: from scratch, in code, spelled out' https://youtu.be/kCc8FmEb1nY from Andrej Karpathy I wonder if anybody tried to col…

I just submitted this as its own post, because I thought it was so cool, but here's a complete operating system in 2000 lines of code: https://github.com/yhzhang0128/egos-2000

Egos is really neat, and super approachable. I did some documentation work for it last fall, and despite only having a weak grasp of operating systems I could easily understand the whole thing. I only needed to figure out a few common acronyms and magic numbers that weren’t explained.

Re: Implement DNS in a Weekend

#46
post #37

Earlier quoted context omitted.

Setting the pi-hole as your DNS server in your router would not work? TV should then use this DNS server after getting an IP-address via DHCP.

The Pi-hole isn't hosted on my local network, but on my Tailscale network because it's running on a VPS. My router can't run Tailscale, so that's not possible.

What router do you have? You'd be surprised, I have tailscale running on a 4-year old Linksys router.

Re: Implement DNS in a Weekend

#47
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.

Re: Implement DNS in a Weekend

#48
post #42

This is fabulous. 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.

Can you copy the code into a hosted Jupyter?

Re: Implement DNS in a Weekend

#49
post #16

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.

Isn't the DNS design effectively its own proxy by the way resolvers forward requests towards more authoritative resolvers? On whatever local-network machine you would run your DNS proxy, you just run a DNS resolver in forwarding mode where all requests are sent to your pi-hole instance.
Post reply on HN