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

I have a software package which is hard-coded to open a connection to a certain local IP address. Unfortunately, the local network settings have changed, And I can't access the source code (long story).

Is there a way - like ssh tunneling - to redirect a certain ip address to another?

For example, my software would contact, which will be redirected to, a real address on another machine, in a transparent way.

Any Ideas?

share|improve this question
up vote 3 down vote accepted

A colleague of mine introduced me to iptables:

iptables -t nat -A OUTPUT -d -j DNAT --to-destination
share|improve this answer

Add a static route for the server IP to the server's real IP on the client. Add the server IP address as a subinterface on the server.

server# ifconfig eth0:1

client# route add -host gw
share|improve this answer

Add the server IP as a subinterface on the server. Add another IP in that network to the client machine as a subinterface.

This assumes they are currently on the same network.

server# ifconfig eth0:1

client# ifconfig eth0:1
share|improve this answer

I think that's the way to go:

sudo ip addr add dev eth0

That simply adds an IP address to eth0

share|improve this answer
in which machine? – Adam Matan Oct 6 '09 at 6:45
@Udi, good question: if one could assign the target machine that extra IP address (if not used elsewhere to start with) then I guess this would be the same as reverting back to the old local network settings, which I assume does not work for you. In other words: I don't think you can use this (unless you actually need to refer to localhost, which you don't). – Arjan Oct 6 '09 at 12:47

You must log in to answer this question.

protected by Daniel Beck Aug 10 '12 at 17:48

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

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