Skip to main content
Became Hot Network Question
edited body
Source Link
Eric
  • 443
  • 1
  • 3
  • 14

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, itis there anyway to achieve that, without actually change the DNS record.

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, it there anyway to achieve that, without actually change the DNS record.

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.

added 8 characters in body
Source Link
muru
  • 78.1k
  • 16
  • 213
  • 319

In /etc/hosts, I added the following line:

github.com git.hub

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

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, it there anyway to achieve that, without actually change the DNS record.

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, it there anyway to achieve that, without actually change the DNS record.

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, it there anyway to achieve that, without actually change the DNS record.

Source Link
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, it there anyway to achieve that, without actually change the DNS record.