• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer navigation

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • Solaris
    • Oracle Linux
    • VCS
  • Interview Questions
  • Database
    • oracle
    • oracle 12c
    • ASM
    • mysql
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

How To Store iptables Rules To Survive Across Reboots in CentOS/RHEL

by admin

The following steps show how to store iptables rules to survive across OS reboots. In some cases like patching iptables package can be reinstalled. In that case, having a backup of iptables rules can be very handy.

1. Make sure firewalld is down and disabled. If they are not down/disabled, please run:

# systemctl stop firewalld
# systemctl disable firewalld

2. Install iptables-services package and start/enable iptables service, as follows:

# yum install -y iptables-services.x86_64
# systemctl start iptables
# systemctl enable iptables

3. Add your rules:

The following is just and example of how to add a rule

# iptables -I INPUT 1 -p tcp -m tcp --dport 7003 -j ACCEPT

4. Save rules to make them persistent across reboots or even OSMS patching.

# service iptables save

5. You can also list your rules to make sure rules were successfully saved in file:

# cat /etc/sysconfig/iptables
# iptables -L

Filed Under: CentOS/RHEL, Linux

Some more articles you might also be interested in …

  1. CentOS / RHEL : How to identify/match LUN presented from SAN with underlying OS disk
  2. mkinitrd: command not found
  3. pdfxup Command Examples in Linux
  4. lvreduce Command Examples in Linux
  5. compsize: command not found
  6. libreoffice: command not found
  7. How to merge 2 volume groups (VGs) into one using vgmerge in LVM
  8. UNIX / Linux : how to force user to change their password on next login after password has reset
  9. How to uninstall chromium-browser from Ubuntu
  10. cuyo: command not found

You May Also Like

Primary Sidebar

Recent Posts

  • raw: command not found
  • raw Command Examples in Linux
  • rankmirrors Command Examples in Linux
  • radeontop: command not found

© 2023 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright