How to: Self-host a DNS server for web browsing
-
Described in the BrowseDNS post, the Switch will display a web browser applet as a part of its built-in Captive Portal functionality. The connection test domains are redirected when in a captive portal, and allow you to display your own web content inside the applet.
The BrowseDNS servers will provide this redirect, but if you want more control or cannot access external DNS servers (eg. if there's a router/ISP override on outbound DNS requests), then you may want to self-host from another device on the network.
Below are two ways to do this!
The Easy Way (GUI)
There's a Linux/Windows/Mac/Android app called YourFriendlyDNS by softwareengineer1 on Github. it can be downloaded here.
After running the app, it will display the IP to enter on your Switch under "Listening IPs" in the top-left. This is the IP of your computer which will need to stay online for the DNS to continue resolving
Advanced (Command Line)
If you have a raspberry pi or a pi-hole, you can manually configure a DNS override for the following two connection test domains:
These will need to be pointed to a reachable IP with an HTTP server listening on port 80, which will serve the web content that you want to appear in the browser applet. BrowseDNS uses LaneChange for this purpose, which will perform a redirect to another URL, or allows a custom response to be configured.
You can use any HTTP server though, such as python simple http server, and serve a static
index.html
page from the current directory.For the DNS server, pi-hole uses FTLDNS. Other common Linux DNS servers are dnsmasq, bind, or systemd-resolved. Any should work well, a DNS server responds on port 53 via UDP to a domain query with a response IP, and in this case only the Switch connection domain needs to be overridden. There are approaches to do this directly in python as well.
-
-