本来想写一个完整的制作LINUX路由器的教程,苦于近期没有充裕的时间。同时为了广大网友能够早日的使用这个模块现把2.1版本源代码发上来
和1.0的改进:
1、修正了用于多网卡工作时的错误,现在可以支持任意数目的到ISP的链接,当然内网的也可以了。
2、修改了参数名称,以避免造成误解。
3、增加了随机IPID功能。
--ipid-pace [number] 设置每次增加的步调值,如果为0,则数据包的IPID字段应该为一个固定的值。但这不会影响到通讯的完整性。
--ipid-choatic 0 设置随机IPID。0仅仅是填充参数作用。
--help 调用参数帮助。
注:因为不能传.bz2的文件,下载后请更改扩展名为.bz2。及文件名称应该是:iptables-ipid-2.1.tar.bz2
[ 本帖最后由 ssffzz1 于 2007-9-14 08:51 编辑 ]
iptables-ipid-2.1.tar.tar
枫影谁用了 回复于:2007-09-14 08:45:24
下载呢?源码呢?
ssffzz1 回复于:2007-09-14 08:52:08
哈哈哈哈,刚才居然忘了加附件。
kevin.tan 回复于:2007-09-14 10:00:01
哇,so cool ,ssffzz1版真是厉害,佩服佩服!!!:em02: :em02: :em02:
mxbao 回复于:2007-09-14 10:14:22
希望看到你的路由器教程啊
现在对这个比较晕啊:em16:
ssffzz1 回复于:2007-09-14 11:06:04
其实现在的教程已经很多了。这个也只是个模块而已。
tingfengmanbu 回复于:2007-09-21 17:23:13
好佩服LZ。。。。。感觉你们好强了。。我还什么都不会呢:( :em11:
jiayong277 回复于:2007-09-27 19:40:14
:em14: 不好意思想问一下ipid是一个什么?
ssffzz1 回复于:2007-09-27 19:56:49
你可以搜索吗?
jiayong277 回复于:2007-09-27 20:02:20
:em09: 我是不知道这个模块在那个地方,我NO找得出来``
hongfengyue 回复于:2007-09-28 19:01:07
报告一个编译错误:
kernel: 2.6.16.27
编译出现警告:
make[1]: Entering directory `/usr/src/linux-2.6.16.27'
CC [M] /media/sources1/tools/network/firewall/iptables-ipid-2.1/ipt_IPID.o
/media/sources1/tools/network/firewall/iptables-ipid-2.1/ipt_IPID.c: 在函数 ‘ipt_ipid_target’ 中:
/media/sources1/tools/network/firewall/iptables-ipid-2.1/ipt_IPID.c:120: 警告:隐式声明函数 ‘skb_ip_make_writable’
/media/sources1/tools/network/firewall/iptables-ipid-2.1/ipt_IPID.c: 在顶层:
/media/sources1/tools/network/firewall/iptables-ipid-2.1/ipt_IPID.c:179: 警告:从不兼容的指针类型初始化
Building modules, stage 2.
MODPOST
*** Warning: "skb_ip_make_writable" [/media/sources1/tools/network/firewall/iptables-ipid-2.1/ipt_IPID.ko] undefined!
然后加载模块出现错误,不能加载:
ipt_IPID: Unknown symbol skb_ip_make_writable
谢谢!
ssffzz1 回复于:2007-09-29 08:17:45
给我你的编译过程。
hongfengyue 回复于:2007-09-29 13:18:51
1,下载你的文件。
2,解压缩文件。
3,进入软件目录。
4,在Makefile的34行后面添加了如下行:
IPTABLES_SRC = /media/sources/blfs/kernel/iptables-1.3.6
5,然后执行make输出:
make -C /lib/modules/2.6.16.27-klips-smb-new-Rev2-mppe-mppc-l7filter-nodebug/build SUBDIRS=/media/sources1/tools/network/firewall/iptables-ipid-2.1 modules
make[1]: Entering directory `/usr/src/linux-2.6.16.27'
CC [M] /media/sources1/tools/network/firewall/iptables-ipid-2.1/ipt_IPID.o
/media/sources1/tools/network/firewall/iptables-ipid-2.1/ipt_IPID.c: 在函数 ‘ipt_ipid_target’ 中:
/media/sources1/tools/network/firewall/iptables-ipid-2.1/ipt_IPID.c:120: 警告:隐式声明函数 ‘skb_ip_make_writable’
/media/sources1/tools/network/firewall/iptables-ipid-2.1/ipt_IPID.c: 在顶层:
/media/sources1/tools/network/firewall/iptables-ipid-2.1/ipt_IPID.c:179: 警告:从不兼容的指针类型初始化
Building modules, stage 2.
MODPOST
*** Warning: "skb_ip_make_writable" [/media/sources1/tools/network/firewall/iptables-ipid-2.1/ipt_IPID.ko] undefined!
CC /media/sources1/tools/network/firewall/iptables-ipid-2.1/ipt_IPID.mod.o
LD [M] /media/sources1/tools/network/firewall/iptables-ipid-2.1/ipt_IPID.ko
make[1]: Leaving directory `/usr/src/linux-2.6.16.27'
gcc -O3 -Wall -DIPTABLES_VERSION=\"1.3.6\" -I/media/sources/blfs/kernel/iptables-1.3.6/include -fPIC -c libipt_IPID.c
ld -shared -o libipt_IPID.so libipt_IPID.o
6,我将编译好的模块ipt_IPID.ko到/lib/modules下的相应目录后执行depmod -a
7,然后执行:modprobe ipt_IPID 命令输出:
FATAL: Error inserting ipt_IPID (/lib/modules/2.6.16.27-klips-smb-new-Rev2-mppe-mppc-l7filter-nodebug/kernel/drivers/net/ipv4/netfilter/ipt_IPID.ko): Unknown symbol in module, or unknown parameter (see dmesg)
8,执行dmesg回多出一行:
ipt_IPID: Unknown symbol skb_ip_make_writable
谢谢!
[ 本帖最后由 hongfengyue 于 2007-9-29 13:20 编辑 ]
ssffzz1 回复于:2007-09-29 13:38:30
1、我不明白你为什么要添加那一行。
2、这个需要内核的头文件(当然有一个正确的内核源代码也可以,但通常都是不正确的,也是没必要的)。
3、需要正确的IPTABLES原代码,这个需要和系统一致的rpmfind.net可以下载到相应的src的rpm包
hongfengyue 回复于:2007-09-29 14:35:22
引用:原帖由 ssffzz1 于 2007-9-29 13:38 发表 [url=http://linux.chinaunix.net/bbs/redirect.php?goto=findpost&pid=6404270&ptid=909127]
1、我不明白你为什么要添加那一行。
2、这个需要内核的头文件(当然有一个正确的内核源代码也可以,但通常都是不正确的,也是没必要的)。
3、需要正确的IPTABLES原代码,这个需要和系统一致的rpmfind.net可以 ...
回复:
1,加这一行
IPTABLES_SRC = /media/sources/blfs/kernel/iptables-1.3.6
是直接指向了iptables的源码目录。
2,我有内核的完整的头文件。
3,我对于1设置的行就是iptables的源码目录。
我初步怀疑这是内核版本不同造成的。我改天使用2.6的最新源码测试一下。
谢谢回复。
ssffzz1 回复于:2007-09-30 08:14:14
我不敢肯定你上面的做法一定是对的。我一般都是在/usr/src下做一个到iptables源码的软链接就可以了。
finth 回复于:2007-10-03 01:03:37
中文出错信息?
好东西收藏了,,,thinks
CUDev 回复于:2007-10-05 13:27:35
单单的修改IPID的话,应该是不能够突破网通的路由限制的。
核心代码:
if (!skb_ip_make_writable(pskb, (*pskb)->len))
return NF_DROP;
iph = (*pskb)->nh.iph;
id=get_id(out->name); //将网卡的名字转化为一个数字标识,方便区分不同网卡上的数据
switch(info->mode){
case IP_IPID_PACE:
new_ipid[id] += info->ipid;
break;
case IP_IPID_CHAOTIC:
default:
get_random_bytes(&(new_ipid[id]),sizeof(new_ipid[id]));
}
iph->id = htons(new_ipid[id]);
iph->check = 0;
iph->check = ip_fast_csum((char *)iph,iph->ihl); //重新计算数据包的校验和
ssffzz1 回复于:2007-10-06 19:28:12
我并没有说过100%的能够突破。
探测内网的电脑数目有多种方法。
目前能够100%的似乎只有跑UDP协议的OPENVPN
fuleru 回复于:2007-11-17 10:26:12
#modprobe ipt_IPID
FATAL: Error inserting ipt_IPID (/lib/modules/2.6.15.4.20071110at/ipt_IPID.ko): Unknown symbol in module, or unknown parameter (see dmesg)
dmesg的信息是:
ipt_IPID: Unknown symbol skb_ip_make_writable
是什么原因呢?
http://linux.chinaunix.net/bbs/thread-888274-8-1.html
[ 本帖最后由 fuleru 于 2007-11-17 22:51 编辑 ]
fuleru 回复于:2007-11-20 11:15:31
ssffzz1 帮我看看是什么原因呢?
搞了好些时间都没有搞好啊!
谢谢了!
[ 本帖最后由 fuleru 于 2007-11-20 18:22 编辑 ]
sxqw 回复于:2007-11-29 17:45:28
[root@www iptables-ipid-2.1]# make
Makefile:36: You need to install iptables sources and maybe set IPTABLES_SRC
make -C /lib/modules/2.6.22.9-61/build SUBDIRS=/root/iptables-ipid-2.1 modules
make[1]: Entering directory `/usr/src/kernels/2.6.22.9-61-i686'
CC [M] /root/iptables-ipid-2.1/ipt_IPID.o
/root/iptables-ipid-2.1/ipt_IPID.c: In function ‘ipt_ipid_target’:
/root/iptables-ipid-2.1/ipt_IPID.c:123: error: ‘struct sk_buff’ has no member named ‘nh’
/root/iptables-ipid-2.1/ipt_IPID.c: At top level:
/root/iptables-ipid-2.1/ipt_IPID.c:174: warning: initialization from incompatible pointer type
/root/iptables-ipid-2.1/ipt_IPID.c:179: warning: initialization from incompatible pointer type
/root/iptables-ipid-2.1/ipt_IPID.c: In function ‘init’:
/root/iptables-ipid-2.1/ipt_IPID.c:185: error: implicit declaration of function ‘ipt_register_target’
/root/iptables-ipid-2.1/ipt_IPID.c: In function ‘fini’:
/root/iptables-ipid-2.1/ipt_IPID.c:190: error: implicit declaration of function ‘ipt_unregister_target’
make[2]: *** [/root/iptables-ipid-2.1/ipt_IPID.o] Error 1
make[1]: *** [_module_/root/iptables-ipid-2.1] Error 2
make[1]: Leaving directory `/usr/src/kernels/2.6.22.9-61-i686'
make: *** [ipt_IPID.ko] Error 2
sxqw 回复于:2007-12-05 09:53:31
这个模块现在没人更新了吗?
jevel 回复于:2007-12-18 22:40:16
请问如何移植到嵌入式Linux中,如DD-WRT?OpenWRT?
这类系统多用在基于broadcom 的CPU的无线路由器设备上,如Linksys WRT54GL。
tournet 回复于:2008-02-25 09:43:54
请问楼主或有搞定的高手,如果连接电信的是ADSL,是否iptables针对PPP0写一条命令就行了,如下:
iptables -t mangle -A PREROUTING -o PPP0 -j IPID [color=Red]--ipid-inc[/color] 1
命令是否正确?
还是这个?
iptables -t mangle -A PREROUTING -o PPP0 -j IPID [color=Red]--ipid-pace[/color] 1
[ 本帖最后由 tournet 于 2008-2-25 10:12 编辑 ]
ssffzz1 回复于:2008-02-25 10:30:34
参数在1楼有。
你试试吧,这个模块现在可能破解不了封锁了。
sxqw 回复于:2008-04-26 15:01:49
请问楼主这个模块在 2.6.22 kernel 下如何通过编译?
13251947 回复于:2008-08-27 16:21:59
~/iptables-ipid-2.1# make
Makefile:36: You need to install iptables sources and maybe set IPTABLES_SRC
make -C /lib/modules/2.6.26-1-686/build SUBDIRS=/root/iptables-ipid-2.1 modules
make[1]: Entering directory `/usr/src/linux-headers-2.6.26-1-686'
CC [M] /root/iptables-ipid-2.1/ipt_IPID.o
/root/iptables-ipid-2.1/ipt_IPID.c: In function ‘ipt_ipid_target’:
/root/iptables-ipid-2.1/ipt_IPID.c:117: warning: passing argument 1 of ‘skb_make_writable’ from incompatible pointer type
/root/iptables-ipid-2.1/ipt_IPID.c:123: error: ‘struct sk_buff’ has no member named ‘nh’
/root/iptables-ipid-2.1/ipt_IPID.c: At top level:
/root/iptables-ipid-2.1/ipt_IPID.c:174: warning: initialization from incompatible pointer type
/root/iptables-ipid-2.1/ipt_IPID.c:179: warning: initialization from incompatible pointer type
/root/iptables-ipid-2.1/ipt_IPID.c: In function ‘init’:
/root/iptables-ipid-2.1/ipt_IPID.c:185: error: implicit declaration of function ‘ipt_register_target’
/root/iptables-ipid-2.1/ipt_IPID.c: In function ‘fini’:
/root/iptables-ipid-2.1/ipt_IPID.c:190: error: implicit declaration of function ‘ipt_unregister_target’
make[2]: *** [/root/iptables-ipid-2.1/ipt_IPID.o] Error 1
make[1]: *** [_module_/root/iptables-ipid-2.1] Error 2
make[1]: Leaving directory `/usr/src/linux-headers-2.6.26-1-686'
make: *** [ipt_IPID.ko] Error 2
|