iptables v1.8.3(legacy): Couldn‘t load match `comment‘:No such file or directory.

7 篇文章 0 订阅
2 篇文章 0 订阅

项目场景:

DEVICE: RK3399
KERNEL: Linux 4.4.189
OS: Ubuntu 18.04.6


 

问题描述

 
在这里插入图片描述
业务应用开发人员反馈在使用开源框架时,iptables产生了如上错误。


 

原因分析:

 
iptables 命令运行报错,初步分析是由于该环境下的iptalbes不支持comment,而该程序中调用了i-m comment --comment,所以产生了报错。


 

解决方案:

 
方案一、不使用comment,即在使用iptables时删除掉-m comment --comment,不建议。

方案二、修改内核配置支持iptables comment

  1. 修改内核配置,设置CONFIG_NETFILTER_XT_MATCH_COMMENT=m
  2. 编译内核modules,在kernel/net/netfilter下得到xt_comment.ko
  3. 上传xt_comment.ko到目标环境,insmod xt_comment.ko,此问题解决。

注:CONFIG_NETFILTER_XT_MATCH_COMMENT依赖下面红色标记的内核选项
Symbol: NETFILTER_XT_MATCH_COMMENT [=n] │
│ Type : tristate │
│ Prompt: “comment” match support │
│ Location: │
│ -> Networking support (NET [=y]) │
│ -> Networking options │
│ -> Network packet filtering framework (Netfilter) (NETFILTER [=y]) │
│ -> Core Netfilter Configuration │
│ (1) -> Netfilter Xtables support (required for ip_tables) (NETFILTER_XTABLES [=y]) │
│ Defined at net/netfilter/Kconfig:1003 │
│ Depends on: NET [=y] && INET [=y] && NETFILTER [=y] && NETFILTER_XTABLES [=y] && NETFILTER_ADVANCED [=y]


 

参考链接

https://cateee.net/lkddb/web-lkddb/NETFILTER_XT_MATCH_COMMENT.html
https://github.com/garywill/linux-router/issues/18

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值