Objective

Iptables rules are by default not persistent after reboot. The objective is to make iptables rules persistent after reboot.

Requirements

Privileged remote or physical access to your Ubuntu or Debian Linux system is required to complete this task.

Difficulty

EASY

Instructions

iptables-persistent installation

In order to make your iptables rules persistent after reboot install iptables-persistent package using apt-get tool:
# apt-get install iptables-persistent
Any currently erected iptables rulles will be saved to corresponding IPv4 and IPv6
/etc/iptables/rules.v4
/etc/iptables/rules.v6
files.

Updating iptables rules

To update persistent iptables with new rules simply use iptables command to include new rules into your system. To make changes permanent after reboot run iptables-save command:
# iptables-save > /etc/iptables/rules.v4
OR
# ip6tables-save > /etc/iptables/rules.v6

Remove persistent iptables rules

To remove persistent iptables rules simply open a relevant /etc/iptables/rules.v* file and delete lines containing all unwanted rules.
ARE YOU LOOKING FOR A LINUX JOB?
Submit your RESUME or create a JOB ALERT on LinuxCareers.com job portal.
DO YOU NEED ADDITIONAL HELP?
Get extra help by visiting our LINUX FORUM or simply use comments below.

You may also be interested in: