Hacker News new | ask | show | jobs
by zh3 1342 days ago
Our (decades old) house web server has a home page with useful links, and in particular to a simple wiki on the same box. Without any pushing (that never works) the rest of the house has slowly learnt to use it, so the calendar, the wish lists, the pet histories, holiday ideas, all sorts of stuff are on it. The server also hosts simple apps like JS clocks, calculators and of course the [0] pewpew attack map (maybe a little less funny these days, but hey).

Edit: ref CGI, there's a few apps on there that do that as well (e.g. fish tank temperature monitor). Nice thing about a small private network is being able to do CGI scripts in bash/whatever without having to worry too much).

[0] https://github.com/hrbrmstr/pewpew

1 comments

How do you give your intranet site an internal domain? Or do you make the family use the IP address?
You probably already have this. Nearly every ISP has been delivering home gateways with DHCP and DNS built in, and DHCP-registration into the local DNS cache. So <your-computer>.lan or <your-computer>.home are likely candidates. Check your settings to find out.

Besides DNS-based naming there is Multicast DNS (Bonjour/Avahi/ZeroConf) and NetBIOS naming (which still exist and works on most operating systems that have Samba or something similar).

In any case, you don't need a remote service like Cloud9 or Tailscale to any of this. Normal networking has done this for decades.

The next step beyond this is running a more capable DNS system in your home network. Generally this takes the shape of a DNS forwarder service running on a router or server. It could be as simple as a PiHole or OpnSense firewall, or however complicated you might want to make it.

See also .home.arpa which is designated for this purpose.
You can use mDNS [0] to publish an internal domain to others on the same LAN. Alternatively, you can use something like a Pi-Hole [1] to be the DNS server for your LAN. Pi-Hole gives you GUI way to point any domain to any IP [2].

[0] https://wlog.viltstigen.se/articles/2021/05/02/mdns-for-linu...

[1] https://pi-hole.net

[2] https://docs.callitkarma.me/posts/PiHole-Local-DNS/

Not the OP, but for a small local network it is easy enough to sneakernet hosts files around. (On a USB drive if not a properly classic floppy.)

Also, somepcname.local mDNS works on most operating systems today (once you grant firewall permissions to it; for instance, on Windows setting your home network as a "Private" network for instance when it asks Public or Private).

We have a lot of computers, so DNS is easier than hosts files (also easier for dynamic updates,e.g. random Pi's given a hostname will update DNS via DHCP so no need to find the IP address and update other hosts).
It runs DNS and DHCP as well (so we have a domain that's the same as the house name); the DNS is primarily caching so for most sites it's just stock internet (except a bit faster due to the caching). It's also authoritative for a small number of domains that serves ads/do tracking (it's amazing how much better that makes the internet, even the kids comment on how fast it is compared to their friends - and we're out in the sticks on a relatively slow connection).
Tailscale MagicDNS [1] can also do this, which you can also setup with TLS certs using their Let's Encrypt integration [2].

1. https://tailscale.com/kb/1054/dns/

2. https://tailscale.com/kb/1153/enabling-https/

This might be an overkill, but you can host internal domain using public DNS.

I've got a domain, and I've added multiple A records pointing to IPs of servers in my 192.168.X.Y NAT. This has a downside thought, that with short enough TTL, you may not be able to access your server during intermittent connectivity problems.

I'm using letsencrypt through traefik for the certs.

I personally use avahi (mDNS) as many other replies have suggested.

I use NixOS, so it was easy to make a function to abstract over the config. In each computer's config, all I do is specify a hostname. This function does the work (or really, some nixpkgs committer did):

    { hostName }:

    {
      services.avahi = {
        enable = true;
        nssmdns = true; # Allows programs like ssh to resolve .local domains via avahi
        inherit hostName;
        openFirewall = true;
        publish = {
          enable = true;
          addresses = true;
          workstation = true;
        };
      };
    }
Configure following items on your router:

- desired hostname and search domain(can be bogus though not recommended)

- DHCP server parameters with the router's IP as primary DNS

- DHCP static assignment for (each of)server(s)

- DNS static assignment such as "yourserver.bogusdomain.tld 192.168.10.10"

- (optionally) domain names, ddclient, certbot

"Proper" classical router/firewall OSs like Cisco IOS, Juniper JunOS, VyOS, RouterOS, OpenWrt, all easily do it like they do a cigarette, but good gamer routers and some NASs also can do it okay in many cases.

Edit the internal dns server(s).
I am asking this out of ignorance, not knowledge. Isn’t that why the Lord gave us a hosts file?
Or run a local DNS in your router, so you don't have to set each client device up.

(How would you even add hosts to an iPhone or something?)

But of course. Thanks.
you'd have to edit the hosts file on every single device you want to access that domain. personally, i wouldn't even know how to do that on any of my mobile devices.
TIL. Thank you
Network router with DNS resolver, internal domain, all DHCP clients get registered with a name as a subdomain. mycomputer.networkname.lan - I use pfsense, but lots of others support this.

You could have your own top level domain as well.

if you're using pi-hole, you can actually do all of this within the admin panel itself. they added Local DNS a couple releases ago.
If you have a Pi hole, you are already running a dns server. Otherwise, it's not too hard to set one up.