Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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

Hey all, I've recently been asked to administer a couple ubuntu boxes running web servers. I'm a dev by trade so if this question is fairly noob please forgive.

We have about a dozen sites running on this box. 2 of our sites need to talk back and forth over a restful api. Unfortunately we are having issues with the sited connection to each other via wget. When we try and run wget manually from the command line from the server pointing to a site also on that server it hangs and eventually times out. If we do the same thing from outside the server to the same site on the server it works.

Is there something that could be preventing sites on the same server from communicating with each other? The same thing happens pinging the site from the server.

share|improve this question
What does ping tell you about the IP-address when run locally and remotely? – RedGrittyBrick Oct 26 '10 at 15:06
in both cases ping resolves the IP to the external ip, it just never gets a response. (same for wget and nslookup) – JoshReedSchramm Oct 26 '10 at 16:10

I'd check /etc/hosts for incorrect entries. I'd also check the hosts resolution order and DNS configuration.

For example, if your run wget and /etc/hosts contains an entry for then this command would fail when run locally.


/etc/hosts doesn't contain "routes" in the normal sense (see netstat -nr) it contains associations between hostnames and ip-addresses.

You mention "internal ip names" and "external ip" - Are you referring to an "external ip address" and an "internal ip address" where the external ip-address is an address for the external interface of your router and hence the one used by Internet users to access your production web-server?

If so, it is likely that your web-server thinks that is an external off-LAN ip-address, forwards the wget traffic to your router, whose NAT & port-mapping doesn't allow routing to that ip-address from it's LAN side.

If so, edit /etc/hosts and either replace the external ip-address with the internal ip-address or add an extra entry with the internal 10.n.n.n ip-address and use that new name in wget

share|improve this answer
the only entries in hosts besides your typical localhost route is routes to 2 internal ip names for our production and staging servers. one of those 2 is the box in question. but these route a 10.x.x.x ip to a domain. Nothing for – JoshReedSchramm Oct 26 '10 at 16:11
See edited answer (comment box was too small) – RedGrittyBrick Oct 26 '10 at 17:04

I assume you have a setup like so:

Internet--NAT device/router--internal network-->web server

Suppose the web server has name and resolves to the external IP address and the NAT device DNATs to which is internal IP of the web server.

This works well for external clients but internal clients need additional configuration. Reason: Suppose the internal client ( wants to reach ( It sends the traffic to the default router (let's say it is the NAT device though complex routing setups are more likely). The NAT device NATs the dest IP from to and send the traffic to (At this point a dumb NAT may send a (useless) ICMP redirect because traffic is going out the same interface it came in on.) gets the traffic, formulates a response, and sends it back to the client No routing/NATing is done because the web server is on the same subnet. receives traffic from and goes "WTF? (i.e., sends a TCP reset packet) because it wasn't talking to It was talking to and doesn't know is really Only the NAT device knows that.

There are three solutions to this.

  1. SNAT. When the NAT device receives a request for a NATed external IP from the inside it NATs the source address to (one of) its own IP address so it gets the response from the web server and can perform a DNAT on them.

  2. Differing internal/external DNS. Configure the internal name servers to return for (Requires another name server to server external queries with the external IP address.)

  3. Since the client in this case is the web server itself you could add as an alias for (Easy but doesn't scale.)

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.