Skip to main content
3 of 3
edited body
Eric
  • 443
  • 1
  • 3
  • 14

alias fake hostname via /etc/hosts

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.

Eric
  • 443
  • 1
  • 3
  • 14