Skip to content

Instantly share code, notes, and snippets.

@bilxio
Created November 7, 2018 05:56
Show Gist options
  • Select an option

  • Save bilxio/28cf9c12ccd24bb591a34d60f2cbbc0b to your computer and use it in GitHub Desktop.

Select an option

Save bilxio/28cf9c12ccd24bb591a34d60f2cbbc0b to your computer and use it in GitHub Desktop.
save-iptables

save

open or create iptables script

# vim /etc/network/if-post-down.d/iptables

write these lines

#!/bin/bash
iptables-save > /etc/iptables.rules

save and make it executeable

# chmod +x /etc/network/if-post-down.d/iptables

restore

open or create file

# vim /etc/network/if-pre-up.d/iptables

save these lines

#!/bin/bash
iptables-restore < /etc/iptables.rules

make it executable as well

# chmod +x /etc/network/if-pre-up.d/iptables
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment