How to configure NAT from Shell Command?



  • Hi, i have tried the following solution:

    1. Dump the current ruleset into a file
    pfctl -sn > /var/tmp/tempfile

    2. Edit the file and add my rule after the last nat rule)
    nat on vr0 inet from 192.168.2.0/24 to 192.168.1.0/24 -> (vr0) round-robin

    3. Import the whole ruleset again
    pfctl -Nf /var/tmp/tempfile

    But the rules that i created doesn't show on the web GUI, and i believe this method is not persistent.

    Does anyone have another method to do NAT by the shell command and please share here?

    Thank you.