Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Alias IP Address

Status
Not open for further replies.

NiceButDim

Programmer
Feb 12, 2002
154
GB
Hi,
This could be a dumb question cause it's something that i know little about, and maybe i'm posting it in the wrong place as well!, but here goes.

I am trying to run some old code (which we cant change for the moment) that accesses a box on a customer's network. We cannot access that box using the IP address that the code uses due to firewall issues. We do however have an alternative IP address that does allow us to access the box. My question is, is there a way, via the hosts file or whatever, that will result in the IP address that does work being used in place of the one that doesn't.

Thanks in advance.

john.
 
Not the hosts file, but you can do it with iptables. Something like:

Code:
iptables -t nat -A PREROUTING -p tcp -d <unusable ip> -j DNAT --to-destination <new ip>

should work for you. That's going mostly from memory, so you'll undoubtedly have to tweak it to get it to work.
 
Hi jkupski,
I think that /etc/hosts is the way to go.

PencilB confirms that the second address is accessible fromoutside.

Adding the DNS name and new ip address to /etc/hosts will do it.


QatQat

Life is what happens when you are making other plans.
 
PencilB confirms that the second address is accessible fromoutside.

Adding the DNS name and new ip address to /etc/hosts will do it.

The initial post said "I am trying to run some old code (which we cant change for the moment) that accesses a box on a customer's network. We cannot access that box using the IP address that the code uses due to firewall issues." He may have not stated his problem correctly, but the above says he is not working with a hostname, but an IP address. Since there is no name lookup, /etc/hosts does not come into play here.

Actually, what I am now wondering is why he didn't just change the code?
 
We can't change the code because we don't have it yet. All we have are the executables and we were simply wanting to run them in order to answer some questions prior to taking over support of the product (the people currently doing support, very badly, are not helping much!)
Anyway it looks like we will just have to wait a few weeks until we have the source before proceeding.

Thanks again for taking the time to reply.

john.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top