summaryrefslogtreecommitdiff
path: root/content/guide/stuff-about-dns.md
diff options
context:
space:
mode:
authorNantha Sorubakanthan <nantha@mielota.com>2025-10-28 10:48:22 +0100
committerNantha Sorubakanthan <nantha@mielota.com>2025-10-28 10:48:22 +0100
commitb99dbe5079db25076d00823ad5dbae47297162ff (patch)
tree50b427ef0209ea561fc12d403551c6587f74f562 /content/guide/stuff-about-dns.md
parent3d4c9512aeaabde1c99e38250eb16aa3345e269d (diff)
add dns draft
Diffstat (limited to 'content/guide/stuff-about-dns.md')
-rw-r--r--content/guide/stuff-about-dns.md153
1 files changed, 153 insertions, 0 deletions
diff --git a/content/guide/stuff-about-dns.md b/content/guide/stuff-about-dns.md
new file mode 100644
index 0000000..06c3956
--- /dev/null
+++ b/content/guide/stuff-about-dns.md
@@ -0,0 +1,153 @@
+---
+title: Stuff about dns
+date: 2025-10-27T13:46:54+01:00
+draft: true
+index: false
+---
+
+## IP addresses
+
+### What is this ?
+
+An IP address is a numerical label assigned to a device on the internet. It is used to identify a device, and to address locations.
+
+For example, the IP address of YOUR device, is known as 127.0.0.1 (or localhost) to your computer. But on your local network, to your Wi-Fi, you have a different IP address (for example 192.0.2.1). And for the _public_ internet, you have **another** IP address.
+
+There are two kinds of IP addresses; IPv4 and IPv6.
+
+```sh
+23.215.0.136 #IPv4
+2600:1406:bc00:53::b81e:94ce #IPv6
+```
+
+### What's your IP ?
+
+Try to get your local IPv4 address in your local network :
+
+```sh
+ip a | grep "inet .*"
+
+# You might get something like the following :
+inet 127.0.0.1/8 .... # your localhost
+inet 192.0.2.1/24 .... # your local ip
+```
+
+You can even ping yourself or other devices in your house that are connected to the Wi-Fi.
+
+```sh
+ping -c 2 192.0.2.1 # or localhost, ping yourself
+```
+
+You can get your public IPv4 by going to websites that tell you your IP like [whatismyipaddress.com/](https://whatismyipaddress.com/)
+
+Or curl [ifconfig.co](https://ifconfig.co) like so :
+
+```sh
+curl ifconfig.co # gives you your public IPv6
+curl -6 ifconfig.co # it also works
+```
+```sh
+curl -4 ifconfig.co # gives you your public IPv4
+```
+
+### What's your Wi-Fi router local IP ?
+
+Just use the `ip` command again :
+
+```sh
+ip route | grep default
+
+# You will get something like
+default via IP_ADDRESS ...
+```
+
+If your ISP (Internet Service Provider) allows it, you can put the `IP_ADDRESS` in your browser and you can change some settings of your router (like open ports or whatever).
+
+The password is probably the one you use to connect to Wi-Fi.
+
+### Can't open ports in range [0, 32765[
+
+I had this problem. It's a serious issue if you are trying to self host because the HTTP/HTTPS port and tons of others are in this range.
+
+Personally, I just went to the website of my ISP and there was an option to get a "static full stack IPv4 address". Maybe you should call your ISP I don't know.
+
+## DNS
+
+### What is this ?
+
+DNS (Domain Name System) is pretty cool, it's a fancy _alias_ for IP adresses. See it like a `Dictionnary` data structure in programming.
+
+So basically, you have a domain name that points to an IP address.
+
+```txt
+example.com -> 23.220.75.245
+```
+
+This is possible by setting DNS records. You set "A" record that bind the domain name to an IPv4 address. You set "AAAA" record that bind the domain name to an IPv6 address.
+
+Domain names are cool and convenient. It would be a pain to remember the IP addresses of my favourite websites.
+
+### DNS resolvers
+
+A DNS resolver is a server that translates domain names into IP addresses. See it like _getter_ function :
+
+```lua
+get_ip_from_domain_name("example.com") -- Returns 23.220.75.245
+```
+
+Some DNS resolvers have really weird IP addresses. There's 1.1.1.1 (cloudflare), 8.8.8.8 (google), 9.9.9.9 (quad9). I wonder how they even got them.
+
+Try one of them yourself. Send a DNS query for whatever domain name, to one of these DNS resolvers.
+
+Install the `dig` command first.
+
+```sh
+sudo pacman -S bind # On Arch
+sudo apt install dnsutils # On Debian
+```
+
+Now you can query some DNS resolver :
+
+```sh
+dig example.com @1.1.1.1
+```
+
+> Note that some DNS providers are unsafe and/or log the IP of websites you connect to. Choose your DNS resolver carefully. Also know that using DNS over HTTPS or DNS over TLS doesn't make you invisible.
+
+### Control the websites you can visit
+
+You can filter the responses of DNS resolvers with programs like [blocky](https://0xerr0r.github.io/blocky/latest/).
+
+You can ask `blocky` to redirect some domain names to the null IP 0.0.0.0. By doing so you can stop your computer/browser/phone from querying websites containing ads, malware, or [unwanted content](https://denshi.org/antiporn).
+
+For example ask for the IP of `ads.google.com` :
+
+```sh
+dig ads.google.com @8.8.8.8
+```
+
+You got the IP address right ? Now try with my DNS resolver :
+
+```sh
+dig ads.google.com @dns.mielota.com # or put the IPv4 of my server
+```
+
+You will get 0.0.0.0
+
+Here are some useful links if you want to do the same :
+
+- [Comfy Guide to Blocky](https://comfy.guide/server/blocky)
+- [Comfy Guide to Blocky (video)](https://www.youtube.com/watch?v=Uq6mafo9fEc)
+- [Blocky DNS](https://0xerr0r.github.io/blocky/latest/)
+
+You can also run `blocky` locally and query your `localhost`.
+
+### Reverse DNS
+
+If you want to setup an email server, you have to setup `reverse DNS`, it's basically DNS but the other way around : Give an IP, get a domain name.
+
+To setup r-dns I had to go to my ISP's website. Some people say that they had to call their ISP. Some people are not allowed to have r-dns. So it's just a matter of luck.
+
+## Conclusion ?
+
+These are just some random infos about DNS. Nothing big. Of course, I only covered the **tip** of the iceberg in _whatever_ this is.