19

How can I reliably address different machines on my network?

I've always used the .local suffix to talk to computers on my local network before. With a new router, though, .local rarely (though sometimes) works. I've found that .home and .lan both usually work, but not always.

.-------.   .--------.                 .-----.
| modem |---| router |))))))(wifi))))))| foo |
.-------.   .--------.         v       .-----.
   ||            |             v
 /_^_^_\         |             \))))))).-----.
/ cloud \        |                     | bar |
 \-_-_-/      .-----.                  .-----.
              | baz |
              .-----.

So, from a terminal on foo, I can try:

ssh bar.local
ssh bar.home
ssh bar.lan

ssh baz.local
ssh baz.home
ssh baz.lan

and sometimes some of those suffixes work and some don't, but I don't know how to predict which or when.

foo, bar, and baz are all modern Linux or Android systems and the Linux boxes all have (or can have) avahi-daemon, or other reasonably-available packages, installed

(I don't want to set up static IP addresses: I'd like to keep using DHCP (from the router) for each machine, and even if I was okay with static addresses I'd want to be able to enter hostnames in the unrooted Android machines, where I can't edit the hosts file to map a chosen hostname to an IP address.)

  • what are you using in your /etc/resolv.conf for nameservers? Also if you have dig install what output do you get when you execute dig +trace baz.local? – Red Cricket Sep 26 '13 at 7:29
  • resolv.conf has both 192.168.1.1 (I think the modem) and 192.168.1.254 (I am mostly positive this is the router); they have different ports open when I nmap them but when I try to visit .1.1's web page I end up at .1.254. I'll get back to you on dig +trace, that's something I haven't used before and I am not understanding what I'm seeing now (thanks!). – drewbenn Sep 26 '13 at 7:38
  • You should add additional information (like provided in your last comment) to your question. Also add what router(s) you are using. – maxschlepzig Sep 26 '13 at 16:37
17

There are no RFCs that specify .lan and .home. Thus, it is up to the router's vendor what pseudo TLDs (top-level-domain names) are by default configured.

For example my router vendor (AVM) seems to use .fritz.box by default.

.local is used by mDNS (multicast DNS), a protocol engineered by Apple. Using example.local only works on systems (and for destinations) that have a mDNS daemon running (e.g. MacOSX, current Linux distributions like Ubuntu/Fedora).

You can keep using dhcp - but perhaps you have to configure your router a little bit. Most routers let you configure such things like the domain name for the network.

Note that using pseudo TLDs is kind of dangerous - .lan seems to be popular - and better than .local (because it does not clash with mDNSs .local) - but there is no guarantee that ICANN will not introduce it as new TLD at some point.

Thus, it makes sense to get a real domain name - and use sub-domains of it for private stuff, e.g. when your domain is example.org you could use:

lan.example.org
internal.example.org
...
  • 2
    Actually tools.ietf.org/html/rfc6762 mention both .lan and .home. – Powerman Apr 9 '18 at 20:55
  • 4
    @Powerman, well, RFC6762 mentions .lan and .home in the Appendix G but it doesn't specify their use nor their semantics. Instead it just lists them as part of a comment: 'We do not recommend use of unregistered top-level domains at all, but should network operators decide to do this, the following top-level domains have been used on private internal networks without the problems caused by trying to reuse ".local." for this purpose' – maxschlepzig Apr 9 '18 at 21:11
0

As I understand things, if you use one of the RFC-1918 private network numeric addresses, these are guaranteed by the Internet "rules" not to route beyond their own subnet.

Some names are reserved for special use ({invalid., localhost., test. in RFC6761} {local. in RFC6762} {onion. in RFC7686} iana site)

The result of this is that you can use some names you please on your private network LAN. If the address numbers are in the RFC1918 range: even if folks on the public internet know your node names, they cannot route to that addresses.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.