On my Mac OS X (10.6.8) I'd like to make all requests for 111.111.111.111
go to 222.222.222.222
for all ports. To test this, I have a webserver at 222.222.222.222:80
which will respond with a page for any host. e.g:
- http://222.222.222.222/
- http://whatever.222.222.222.222.xip.io/
- http://host.which.resolves.to.that.server/
I've tried doing the following:
sudo ifconfig lo0 222.222.222.222 alias
sudo ipfw add fwd 111.111.111.111 tcp from me to 222.222.222.222
But trying to access http://111.111.111.111/
doesn't give me anything. I think this is related to the fact that although the redirect is there, the tcp packet's destination IP is not rewritten.
Where should I look next to solve this? Should I also look into using natd?