Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Can i use a remote /etc/hosts file to redirect the ping to my own computer i.e. my /etc/hosts file does not have the entry but the only other computer conncted vua ethernet has the entry.Is it possible.?

share|improve this question

migrated from May 3 '13 at 13:12

This question came from our site for professional and enthusiast programmers.

up vote 1 down vote accepted

This question is ambiguous.

If are asking whether you can cause your machine to ping itself by changing the "/etc/hosts" file on the remote machine the answer is "No you can't".

  • When you execute the ping command on your machine, the first thing it does is to resolve the hostname you are pinging to an IP address. This is typically done by looking in the local "/etc/hosts" file and/or DNS. The remote machine's "/etc/hosts" file is not consulted.

  • Then the "ping" command sends an ICMP packet to the IP address that the hostname resolved to. At no point is there any further translation of the hostname, either locally or on the host that the packet goes to. The ICMP packet only contains IP addresses.

If you are asking whether you can change your local "/etc/hosts" make your host ping itself when it thinks it is talking to another machine, the answer is "Yes ... sort of". You can make the remote hostname resolve to the IP address of your machine.


  • If you do that, all requests to that hostname from your host will end up talking to your machine ... which unlikely to be a desirable state of affairs.

  • The ICMP packets that "ping" sends will probably be reflected locally without the packets making it onto your local network. That means that you "ping" won't tell you much about how the network is working.

share|improve this answer

I also figured out the same thing. I also put the question in a different format on SO but i am now quite sure it cannot be done and if possible is worth no use. Thnx for the answers though.

The reason for asking the question is you can refer to my other zeroconf network asked about the .local thing.

Thnx Anyway.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .