Problemas ao obter o iptables-persistent para, bem, persistir - Ubuntu 17.04

0

Instalei o iptables-persistent no Ubuntu 17.04, para preservar a nova regra que adicionei. Confirmei a alteração para /etc/iptables/rules.v4 - a regra foi adicionada com sudo iptables -I INPUT 7 -s 192.168.1.0/24 -i enp37s0 -j ACCEPT .

Quando eu reinicio, a regra é removida do iptables. O serviço netfilter-persistent.service parece estar em execução. Reiniciar resolve o problema. Alguma idéia?

adam@numbersix:~$ sudo iptables -L INPUT
Chain INPUT (policy ACCEPT)
target     prot opt source               destination
ACCEPT     udp  --  anywhere             anywhere             udp dpt:domain
ACCEPT     tcp  --  anywhere             anywhere             tcp dpt:domain
ACCEPT     udp  --  anywhere             anywhere             udp dpt:bootps
ACCEPT     tcp  --  anywhere             anywhere             tcp dpt:bootps
ACCEPT     all  --  anywhere             anywhere             ctstate RELATED,ESTABLISHED
ACCEPT     all  --  anywhere             anywhere
INPUT_direct  all  --  anywhere             anywhere
INPUT_ZONES_SOURCE  all  --  anywhere             anywhere
INPUT_ZONES  all  --  anywhere             anywhere
DROP       all  --  anywhere             anywhere             ctstate INVALID
REJECT     all  --  anywhere             anywhere             reject-with icmp-host-prohibited
adam@numbersix:~$ sudo systemctl |grep netfilter
  netfilter-persistent.service        loaded active exited    netfilter persistent configuration
adam@numbersix:~$ sudo systemctl restart netfilter-persistent.service
adam@numbersix:~$ sudo systemctl |grep netfilter
  netfilter-persistent.service        loaded active exited    netfilter persistent configuration
adam@numbersix:~$ sudo iptables -L INPUT
Chain INPUT (policy ACCEPT)
target     prot opt source               destination
ACCEPT     udp  --  anywhere             anywhere             udp dpt:domain
ACCEPT     tcp  --  anywhere             anywhere             tcp dpt:domain
ACCEPT     udp  --  anywhere             anywhere             udp dpt:bootps
ACCEPT     tcp  --  anywhere             anywhere             tcp dpt:bootps
ACCEPT     all  --  anywhere             anywhere             ctstate RELATED,ESTABLISHED
ACCEPT     all  --  anywhere             anywhere
ACCEPT     all  --  192.168.1.0/24       anywhere
INPUT_direct  all  --  anywhere             anywhere
INPUT_ZONES_SOURCE  all  --  anywhere             anywhere
INPUT_ZONES  all  --  anywhere             anywhere
DROP       all  --  anywhere             anywhere             ctstate INVALID
REJECT     all  --  anywhere             anywhere             reject-with icmp-host-prohibited**
    
por Adam-the-Kiwi 21.11.2017 / 13:54

1 resposta

0

Salvar as regras atuais usando:

sudo iptables-save > /etc/iptables.conf

e, em seguida, carregue-os por:   iptables-restore < /etc/iptables.conf

Você pode colocar iptables-restore < /etc/iptables.conf no seu /etc/rc.local para carregá-los automaticamente na inicialização.

    
por AsenM 21.11.2017 / 15:39