4 ms·
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 l
by 1vuio0pswjnm7 3y ago
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.
- sedatk 3y agoHow do you synchronize hosts file between clients?
- deleted 3y ago[deleted]
- rzzzt 3y agoYou 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.
- alex_suzuki 3y agoHow would you call this hypothetical system? It’s almost like a distributed system for looking up names.
- rzzzt 3y agoAn RFC might have been submitted for this already, let me check!
- 1vuio0pswjnm7 3y agoWhile 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 https://docs.powerdns.com/recursor/settings.html unbound can serve "local data" https://unbound.docs.nlnetlabs.nl/en/latest/manpages/unbound.conf.html 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.
- 1vuio0pswjnm7 3y agoThere 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.