Question

First of all, once I am logged in I can load the rules manually just fine, by typing

sudo iptables-restore < /etc/iptables.new

And the rule then appears on

sudo iptables -L

But I can't make it load automatically no matter what. In /etc/network/interfaces I have this:

auto eth0 inet dhcp
adress 192.168.56.101
netmask 255.255.255.0
pre-up iptables-restore < /etc/iptables.new

Rules in iptables.new are:

Generated By iptables-save v1.4.12 on Sun Jul 7 15:28:14 2013
*filter
:INPUT ACCEPT [4:824]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
-A INPUT -p tcp -m tcp --dport 22 -j ACCEPT
COMMIT
# Completed on Sun Jul 7 7 15:28:14 2013
Was it helpful?

Solution

What I usually do is this:

  • sudo nano /etc/c.local
  • Add "iptables-restore < /etc/iptables.sav" at the end of the file, just BEFORE the "exit 0"
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top