• 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

CentOS / RHEL : How to make iptable rules persist across reboots

by admin

Sometimes after a reboot, iptables rules are not available as they are not saved to be persistent. The post below describes steps to save iptables persistently.

Making iptable rules persistent

1. Add rules to the iptables according to your requirment.

2. Verify that all the rules are present using the command “iptables -L“.

# iptables -L

3. Save the iptables.

# service iptables save

4. Restart the service.

# service iptables restart

5. Making service permanently ON using chkconfig.

# chkconfig iptables on

Troubleshooting

If there is any error while restarting the service then follow this steps below.

1. Afrer saving the iptable rules, restore the SELinux context of iptables file.

# restorecon -Rv  /etc/sysconfig/iptables

2. Restart the iptables service.

# service iptables restart

3. Make the service on persistently using chkconfig.

# chkconfig iptables on

Filed Under: Linux

Some more articles you might also be interested in …

  1. How to Migrate CentOS/RHEL 6 iptables Rules to CentOS/RHEL 7 firewalld
  2. How to Reinstall Corrupted Library with yum
  3. How to Change the Network Bonding Mode in CentOS/RHEL 6
  4. sestatus Command Examples in Linux
  5. CentOS / RHEL 7 : How to configure kdump using GUI
  6. How to run a cron job on specific days of the week
  7. How to copy directories recursively using rsync while excluding specific files
  8. Linux OS Service ‘xendomains’
  9. CentOS / RHEL : How to mount filesystems using UUID
  10. CentOS / RHEL 7 : How to boot into Rescue Mode or Emergency Mode

You May Also Like

Primary Sidebar

Recent Posts

  • JavaFX ComboBox: Set a value to the combo box
  • Nginx load balancing
  • nginx 504 gateway time-out
  • Images preview with ngx_http_image_filter_module

© 2022 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright