1

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
4

1 に答える 1

2

私が通常行うことはこれです:

  • sudo nano /etc/c.local
  • ファイルの最後、「exit 0」の直前に「iptables-restore < /etc/iptables.sav」を追加します。
于 2013-07-08T07:54:33.040 に答える