How to have a local domain for my local network only reddit / selfhosted ---------------------------------------------------------------------- Zhyphirus · 2023-11-17 16:15 Just a heads-up, everything that I'm writing below could be completely wrong since it's my newbie guesses, so if you have a better idea on how to do this, I'll listen. Hello, I've been searching for a while, but I couldn't figure it out by myself how to do this, I've come across a few posts, so I know that this is possible. So far, I know that I would need to assign a custom DNS, so my machine actually solves the domain locally. This part is covered (I think) since I use a OpenWrt router in my setup with the main DNS being the router itself. But now I need to figure it out how to bind my host IP (192.168.2.X) to a local domain (example.home or something like that), I do use PBR on my router to preroute stuff to my VPN Interface, but nothing else, I think it can of use somehow. This post is intended for me to learn this stuff, since I have no idea how to this, and I'm only that on my local network for the sake of it. So if there's any misconceptions or something that makes no sense, my bad. If any info is needed, I'll gladly provide, thanks. P.S. After doing the DNS part, if anyone knows about doing a self- signed certificate for each domain, I would appreciate it. ---------------------------------------------------------------------- Tangbuster · 2023-11-17 16:27 [https://noted.lol/pihole-as-local-dns/](https://noted.lol/pihole-as- local-dns/) I think something like that is what you're after. ---------------------------------------------------------------------- wireis · 2023-11-17 16:27 You can use Adguard for this.. “DNS rewrites” ---------------------------------------------------------------------- certuna · 2023-11-17 16:29 if it’s purely link-local, mDNS is easier, Android/Apple/Windows do that out of the box and with Linux distro it’s just a question of enabling avahi. ---------------------------------------------------------------------- Zhyphirus · 2023-11-17 16:33 Damn, that works, but now I have another problem, 90% of my services are on the same host, just with different ports, and for the brief search that I did it looks like I need to do some reverse proxy to actually get it working for all of them. I'll give it a better research but if you have any idea on how to do on that on windows ---------------------------------------------------------------------- Zhyphirus · 2023-11-17 16:36 I do use ADGuard instead of pihole, and it looks like ADGuard does have it too! ---------------------------------------------------------------------- Zhyphirus · 2023-11-17 16:37 Wait, I think I just need to do: [myhost.xyz:3000](https://myhost.xyz:3000) and it works, the post that I've just read, said it wasn't possible lol ---------------------------------------------------------------------- Zhyphirus · 2023-11-17 16:52 The DNS Rewrite itself on my computer is working, but for some reason on my cellphone is not, I've checked the DNS Server on my Wi-Fi, and it's the right one, being my router. ---------------------------------------------------------------------- BunkerMoewe · 2023-11-17 16:54 You can use a Reverse Proxy for that. You point your Domains to the Revers Proxy and then configure the Proxy so that the seperate Domains point to the same IP but just different ports. ---------------------------------------------------------------------- Zhyphirus · 2023-11-17 17:01 nice, if i'm not mistaken Nginx can do that, right? I'll give it a look and see if I can make it work. Thanks. ---------------------------------------------------------------------- Zhyphirus · 2023-11-17 17:02 For now, I'll keep trying with AdGuard DNS Rewrite function, but I'll take a look at mDNS too, thanks! ---------------------------------------------------------------------- BunkerMoewe · 2023-11-17 17:04 Yes, but there is the NGINX Proxy Manager. Its also based on NGINX but has a web GUI and is generally easier to work with. ---------------------------------------------------------------------- Zhyphirus · 2023-11-17 17:06 Oh, I've never heard of that before, thanks again, I'll try to get this running on docker. ---------------------------------------------------------------------- Zhyphirus · 2023-11-17 17:36 Just a note, not sure why, but only on my phone the DNS Rewrite does not work, I've tried on my work/personal laptop, and it worked no problems (I don't have Private DNS turned on btw), I'll try to make this work, if I succeed I'll update the post, thanks for your insight u/wireis ---------------------------------------------------------------------- j0nathanr · 2023-11-17 19:09 If you already have adgaurd set up with your custom A records, all you have to do is point your client's dns to the IP of your adgaurd instance. If your running this on your router, than put your router's IP address as your client's dns. Use nslookup to troubleshoot dns requests and local domain lookup. If you have an A record "test.mydomain", run "nslookup test.mydomain" and reply with the results if the lookup doesn't work. Additionally if you'd like test to resolve to test.mydomain, you would have to include the search domain "mydomain" in your dns configuration. ---------------------------------------------------------------------- Zhyphirus · 2023-11-17 20:55 Everything is working now, I'm using AdGuard Home in my router, and it was already configured to use my router IP as the main DNS server across all devices. I didn't comment this on the post, but to solve the port "problem" I used nginx as u/BunkerMoewe instructed, creating a few hosts and pointing them to my host IP:PORT, everything is working the way I was expecting them to be, thanks :) ---------------------------------------------------------------------- zuegg · 2023-11-17 20:57 Not a solution, but if you're on android, for troubleshooting on the phone it might be helpful to install something like termux so you can investigate with nslookup/dig and the likes. Btw I have pretty much your same setup: AGH with dns rewrites for *.mydomain.tld to a traefik reverse proxy. ---------------------------------------------------------------------- Zhyphirus · 2023-11-17 21:44 Thanks, ill keep that in mind, in the it was a preferred DNS problem (at least looked like it), not sure if android has problems with that, but when I changed my router to dns.1 it worked just fine, thanks.