首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >iptables不使用iptables加载-还原

iptables不使用iptables加载-还原
EN

Server Fault用户
提问于 2017-02-20 10:56:22
回答 1查看 2.3K关注 0票数 1

我制作了以下iptables规则文件:

代码语言:javascript
复制
*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还原:第22行失败

我做错什么了吗?

编辑:

  • 我的linux版本是: linux44 4.4.48-1
  • 我的iptables版本是: iptables 1.6.0-1
  • Linux 4.41-1-Manjaro #1 SMP抢占Mon Jan 9 12:43:09 UTC 2017 i686 GNU/Linux

编辑2:经过多个测试后,ipt_state.ko.gzipt_comment.ko.gz模块似乎缺少在/lib/modules/4.4.48-1-MANJARO/kernel/net/ipv4/netfilter目录中。

有人知道如何添加这些模块吗?

EN

回答 1

Server Fault用户

回答已采纳

发布于 2017-02-23 10:28:41

好的,在这个论坛之后:https://bbs.archlinux.org/viewtopic.php?id=195108,我意识到我的内核最近从-41更新到-48,而模块发现是基于uname的(wich已经过时了),这就是为什么模块不能加载。一个简单的重新启动修复了所有问题:D

票数 2
EN
页面原文内容由Server Fault提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://serverfault.com/questions/833656

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档