Skip to main content Logo (IEC resistor symbol)logo

Quis custodiet ipsos custodes?
Home | About | All pages | RSS Feed | Gopher

Restore iptables rules after a reboot on debian

Published: 12-12-2012 | Author: Remy van Elst | Text only version of this article

Table of Contents

This small tutorial will help you set up iptables to survive a reboot. First youneed to define the rules you want, then continue with this tutorial.

If you like this article, consider sponsoring me by trying out a Digital OceanVPS. With this link you'll get $100 credit for 60 days). (referral link)

After the rules are defined and tested, execute the following command to savethe rules to /etc/iptables.conf

iptables-save > /etc/iptables.conf

Now edit the /etc/network/interfaces file, and add the following right afterthe line which looks like iface eth0 inet static (eth0 and static might bedifferent.):

  pre-up iptables-restore < /etc/iptables.conf

Now save the file, and after a reboot the IPtables rules will be in place.

Tags: debian, firewall, iptables, rules, tutorials