8

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

2
  • 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, 2013 at 12:56
  • It is not an option
    – Eazy
    Feb 4, 2013 at 12:57

1 Answer 1

8

I found the solution:

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

After a restart you have to run this commands again.

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

You must log in to answer this question.

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