Sample Header Ad - 728x90

alias fake hostname via /etc/hosts

3 votes
2 answers
1110 views
In /etc/hosts, I added the following line: github.com git.hub In chrome browser, when I enter the address git.hub it can't redirect to github.com, instead it does a search. In Linux terminal (e.g bash), when I enter cmd ping git.hub, it says git.hub: Name or service not known. In my /etc/nsswitch.conf, the hosts config is like this: hosts: files mdns4_minimal [NOTFOUND=return] dns myhostname I suppose it means check the /etc/hosts first, then dns. So, why git.hub can't become an alias for github.com after my configuration. And, is there anyway to achieve that, without actually change the DNS record.
Asked by Eric (443 rep)
Oct 9, 2024, 02:51 AM
Last activity: Oct 9, 2024, 06:50 AM