Add the .dev generic Top Level Domain (gTLD) we want to redirect to localhost.
$ sudo echo "address=/dev/127.0.0.1" > /etc/NetworkManager/dnsmasq.d/tld.dev
Restart the NetworkManger service.
$ sudo systemctl restart network-manager
Try and ping any domain with TLD of .dev.
$ ping -c 4 kianmeng.dev PING kianmeng.dev (127.0.53.53) 56(84) bytes of data. 64 bytes from 127.0.53.53: icmp_seq=1 ttl=64 time=0.077 ms 64 bytes from 127.0.53.53: icmp_seq=2 ttl=64 time=0.106 ms 64 bytes from 127.0.53.53: icmp_seq=3 ttl=64 time=0.091 ms 64 bytes from 127.0.53.53: icmp_seq=4 ttl=64 time=0.096 ms --- kianmeng.dev ping statistics --- 4 packets transmitted, 4 received, 0% packet loss, time 2999ms rtt min/avg/max/mdev = 0.077/0.092/0.106/0.014 ms
But wait, isn't we just configured any domains end with .dev will be resolved to IP address of 127.0.0.1. How come it was resolved to 127.0.53.53 instead? It seems, this particular unique IP address appeared to indicate a possible name collision issue. To quote ICANN site,
"127.0.53.53 is a special IPv4 address that will appear in system logs alerting system administrators that there is potential name collision issue, enabling a quick diagnosis and remediation. The "53" is used as a mnemonic to indicate a DNS-related problem owing to the use of network port 53 for the DNS service."We can find more details by checking it using dig command.
$ dig kianmeng.dev TXT +short "Your DNS configuration needs immediate attention see https://icann.org/namecollision"
In other words, the IP address 127.0.53.53 is an notification to System Administrator to take note that the .dev generic Top Level Domain (gTLD) will be availabe in global DNS server.