Shaun Luttin
Shaun Luttin

Reputation: 141414

Why does this hosts file entry only work with a browser and the host name?

My workstation's C:\Windows\System32\drivers\etc\hosts file contains the following (hypothetical) IP address mapping:

111.222.33.444         sub.domain.tld

In Firefox I can successfully browse to the sub.domain.tld host name. Since I can browse to the host name...

  1. Why can I not browse directly to the 111.222.33.444 IP address?
  2. Why can I ping neither 111.222.33.444 nor sub.domain.tld?

Clearly I lack an understanding what the hosts file is doing.

Upvotes: 0

Views: 174

Answers (1)

ceejayoz
ceejayoz

Reputation: 179984

Why can I not browse directly to the 111.222.33.444 IP address?

Chances are the server has a default virtualhost that's different than sub.domain.tld. That default virtualhost may be set up to reject your request.

Why can I ping neither 111.222.33.444 nor sub.domain.tld?

ping sub.domain.tld will ping 111.222.33.444, but a server isn't required to respond to ping. It (as well as you) may be firewalled off from ICMP traffic.

Upvotes: 2

Related Questions