Why is macos ignoring etc/hosts
I have seen this: /etc/hosts file being ignored
And it is not a TAB but a space between ip address and domain.
Is there something special you need to do on MacOS to use etc/hosts.
I have a local sige mydns.com in etc/hosts:
##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting. Do not change this entry.
##
127.0.0.1 localhost
255.255.255.255 broadcasthost
::1 localhost
# Added by Docker Desktop
# To allow the same kube context to work on the host and the container:
127.0.0.1 kubernetes.docker.internal
172.18.0.0 *.mydns.com
When I do curl subdomain.mydns.com it goes out to the nameservers getting the Internet ip address and not the local ip address specified in the etc/hosts?
The HOSTS file of all of todays operating systems can contain letters and some symbols. The is no such thing as "wildcards" in the basic internet naming system (rfc882), so as the most basic name resolution table. For example, it doesn't deal with providing additional information, wildcards, QCLASS=*, or overlapping zones.
If you want to redirect a large number of hostnames (*) I would recommend using a DNS server or at least a DNS proxy allowing that.