• «
  • 1
  • 2
  • »
  • Pages: 1/2     Go
主题 : IPTABLES 1.4.3.2移植成功 复制链接 | 浏览器收藏 | 打印
级别: 侠客
UID: 5728
精华: 1
发帖: 92
金钱: 785 两
威望: 572 点
贡献值: 1 点
综合积分: 204 分
注册时间: 2009-05-06
最后登录: 2017-09-13
楼主  发表于: 2009-06-02 18:32

 IPTABLES 1.4.3.2移植成功

我是新手,用开发板的都是用来做网络应用的,一直为没有防火墙而烦恼着。本来想偷懒,想直接用别人现成的,可一直没人给帮助,只好自己硬着头皮自己编译了。以下是我的编译过程,假定看客已经按手册学会了编译内核和使用交叉编译工具:
首先把内核文件解压,运行make menuconfig
Networking support --->
Networking options --->
Network packet filtering framework (Netfilter) -->
Core Netfilter configuration  --->
里面的选项很多,我也不搞清是什么了,全选为了built-in的了
然后退出保存,运行make zImage编译新的内核,并更新板上的内核。
下载 iptables-1.4.3.2.tar.bz2
解压 tar -jxcf iptables-1.4.3.2.tar.bz2
进入iptables-1.4.3.2目录运行./configure配置,生成Makefile文件,然后修改Makefile文件里的gcc为arm-linux-gcc
然后运行make KERNEL_DIR=/opt/FriendlyARM/mini2440/linux-2.6.29/kernel
再 make NO.SHARED_LIBS = 1 静态链接编译生成可执行文件
iptables 1.4.3.2版生成的可执行文件在 .libs目录下,把想要的可执行文件 iptables,iptables-save,iptables-restore拷贝到开发板上(我把它们放在/home/plg目录里了)
把libiptc.so.0和libxtables.so.2拷贝到开发板的/lib目录中去
把iptables 1.4.3.2的extensions目录下所有的so文件copy到/usr/local/libexec/xtables中去,开发板本身没有这个目录,可以用命令mkdir -p/usr/local/libexec/xtables 建立
运行iptables -L成功!
以为这就成功了,可是当加规则iptables -A INPUT -t tcp --dport 80 -j ACCEPT 时出错提示找不到libipt_standard.so文件,这下惨了,上网找了很久,没有办法解决~~~
终于看到一篇文章说iptables 1.4.3.2 用的是 libxt_standard.so这个文件,就试着把那个文件拷贝为libxt_standard.so文件 cp /usr/local/libexec/xtables/libxt_standard.so /usr/local/libexec/xtables/libipt_standard.so
再加规则iptables -A INPUT -t tcp --dport 80 -j ACCEPT,终于没出错提示了!
再测试对telnet端口23的开放,也成功了,至止,算是小成了吧,也不知道最后那一步硬改了名字会不会有什么问题,先不管它了,反正已经可以用iptables,连在公司的内网也不至上总是断网了(怀疑公司内有电脑中到处攻击)。

感谢这的版主那句“如果连这么基本的东西都做不了的话,最好还是不要玩开发板了,那是浪费你的时间。”让我学到东西了。

*無鈳取玳
级别: 论坛版主
UID: 27
精华: 12
发帖: 5398
金钱: 40120 两
威望: 17929 点
贡献值: 71 点
综合积分: 11036 分
注册时间: 2008-01-16
最后登录: 2014-11-22
1楼  发表于: 2009-06-02 20:46
呵呵,恭喜恭喜。继续努力,多给论坛的兄弟们贡献有用的经验啊
"If you have an apple and I have an apple and we exchange apples, then you and I will
still each have one apple. But if you have an idea and I have an idea and we exchange
these ideas, then each of us will have two ideas."
~~方法总比困难多~~
级别: 新手上路
UID: 3522
精华: 0
发帖: 47
金钱: 470 两
威望: 405 点
贡献值: 0 点
综合积分: 94 分
注册时间: 2009-01-15
最后登录: 2011-06-30
2楼  发表于: 2009-06-03 12:07
顶一个
*無鈳取玳
级别: 论坛版主
UID: 27
精华: 12
发帖: 5398
金钱: 40120 两
威望: 17929 点
贡献值: 71 点
综合积分: 11036 分
注册时间: 2008-01-16
最后登录: 2014-11-22
3楼  发表于: 2009-06-03 14:57
进入iptables-1.4.3.2目录运行./configure配置,生成Makefile文件,然后修改Makefile文件里的gcc为arm-linux-gcc

不要自己手动去该Makefile的变量,可以用./configure --host=arm-linux

然后运行make KERNEL_DIR=/opt/FriendlyARM/mini2440/linux-2.6.29/kernel
再 make NO.SHARED_LIBS = 1 静态链接编译生成可执行文件

为什么要自己去找那些Makefile的变量呢?多看看./configure --help的输出,可以用--with-kbuild和--dsiable-shared. 顺便说一句,不是NO.SHARED_LIBS而是NO_SHARED_LIBS。如果是用静态编译的话,你不会看到后面iptables需要加载libipt_standard.so。

把libiptc.so.0和libxtables.so.2拷贝到开发板的/lib目录中去
把iptables 1.4.3.2的extensions目录下所有的so文件copy到/usr/local/libexec/xtables中去,开发板本身没有这个目录,可以用命令mkdir -p/usr/local/libexec/xtables 建立

