1 iptables下载

iptables可以从该网站进行下载:

https://www.netfilter.org/projects/iptables/downloads.html

这里使用的linux内核为3.10版本的,iptables选择iptables-1.4.20

iptbales版本的选择一定要和linux版本的发布日期相近,如果差的太多,会导致编译不过

2 编译iptables

iptables的编译可以参照iptables目录下的INSTALL文件。

这边如下进行配置:

./configure --prefix=/home/lu/iptables --enable-static --disable-shared --with-ksource=/home/lu/tmp/linux-3.10 CC=arm-linux-gcc --host=arm AR=arm-linux-ar

然后:

make

make install即可。如果编译过程中出现如下错误:

error:asm/bitsperlong.h: No such file or directory

修改内核头文件:

linux-3.10/include/uapi/asm-generic/int-ll64.h

注释掉#include <asm/bitsperlong.h>

改为

#include<asm-generic/bitsperlong.h>即可编译通过

3 配置linux内核

General setup

    ------>Configure standard kernel features (expert users) 

       ---------->Sysctl syscall support

 

Networking support 

     ------------>Networking options

           -------------->Network packet filtering framework (Netfilter)

     把Netfilter相关的选项都选上,然后重新编译linux内核

4 安装并测试iptables

把ipatbles安装目录下bin目录和sbin目录下的可执行文件拷贝到嵌入式系统的bin和sbin目录下面。

进行简单测试一下,不报错则说明安装成功:

 

Logo

openvela 操作系统专为 AIoT 领域量身定制,以轻量化、标准兼容、安全性和高度可扩展性为核心特点。openvela 以其卓越的技术优势,已成为众多物联网设备和 AI 硬件的技术首选,涵盖了智能手表、运动手环、智能音箱、耳机、智能家居设备以及机器人等多个领域。

更多推荐