InfoHeap
Tech
Navigation
  • Home
  • Tutorials
    • CSS tutorials & examples
    • CSS properties
    • Javascript cookbook
    • Linux/Unix Command Line
    • Mac
    • PHP
      • PHP functions online
      • PHP regex
    • WordPress
  • Online Tools
    • Text utilities
    • Online Lint Tools
search

Centos tutorials

  • Centos - save and restore iptables
  • Centos/RHEL - find package for a file
  • Change default language on Centos/RHEL
 
  • Home
  • > Centos Linux

Centos – save and restore iptables

on Aug 20, 2016

Linux command iptables can be used to make changes to Linux iptables. By default these changes are not reboot-safe and will get lost on reboot. Use these commands to save or restore iptables on Centos (Centos 6).

  1. Install iptables service if not installed using:
    $ sudo yum install iptables
    $ sudo chkconfig iptables on
    $ sudo chkconfig ip6tables on
    
  2. To save changes made to iptables
    $ sudo service iptables save
    iptables: Saving firewall rules to /etc/sysconfig/iptables:[  OK  ]
    $ sudo service ip6tables save
    $ sudo service ip6tables save
    ip6tables: Saving firewall rules to /etc/sysconfig/ip6table[  OK  ]
    
  3. To save iptables changes to a temporary file and diff it with /etc/sysconfig/iptables. This may be useful to review what was changed before saving it.
    $ sudo iptables-save > /tmp/current.iptables
    $ sudo diff /tmp/current.iptables /etc/sysconfig/iptables
    $ sudo ip6tables-save > /tmp/current.ip6tables
    $ sudo diff /tmp/current.ip6tables /etc/sysconfig/ip6tables
    
  4. To reload iptables data (this will undo any unsaved changes)
    $ sudo service iptables restart
    $ sudo service ip6tables restart
    

Suggested posts:

  1. Java – Arrays.sort custom Comparator example
  2. AngularJS ng-if vs ng-hide/ng-show
  3. Install google camera on Asus m1 max pro
  4. CSS3 Gradient examples
  5. Centos/RHEL – find package for a file
  6. Linux – how to run a command as different user
  7. Linux how to modify a user using usermod
  8. AngularJS format date using date filter
Share this article: share on facebook share on linkedin tweet this submit to reddit
Posted in Tutorials | Tagged Centos Linux, Tutorials
  • Browse content
  • Article Topics
  • Article archives
  • Contact Us
Popular Topics: Android Development | AngularJS | Apache | AWS and EC2 | Bash shell scripting | Chrome developer tools | Company results | CSS | CSS cookbook | CSS properties | CSS Pseudo Classes | CSS selectors | CSS3 | CSS3 flexbox | Devops | Git | HTML | HTML5 | Java | Javascript | Javascript cookbook | Javascript DOM | jQuery | Kubernetes | Linux | Linux/Unix Command Line | Mac | Mac Command Line | Mysql | Networking | Node.js | Online Tools | PHP | PHP cookbook | PHP Regex | Python | Python array | Python cookbook | SEO | Site Performance | SSH | Ubuntu Linux | Web Development | Webmaster | Wordpress | Wordpress customization | Wordpress How To | Wordpress Mysql Queries | InfoHeap Money

Copyright © 2025 InfoHeap.

Powered by WordPress