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

Ubuntu tutorials

  • How to add a user on Linux with sudo access
  • How to check if a user has password on Linux
  • How to install ViewVC for svn repository on Ubuntu Linux
  • How to setup ssl (https) for your site on Ubuntu Linux
  • Install rabbitmq on Ubuntu Linux
  • LXC (Linux Containers) - quick start tutorial on Ubuntu
  • Linux - command to check swap size
  • Linux - how to add a user using useradd
  • Linux - how to create a large file like 1GB
  • Linux - how to create swap partition
  • Linux - how to remove user from a group
  • Linux - number of cpus (lscpu)
  • Linux du - find disk usage of directories or files
  • NFS client and server handy commands
  • Setup svn repository on AWS Ubuntu with apache auth
  • Ubuntu - check if a service is upstart based
  • Ubuntu - dpkg and apt-get beginner tutorial
  • Ubuntu - find file to package
  • Ubuntu - find where will a package be installed from
  • Ubuntu - how to auto start services on boot using update-rc.d (sysv init)
  • Ubuntu - how to find boot autostart status of a service
  • Ubuntu - reload iptables rules during boot
  • Use x2go to access remote Ubuntu Linux
 
  • Home
  • > Tutorials
  • > Ubuntu Linux

Ubuntu – reload iptables rules during boot

on Jun 27, 2016

Steps to load iptable rules automatically on Ubuntu Linux using package iptables-persistent.

  1. Install iptables-persistent
    $ sudo apt-get install iptables-persistent
    
  2. When asked during installation should it save current iptables to /etc/iptables/rules.v4 and /etc/iptables/rules.v6, enter yes.
    iptables-persistent-config-file-install-prompt

  3. In case you make any changes to iptables, run the following to persist these. Note that rules won’t get persisted automatically.
    $ sudo /etc/init.d/iptables-persistent save 
    
  4. Do a diff of changes made to ip tables with persisted values in /etc/iptables/rules.v4
    $ sudo iptables-save > unsaved_rules
    $ diff unsaved_rules /etc/iptables/rules.v4
    

    Similarly we can diff v6 rules using ip6tables-save

  5. To reload iptables rules (v4 and v6 both) using /etc/init.d/iptables-persistent
    $ sudo /etc/init.d/iptables-persistent reload
    

    Note that this will override current loaded rules in iptables.

  6. On reboot /etc/init.d/iptables-persistent will load saved rules automatically.

Suggested posts:

  1. Linux iptables and ip6tables examples
  2. AngularJS ng-if vs ng-hide/ng-show
  3. Install google camera on Asus m1 max pro
  4. How to find docker host ip on Mac
  5. Ubuntu – how to auto start services on boot using update-rc.d (sysv init)
  6. redis cli quick start tutorial
  7. Ubuntu – how to find boot autostart status of a service
  8. LXC (Linux Containers) – quick start tutorial on Ubuntu
Share this article: share on facebook share on linkedin tweet this submit to reddit
Posted in Tutorials | Tagged Tutorials, Ubuntu Linux
  • 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