How do I map a friendly name (e.g. www.example.com) to 127.0.0.1:port# on Mac OS X

Posted by Fred Finkle on Server Fault See other posts from Server Fault or by Fred Finkle
Published on 2012-09-15T15:15:38Z Indexed on 2012/09/15 15:39 UTC
Read the original article Hit count: 159

Filed under:
|

I am trying to create a demo for a class of mine and I want to configure "fake" domain names on my laptop.

A previous question "Can I specify a port in an entry in my /etc/hosts on OS X?" contained an answer indicating that to do it you must use /etc/hosts plus changes to the iptables

"If OS X uses iptables you could point xyz.com to some ip in the hosts file like 157.166.226.25 and then:

sudo iptables -t nat -A OUTPUT -p tcp --dport 80 -d 157.166.226.25 -j DNAT --to-destination 127.0.0.1:3000 "

Since OS X doesn't use iptables, how do I do the equivalent using the tools available on OS X? (the original "asker" seemed to know how to do this, so it wasn't explained).

Thanks in advance.

© Server Fault or respective owner

Related posts about iptables

Related posts about macosx