Я установил 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**
Сохранить текущие правила, используя:
sudo iptables-save > /etc/iptables.conf
, а затем загрузить их: iptables-restore < /etc/iptables.conf
Вы можете поместить iptables-restore < /etc/iptables.conf в свой /etc/rc.local, чтобы автоматически загружать их при загрузке.
Сохранить текущие правила, используя:
sudo iptables-save > /etc/iptables.conf
, а затем загрузить их: iptables-restore < /etc/iptables.conf
Вы можете поместить iptables-restore < /etc/iptables.conf в свой /etc/rc.local, чтобы автоматически загружать их при загрузке.