I want when on my local machine redirect from port 80 to localhost port 9790. How can I do it with ipfw rule?

  • 1
    Poor man's solution would be to use http://localhost:9790 in the browser. I assume this is not an option for you? – nohillside Feb 4 '13 at 12:56
  • It is not an option – Eazy Feb 4 '13 at 12:57

I found the solution:

sudo ifconfig lo0 alias
sudo ipfw add fwd,9790 tcp from me to dst-port 80

After a restart you have to run this commands again.

| improve this answer | |
  • You can define a launchd entry to automatically execute these commands on a reboot. – nohillside Feb 13 '13 at 20:32
  • or you could put it in your ~/.bash_profile but that would only work if you live in the terminal – Chris Rutherford Dec 6 '18 at 16:17
  • Unfortunately ipfw has been deprecated. How to achieve the same using pfctl tool? – Eazy Feb 5 at 4:06

You must log in to answer this question.

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