为啥不用make install来帮你干这种脏活累活呢?
"If you have an apple and I have an apple and we exchange apples, then you and I will
still each have one apple. But if you have an idea and I have an idea and we exchange
these ideas, then each of us will have two ideas."
级别: 新手上路
UID: 13793
精华: 0
发帖: 18
金钱: 110 两
威望: 22 点
贡献值: 0 点
综合积分: 36 分
注册时间: 2010-01-29
最后登录: 2010-04-16
4楼  发表于: 2010-02-09 12:54
为什么我的不能编译呢,如果我不把gcc改为arm-linux-gcc 没有问题,可是当我改了之后,却出现下面的问题,/bin/bash ./libtool --tag=CC   --mode=link arm-linux-gcc -D_LARGEFILE_SOURCE=1 -D_LARGE_FILES -D_FILE_OFFSET_BITS=64     -D_REENTRANT -Wall -Waggregate-return -Wmissing-declarations     -Wmissing-prototypes -Wredundant-decls -Wshadow -Wstrict-prototypes     -Winline -pipe     -DXTABLES_LIBDIR=\"/usr/local/libexec/xtables\" -DXTABLES_INTERNAL -I./include -I./include  -g -O2 -version-info 0:0:0  -o libiptc/libip4tc.la -rpath /usr/local/lib libiptc/libip4tc.lo  
libtool: link: gcc -shared  libiptc/.libs/libip4tc.o      -Wl,-soname -Wl,libip4tc.so.0 -o libiptc/.libs/libip4tc.so.0.0.0
/usr/bin/ld: libiptc/.libs/libip4tc.o: Relocations in generic ELF (EM: 40)
/usr/bin/ld: libiptc/.libs/libip4tc.o: Relocations in generic ELF (EM: 40)
/usr/bin/ld: libiptc/.libs/libip4tc.o: Relocations in generic ELF (EM: 40)
/usr/bin/ld: libiptc/.libs/libip4tc.o: Relocations in generic ELF (EM: 40)
/usr/bin/ld: libiptc/.libs/libip4tc.o: Relocations in generic ELF (EM: 40)
/usr/bin/ld: libiptc/.libs/libip4tc.o: Relocations in generic ELF (EM: 40)
/usr/bin/ld: libiptc/.libs/libip4tc.o: Relocations in generic ELF (EM: 40)
/usr/bin/ld: libiptc/.libs/libip4tc.o: Relocations in generic ELF (EM: 40)
libiptc/.libs/libip4tc.o: could not read symbols: File in wrong format
collect2: ld returned 1 exit status
make[2]: *** [libiptc/libip4tc.la] 错误 1
make[2]:正在离开目录 `/opt/iptables-1.4.6'
make[1]: *** [all-recursive] 错误 1
make[1]:正在离开目录 `/opt/iptables-1.4.6'
make: *** [all] 错误 2
请高手指点,我已经安装上了arm-linux-gcc,Makefile中有好几个gcc改几个?
QT 的布局怎么搞?
级别: 侠客
UID: 5575
精华: 0
发帖: 81
金钱: 485 两
威望: 193 点
贡献值: 0 点
综合积分: 162 分
注册时间: 2009-04-29
最后登录: 2013-12-02
5楼  发表于: 2010-02-23 12:00
感谢,学习了kasim对config的用法说明.
不要手动,要看configure --help
SBC2410+8' LCD
mini2440+NEt 3.5'
级别: 新手上路
UID: 8342
精华: 0
发帖: 28
金钱: 185 两
威望: 58 点
贡献值: 0 点
综合积分: 56 分
注册时间: 2009-08-19
最后登录: 2011-02-24
6楼  发表于: 2010-05-04 20:32

 回 1楼(997522323) 的帖子

我也碰到了和你相同的问题,请问你解决了没有?
天青色等烟雨
级别: 新手上路
UID: 8342
精华: 0
发帖: 28
金钱: 185 两
威望: 58 点
贡献值: 0 点
综合积分: 56 分
注册时间: 2009-08-19
最后登录: 2011-02-24
7楼  发表于: 2010-05-05 21:29
设置好交叉编译器,内核头文件,编译没什么问题
天青色等烟雨
*無鈳取玳
级别: 论坛版主
UID: 27
精华: 12
发帖: 5398
金钱: 40120 两
威望: 17929 点
贡献值: 71 点
综合积分: 11036 分
注册时间: 2008-01-16
最后登录: 2014-11-22
8楼  发表于: 2010-05-05 21:43

 回 7楼(斐鸟) 的帖子

呵呵,那你到底算是有问题还是没问题呢?
"If you have an apple and I have an apple and we exchange apples, then you and I will
still each have one apple. But if you have an idea and I have an idea and we exchange
these ideas, then each of us will have two ideas."
级别: 新手上路
UID: 8342
精华: 0
发帖: 28
金钱: 185 两
威望: 58 点
贡献值: 0 点
综合积分: 56 分
注册时间: 2009-08-19
最后登录: 2011-02-24
9楼  发表于: 2010-05-06 15:16

 回 8楼(kasim) 的帖子

刚开始的时候是碰到问题了,后来按照你说的设置了一些参数,问题解决啦,感谢版主
天青色等烟雨
  • «
  • 1
  • 2
  • »
  • Pages: 1/2     Go