0View source /~bencollver/log/2024-12-17-no-dns-no-problem/index.txt tilde.pink 70
i Err tilde.pink 70
i# 2024-12-17 - No DNS, No Problem Err tilde.pink 70
i Err tilde.pink 70
iThe early Internet used /etc/hosts files to resolve names. These Err tilde.pink 70
iwere distributed on FTP sites. You can see a 1992 example below. Err tilde.pink 70
i Err tilde.pink 70
0host.txt from textfiles.com /text/internet/hosts.txt quix.us 70
i Err tilde.pink 70
iThe /etc/hosts file quickly grew too large to be manageable. Err tilde.pink 70
iSee historical document below. Err tilde.pink 70
i Err tilde.pink 70
0hosts.hst from textfiles.com /text/internet/hosts.hst quix.us 70
i Err tilde.pink 70
iInternet users switched to DNS. Err tilde.pink 70
i Err tilde.pink 70
iRecently, for various reasons, i became interested in avoiding DNS, Err tilde.pink 70
iso i researched using an /etc/hosts file. I found one on Err tilde.pink 70
igopher.quest, but unfortunately it is incomplete. Err tilde.pink 70
i Err tilde.pink 70
1hosts.txt at gopher.quest /gopher-map-data gopher.quest 70
i Err tilde.pink 70
iI noticed that the Quarry gopher search engine contains a little over Err tilde.pink 70
i300 live gopher hosts. I wrote the author about it, and he generously Err tilde.pink 70
icreated an /etc/hosts file from the Quarry database, linked below. Err tilde.pink 70
i Err tilde.pink 70
0hosts.txt at gopher.icu /files/hosts.txt gopher.icu 70
i Err tilde.pink 70
iThis is updated daily. On a linux system, you could replace Err tilde.pink 70
i/etc/hosts with this file and assuming a sane C library, it should Err tilde.pink 70
i"just work." It will resolve those names without DNS. Err tilde.pink 70
i Err tilde.pink 70
iFreeDOS is slightly more complicated. Suppose the file is in Err tilde.pink 70
iC:/etc/hosts.txt and will be used by mTCP and WATTCP. Err tilde.pink 70
i Err tilde.pink 70
iFor mTCP, edit mtcp.cfg, add: Err tilde.pink 70
i Err tilde.pink 70
i HOSTSFILE C:/etc/hosts.txt Err tilde.pink 70
i Err tilde.pink 70
iFor WATTCP, edit wattcp.cfg, add: Err tilde.pink 70
i Err tilde.pink 70
i hosts = C:/etc/hosts.txt Err tilde.pink 70
i Err tilde.pink 70
iNow FreeDOS programs should resolve those names without DNS. Err tilde.pink 70
i Err tilde.pink 70
iThis covers gopher hosts. I would also like to include FTP and web Err tilde.pink 70
ihosts referenced by my gopher maps. Below is a script i wrote to Err tilde.pink 70
imirror gopher content. Err tilde.pink 70
i Err tilde.pink 70
0gopher-get.tcl /~bencollver/files/gopher/scripts/gopher-get.tcl tilde.pink 70
i Err tilde.pink 70
9tclcurl.tgz SlackBuild /~bencollver/files/tclcurl.tgz tilde.pink 70
i Err tilde.pink 70
iUsing this script, i mirrored my gopher content. Err tilde.pink 70
i Err tilde.pink 70
i $ mkdir gopherhole Err tilde.pink 70
i $ cd gopherhole Err tilde.pink 70
i $ tclsh gopher-get.tcl --binary-skip --images-skip \ Err tilde.pink 70
i --ignore
gopher://tilde.pink/1/~bencollver/dir \ Err tilde.pink 70
i --ignore
gopher://tilde.pink/1/~bencollver/dict \ Err tilde.pink 70
i --ignore
gopher://tilde.pink/1/~bencollver/gamefaqs \ Err tilde.pink 70
i --ignore
gopher://tilde.pink/1/~bencollver/ia \ Err tilde.pink 70
i --ignore
gopher://tilde.pink/1/~bencollver/recipes \ Err tilde.pink 70
i
gopher://tilde.pink/1/~bencollver Err tilde.pink 70
i Err tilde.pink 70
iThis took a while, so i let it run and came back later. This created Err tilde.pink 70
itwo directories. Err tilde.pink 70
i Err tilde.pink 70
i* tilde.pink/0 (Plain text documents) Err tilde.pink 70
i* tilde.pink/1 (Gopher maps) Err tilde.pink 70
i Err tilde.pink 70
iI scraped the host names from these directories as follows. Err tilde.pink 70
i Err tilde.pink 70
i $ find tilde.pink/1 -type f -exec \ Err tilde.pink 70
i grep -e URL:ftp: -e URL:http: -e URL:https: {} \; |\ Err tilde.pink 70
i sed -e 's,.*URL:[^:]*://,,' -e 's,/.*,,' >names-gopher.txt Err tilde.pink 70
i $ find tilde.pink/0 -type f -exec \ Err tilde.pink 70
i awk -f setext-scrape-links.awk {} \; >names-setext.txt Err tilde.pink 70
i $ cat names-gopher.txt names-setext.txt | sort |\ Err tilde.pink 70
i uniq >names-extra.txt Err tilde.pink 70
i $ wc -l names-extra.txt Err tilde.pink 70
i 392 names-extra.txt Err tilde.pink 70
i Err tilde.pink 70
0setext-scrape-links.awk /~bencollver/log/2024-12-17-no-dns-no-problem/setext-scrape-links.awk tilde.pink 70
i Err tilde.pink 70
iThis shows that i reference approximately 400 non-gopher names. Now i Err tilde.pink 70
iwould like to resolve these to IP addresses. I wrote a short AWK Err tilde.pink 70
iscript to do this. I ignored unkown names because of old documents Err tilde.pink 70
ithat reference defunct names. Err tilde.pink 70
i Err tilde.pink 70
i $ awk -f resolve.awk names-extra.txt >hosts-extra.txt Err tilde.pink 70
i $ wc -l hosts-extra.txt Err tilde.pink 70
i 612 hosts-extra.txt Err tilde.pink 70
i Err tilde.pink 70
0resolve.awk /~bencollver/log/2024-12-17-no-dns-no-problem/resolve.awk tilde.pink 70
i Err tilde.pink 70
iBecause DNS can resolve a name to multiple IP addresses, this list Err tilde.pink 70
igrew from 392 to 612 lines. I appended this list to the Quarry hosts Err tilde.pink 70
ifile like so. Err tilde.pink 70
i Err tilde.pink 70
i $ curl -o hosts-icu.txt
gopher://gopher.icu/0/files/hosts.txt Err tilde.pink 70
i $ cat hosts-icu.txt hosts-extra.txt >hosts-all.txt Err tilde.pink 70
i $ wc -l hosts-all.txt Err tilde.pink 70
i 1058 Err tilde.pink 70
i Err tilde.pink 70
iFor FreeDOS, filter out ":" to exclude IPv6 addresses. Also, mTCP Err tilde.pink 70
ihas an 80 character line length limit including EOL characters. Err tilde.pink 70
i Err tilde.pink 70
i $ grep -v : hosts-all.txt |\ Err tilde.pink 70
i awk 'length($0) < 78 {print}' >hosts-dos.txt Err tilde.pink 70
i Err tilde.pink 70
iNow i can copy hosts-all.txt to /etc/hosts Err tilde.pink 70
ior copy hosts-dos.txt to C:/etc/hosts.txt Err tilde.pink 70
iand i am good to go. Err tilde.pink 70
i Err tilde.pink 70
ip.s. Err tilde.pink 70
i Err tilde.pink 70
iThe FreeDOS bundled mTCP has a bug. If you specify HOSTSFILE but no Err tilde.pink 70
iNAMESERVER, then name resolution will always fail. You can work Err tilde.pink 70
iaround this by making sure mtcp.cfg has a NAMESERVER line. If you Err tilde.pink 70
idon't use DNS at all, it can be: Err tilde.pink 70
i Err tilde.pink 70
i NAMESERVER 127.0.0.1 Err tilde.pink 70
i Err tilde.pink 70
itags: bencollver,retrocomputing,technical,unix Err tilde.pink 70
i Err tilde.pink 70
i# Tags Err tilde.pink 70
i Err tilde.pink 70
1bencollver /~bencollver/log/tag/bencollver/ tilde.pink 70
1retrocomputing /~bencollver/log/tag/retrocomputing/ tilde.pink 70
1technical /~bencollver/log/tag/technical/ tilde.pink 70
1unix /~bencollver/log/tag/unix/ tilde.pink 70