1

I am pretty new to these things but am a bit confused. When I check the hostname on my router using host 192.168.1.1 it returns with "ttrouter" - unlike other hostnames why doesn't this one end in .local?

Upon further inspection when I ran ping ttrouter it returned "ttrouter.lan*, why does it use the ".lan" suffix and why when I connect to it I can just type "http://ttrouter" instead of "ttrouter.lan" where I have to type .local for other hostnames.

I understand this isn't an amazing question but I want to learn more about hostnames and am confused on this topic.

Thanks for any help.

2 Answers2

1

The hostname of a device is typically also the device name. On a Windows PC, the computer name is the hostname. On some home routers, you can set the hostname of the router as well. The .local and .lan are local, non-routable, domains.

The hostname is most commonly used by DNS (domain name system) to map IP Addresses to domain names, but can also map hostnames to IP addresses. The part after the hostname is the domain, delineated by the dots [.].

On the internet, you are familiar with the .com domains. DNS works so you can go to SuperUser's website by typing https://superuser.com into a browser, instead of https://151.101.193.69. DNS gets more far more complicated then that, and there are many resources online that discuss how DNS works. On the internet we are usually dealing with subdomains (superuser is a subdomain of the com domain) and aliases and not hostnames, but a lot of the principles are the same.

On a local area network, the PC keeps a cache of known DNS entries, and our local router also serves as the DNS server for the network. With Windows networking and our router DNS cache, we can use the client hostnames in our LAN directly, instead of their IP addresses. It usually isn't necessary to include the .local domain to access a PC, computers in a windows network can be browsed to using their hostname directly.

On a LAN, the domains .local and .lan are used because they are "non-routable" domains. This means that traffic destined for these domains will not be forwarded on the internet.

A Windows PC by default is part of the .local domain, so it can be reached on the local network by browsing to .local, without any further setup in the network.

Your router manufacturer has configured the default domain on the router to be .lan. If this domain is also configured on the DHCP options for your local network, then your PCs can also be reached by .lan. You could change this domain to .local on the router.

Running ipconfig /all in a command prompt will provide you additional details about your network and domains on the network adapters.

1

*.lan names are handled by your router's built-in DNS server, which registers all names that your devices provide in their DHCP lease requests.

The router also advertises this suffix in its DHCP lease responses, so when you try to look up a domain name without any dots such as "ttrouter", the suffix is automatically added by your OS.

(For home routers, usually the manufacturer picks whatever non-existant top level domain they like – yours happens to use ".lan" but some other routers use ".home" or ".cpe" or ".homelan" instead. And corporate networks often use their real domain for this purpose.)

Meanwhile *.local names are resolved directly between devices using the mDNS protocol, without any involvement by your router at all. However, they only work between devices which support mDNS, and not all do. It's mostly a macOS & Linux thing. (For example, Windows PCs only started getting built-in mDNS support last year, and it's still disabled by default even there.)

Most home routers don't actually respond to mDNS at all, which is why "ttrouter.local" cannot be resolved.

grawity
  • 501,077