0

I'm working on a mac with OS 10.13.6.

I want to redirect all requests to 10.20.154.24:1111 made from my computer go to localhost:8080.

I read about pf and pfctl, but could not make this work.

I thought to run this, but it didn't work...

echo "
rdr pass inet proto tcp from 127.0.0.1 to 10.20.154.24 port 1111 -> 127.0.0.1 port 8080
" | sudo pfctl -ef -
0

If your traffic is coming from your computer and since the destination isn't your computer the from can't be 127.0.0.1. The from IP is the IP address associated with the interface to use to reach 10.20.154.24.

To make an easy test, just start by removing the part from 127.0.0.1, so as to catch all traffic tcp to 10.20.154.24 port 1111 which will include the one you want to redirect.

Next, and if this is necessary, check your outgoing interface IP address with:

ifconfig en0

(because I bet your interface is the WAN one, but adapt to your real case).

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.