0

Typically the /etc/network/interfaces file on Debian can include routing requirements such as

post-up   iptables -t nat -A POSTROUTING -s '10.10.10.0/24' -o vmbr0 -j MASQUERADE
post-down iptables -t nat -D POSTROUTING -s '10.10.10.0/24' -o vmbr0 -j MASQUERADE

If i wanted to exclusively use UFW (and not touch the interfaces file) where would I put the post-down line?

I know that the post-up line equivalent can be put inside /etc/ufw/before.rules like so:

*nat
:POSTROUTING ACCEPT [0:0]
-A POSTROUTING -s 10.10.10.0/24 -o vmbr0 -j MASQUERADE
COMMIT

thanks,

0

Not recommended but you can edit the function stop/restart on /lib/ufw/ufw-init otherwise you can start a watching script with /etc/ufw/after.init that would fire your post-down when the interface is down... this may be helpful to write the watching script.

More info

| improve this answer | |
  • Thank you, and welcome to StackExchange. I may resort to iptables and ditch UFW! – gurpal2000 Jun 20 at 8:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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