Проблемы с iptables-постоянными, ну, сохраняются - Ubuntu 17.04

Я установил iptables-persistent в Ubuntu 17.04, чтобы сохранить новое правило, которое я добавил. Я зафиксировал изменение в /etc/iptables/rules.v4 - правило было добавлено с sudo iptables -I INPUT 7 -s 192.168.1.0/24 -i enp37s0 -j ACCEPT.

Когда я перезагружаюсь, правило очищается от iptables. Служба netfilter-persistent.service работает. Перезапуск решает проблему. Есть идеи?

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**
0
задан 21 November 2017 в 16:51

1 ответ

Сохраните текущие правила, используя:

sudo iptables-save > /etc/iptables.conf

, а затем загрузите их с помощью: iptables-restore < /etc/iptables.conf

Вы можете поместить iptables-restore < /etc/iptables.conf в свой /etc/rc.local для автоматической загрузки их при загрузке.

0
ответ дан 21 November 2017 в 16:51

Другие вопросы по тегам:

Похожие вопросы: