Hacker News new | past | comments | ask | show | jobs | submit login

Personally I use the HOSTS file instead of DNS.

Alternatively I use a map file loaded into the memory of a loopback-bound forward proxy. No DNS.

I also use loopback-bound authoritative DNS to a limited extent as it provides wildcards.

There are ways to avoid using DNS.

Most web developers do not understand DNS, or at least dislike it, and some get annoyed by the HOSTS file. Quite funny. But I'm not a developer. DNS is something I understand well enough, I like it, and, in addition, the HOSTS file is useful for me. But sometimes it's most useful for me to avoid DNS.




How do you synchronize hosts file between clients?


You can set up a server listening to port 53 that will return the corresponding entry from a "hosts file" if you query it for an A record. To avoid the file growing uncomfortably big, it can be split up amongst hierarchically arranged servers.


How would you call this hypothetical system? It’s almost like a distributed system for looking up names.


An RFC might have been submitted for this already, let me check!


While I have no need to lookup an address in local computer A's HOSTS file from local computer B as this is not how I use the HOSTS file, in the event that I did want computer B to look up addresses in computer A's HOSTS file, it seems there are many possible options. I could not even come close to listing all of them. (The discussion here is computers on a local network. Is there a need for a "distributed hierarchical system".)

pdns_recursor can serve /etc/hosts

https://docs.powerdns.com/recursor/settings.html

unbound can serve "local data"

https://unbound.docs.nlnetlabs.nl/en/latest/manpages/unbound...

dnsd from busybox can serve a HOSTS file

   (exec 2>/dev/null;while read a b c ;do echo "$b $a";done < /etc/hosts|busybox dnsd -c /dev/stdin -p1153 -i 10.21.66.4)
tinydns would work too

   echo . > data
   while read a b c;do echo =$b:$a:1;done < /etc/hosts >> data
   tinydns-data
   ROOT=. IP=10.21.66.4 GID=0 UID=0 tinydns
Or just transfer the file instead;

rsync/mrsync could be used to keep computer A and computer B's HOSTS files the same

Or ssh to transfer the HOSTS file from A to B.

   echo cat /etc/hosts |ssh -T computerB "cat > /etc/hosts"
Or use ssh to query computer A's HOSTS file from computer B

   echo getent hosts name|ssh -T computerB
Or some small httpd, e.g., darkhttpd

   httpd /etc --port 1153 --addr 10.21.66.4
   tnftp -4o'|grep name' http://10.21.66.4:1153/hosts   
It goes on and on.

But I'm not interested in using the HOSTS file in this way on the local network. I'm more interested in IP addresses than "domain names". I am not a fan of web browsers; I make HTTP requests from the shell command prompt and from shell scripts. For example, I like to create shortcuts for certain IP addresses so I do not have to type them, e.g., when using netcat. For me, the HOSTS file works perfectly for that purpose. I use this functionality every day.

Not every computer on my local network has the same ability to lookup names and IP addresses. Most have zero access to DNS data. No lookups. Some may only be able to lookup a few remote addresses. I might put those in the computer's HOSTS file.


There is a fear or hatred of /etc/hosts amongst web developers. A regurgitated origin story about DNS and a perpetuated myth about the HOSTS file, having to do with constantly dynamic IP addresses. But the truth is that the conditions of the internet have changed. As someone who uses static, stored DNS data, and as such possesses a large chunk of historical DNS data, I have proof that, for the websites I may visit, most IP addresses do not change frequently.

Domain names are overrated. Web marketing hype. For example, no one uses a domain name to log into their router. But no one at home is getting internet access without typing an IP address at least once to set up a router. If I want to type a short, memorable name instead of an IP number to reach a computer on the local network I can make an entry in /etc/hosts. Using computers that have no /etc/hosts and no control over DNS sucks. Let web developers use those computers.

How many times have I seen developers copy entire portions of RFC 1035 into their code as a "comment". Too many to count. They will always struggle to understand it.


Funny I do use a name to log into my router at home. That worked right away and the name is printed in large friendly letters on the router.


Why not tell us the name of the router so we can learn about something different. Would be interesting to see a router with a built-in DNS server. Most home routers I have seen require people to type 192.168.0.1, 10.0.0.1 or whatever to set it up or to change settings. If anyone wants to try to argue otherwise, I could provide links to countless PDFs of manuals online showing this step in the set up instructions.


The router I'm referring to is specific to a provider. Wouldn't be very useful. I've also observed Fritzbox routers using the fritz.box domain for internal networking out of the box.


For example,

https://assets.avm.de/files/docs/fritzbox/fritzbox-7590-ax-v...

"You can also enter the IP address of the FRITZ!Box or the emergency IP.

The preset IP address is: http://192.168.178.1

The emergency IP address is: http://169.254.1.1"

Typing "fritz.box" into a browser is useless unless one already has an internet connection.

If it's a remote DNS query then is that really "internal networking".

Looks like there's an ad for NFTs at fritz.box along with some links to Javascript files and nothing else. No content. I think I'd rather just use a local address.


Somehow you skipped step 2 that says: "Enter the address http://fritz.box" which is the expected way to connect to the device and that worked for me even before Internet is set up. What you quote is the alternative method.

It does look like the domain fritz.box is not owned by AVM, the manufacturer of the device. Apparently they didn't manage to register this domain once .box became available. So in the future they might want to use fritzbox.internal, if this proposal gets approved.


Ask yourself: Why would an alternative method be required.

Typing "fritz.box" into a browser without an internet connection will not accomplish anything. To even get an IP address for "fritz.box" there needs to be either (a) an appropriate entry in /etc/hosts assuming the browser does not ignore /etc/hosts, (b) a DNS server on a loopback address or (c) a DNS server on the local network, _and_ the DNS server needs to have the IP address for "fritz.box" (so the person would have to know the address already, before connecting to the internet) _and_ the browser has been configured to use that local DNS server.

To demonstrate, assuming there is not a DNS server listening on the loopback address 127.23.59.88, change the DNS settings in the operating system to 127.23.59.88. Then try typing "fritz.box" to set up the router.

The reason an "alternative" method is provided in the instructions is because without an internet connection, typing "fritz.box" will not accomplish anything except generating an error.

The reason the company suggests that people type "fritz.box" instead of an IP address is likely because the operator of "fritz.box" website is advertising NFTs for sale. Not to mention the data collection the operator of fritz.box and potentially their marketing partners will gain with respect to people who own these routers. For example, everytime someone is configuring their router and types "fritz.box" the operator of "fritz.box" website gets to know about it.

The "alternative" method is the most reliable method, and the most private one. If we review the manuals for thousands of routers, we learn it is the most common method.


Yea sure if people change their resolver away from the one provided by DHCP, they're on their own. But when they get their connection configured by the router, it works, because the router will act as resolver and resolve fritz.box to itself. As I said, worked fine for me.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: