0

I want to do something similar to what the hosts file does. I just want to set it so that certain IP's always go to the IP I want it to go to...

eg. Have...

158.204.281.222

always go to

160.201.21.239

just as a random example... is this possible?

Thanks,
Matt

1 Answer 1

2

You're looking for Network Address Translation, although a typical google search on the term won't help you much because you're looking to do the reverse of what most NAT devices (home routers) do - you want to rewrite the destination IP of outbound traffic, rather than the source IP.

You'll likely have a hard time doing this with a home router or all-in-one wireless gateway, but almost every professional-grade router will do the trick. Using linux and iptables, you should be able to accomplish this on a firewall with something like:

iptables -t nat -A PREROUTING --dst 158.204.281.222 -p tcp --dport 80 -j DNAT \
  --to-destination 160.201.21.239

You must log in to answer this question.

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