Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

A command line application set up a rule to forward local port 8080 traffic to a VM's port 80. Something went wrong and left this definition. How can I find and remove this port forwarding rule?

share|improve this question
up vote 2 down vote accepted


If it only modify the in memory rules, the laziest way is to reboot. If you want to remove the rule(s) without reboot, do following (assuming the program did not modify rule file)

pfctl -f /etc/pf.conf

That will reset+reload the default system rules. Thus removing the port forwarding rule(s).


If the program modified the rule files, check following

File/Directory referred in /etc/pf.anchors/

After modifying, do following

  1. Check pf.conf for error first

    pfctl -nf /etc/pf.conf

  2. If no error, deploy new rules without reboot

    pfctl -f /etc/pf.conf

share|improve this answer
Reboot seemed to do the trick. =] – Andrew Jan 22 '13 at 1:27
pfctl -f /etc/pf.conf didn't remove the in memory rules for me... – Ryan Walls Sep 5 '14 at 15:43
@Ryan This is indeed similar for me, I've found I need to explicitly specify the anchor if I want to flush the relevant rules. (with -a) – Aktau Nov 8 '14 at 14:30

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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