I've got a rack full of Linux servers that host OpenVZ containers and for some reason when I attempt to connect to a certain remote IP from inside a few of the OpenVZ containers (using telnet, for example), I end up connecting to another server on the local network instead. So far, I have looked at the following possibilities:
Checked the server that I'm trying to make the outbound connection from to make sure there are no iptables rules that would redirect the remote IP to a local ip.
Checked our router/firewall to make sure there are no rules that would redirect this outbound connection to a local ip.
Checked the OpenVZ container that it is erroneously connecting to and made sure that it does not have the remote IP configured as an IP alias.
All OpenVZ containers are running CentOS 5.x.
I'm sure it's something simple, but I'm running out of ideas.
When this happens, you should do a
traceroute
to the remote host. You'll see where in your routing infrastructure the traffic takes a "wrong turn" and you can inspect that device closer. Obviously there's a config or NAT rule or something else somewhere that you've overlooked that's causing this.