Назад | Перейти на главную страницу

iptables не загружается с помощью iptables-restore

Я создал следующий файл правил iptables:

*filter
:INPUT DROP [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
:sshguard - [0:0]

-A INPUT -i enp3s0 -p tcp --dport 22 -m state --state NEW,ESTABLISHED -j ACCEPT -m comment --comment "Allow incoming SSH"
-A INPUT -i enp3s0 -p tcp --sport 22 -m state --state ESTABLISHED -j ACCEPT -m comment --comment "Allow outgoing SSH"
-A INPUT -i enp3s0 -p tcp --dport 80 -m state --state NEW,ESTABLISHED -j ACCEPT -m comment --comment "Allow incoming HTTP"
-A INPUT -i enp3s0 -p tcp --dport 443 -m state --state NEW,ESTABLISHED -j ACCEPT -m comment --comment "Allow incoming HTTPS"
-A INPUT -i enp3s0 -p tcp --sport 80 -m state --state ESTABLISHED -j ACCEPT -m comment --comment "Allow outgoing HTTP"
-A INPUT -i enp3s0 -p tcp --sport 443 -m state --state ESTABLISHED -j ACCEPT -m comment --comment "Allow outgoing HTTPS"
-A INPUT -i enp3s0 -p udp --sport 53 -j ACCEPT -m comment --comment "Allow outgoing DNS"

-A INPUT -i lo -j ACCEPT -m comment --comment "Allow ALL from localhost"

-A INPUT -p icmp --icmp-type echo-request -j ACCEPT -m comment --comment "Allow incoming ping"
-A INPUT -p icmp --icmp-type echo-reply -j ACCEPT -m comment --comment "Allow outgoing ping"
-A INPUT -p tcp --dport 80 -m limit --limit 25/minute --limit-burst 100 -j ACCEPT -m comment --comment "Prevent DoS attacks"
-A INPUT -p tcp --dport 443 -m limit --limit 25/minute --limit-burst 100 -j ACCEPT -m comment --comment "Prevent DoS attacks"
-A INPUT -p tcp -m tcp --dport 22 -j sshguard -m comment --comment "SSH access protection"
COMMIT

Но когда я пытаюсь загрузить его iptables-restore < iptables.rules, у меня такая ошибка:

iptables-restore: сбой в строке 22

Я сделал что-то не так?

РЕДАКТИРОВАТЬ :

РЕДАКТИРОВАТЬ 2: После нескольких тестов выяснилось, что ipt_state.ko.gz и ipt_comment.ko.gz модули отсутствуют в каталоге /lib/modules/4.4.48-1-MANJARO/kernel/net/ipv4/netfilter

Кто-нибудь знает, как эти модули добавить?

Хорошо, подписывайтесь на этот форум: https://bbs.archlinux.org/viewtopic.php?id=195108, Я понял, что мое ядро ​​было недавно обновлено с -41 до -48, и обнаружение модуля основано на uname (которое устарело), ​​поэтому модули не могут загружаться. Простая перезагрузка устранила все проблемы: D