免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
楼主: platinum
打印 上一主题 下一主题

netfilter module - domain v0.0.2 发布 [复制链接]

论坛徽章:
0
31 [报告]
发表于 2006-09-19 10:00 |只看该作者
网关上iptables -L的输入:

Chain INPUT (policy DROP)
target     prot opt source               destination
ACCEPT     all  --  192.168.100.0/23     anywhere
ACCEPT     all  --  proxym               anywhere
ACCEPT     all  --  192.168.100.4        anywhere
ACCEPT     all  --  61.237.*.*       anywhere
ACCEPT     udp  --  anywhere             anywhere            udp spt:bootpc dpt:bootps
ACCEPT     all  --  anywhere             61.237.*.*     state RELATED,ESTABLISHED
tcp_packets  tcp  --  anywhere             anywhere
udp_packets  udp  --  anywhere             anywhere
icmp_packets  icmp --  anywhere             anywhere
ACCEPT     tcp  --  anywhere             anywhere            tcp dpt:22222
ACCEPT     udp  --  192.168.100.0/23     192.168.100.1       udp dpt:domain

Chain FORWARD (policy DROP)
target     prot opt source               destination
REJECT     tcp  --  anywhere             anywhere            #conn/32 > 80 reject-with icmp-port-unreachable
bad_tcp_packets  tcp  --  anywhere             anywhere
ACCEPT     all  --  anywhere             anywhere
ACCEPT     all  --  anywhere             anywhere            state RELATED,ESTABLISHED
DROP       all  --  anywhere             anywhere            domain --name "btchina.net"

Chain OUTPUT (policy DROP)
target     prot opt source               destination
bad_tcp_packets  tcp  --  anywhere             anywhere
ACCEPT     all  --  proxym               anywhere
ACCEPT     all  --  192.168.100.4        anywhere
ACCEPT     all  --  61.237.*.*       anywhere

Chain allowed (4 references)
target     prot opt source               destination
ACCEPT     tcp  --  anywhere             anywhere            tcp flags:FIN,SYN,RST,ACK/SYN
ACCEPT     tcp  --  anywhere             anywhere            state RELATED,ESTABLISHED
DROP       tcp  --  anywhere             anywhere

Chain bad_tcp_packets (2 references)
target     prot opt source               destination
REJECT     tcp  --  anywhere             anywhere            tcp flags:SYN,ACK/SYN,ACK state NEW reject-with tcp-reset
DROP       tcp  --  anywhere             anywhere            tcp flags:!FIN,SYN,RST,ACK/SYN state NEW

Chain icmp_packets (1 references)
target     prot opt source               destination
ACCEPT     icmp --  anywhere             anywhere            icmp echo-request
ACCEPT     icmp --  anywhere             anywhere            icmp time-exceeded

Chain tcp_packets (1 references)
target     prot opt source               destination
allowed    tcp  --  anywhere             anywhere            tcp dpt:ftp
allowed    tcp  --  anywhere             anywhere            tcp dpt:ssh
allowed    tcp  --  anywhere             anywhere            tcp dpt:http
allowed    tcp  --  anywhere             anywhere            tcp dpt:auth

Chain udp_packets (1 references)
target     prot opt source               destination
ACCEPT     udp  --  anywhere             anywhere            udp dpt:domain

论坛徽章:
0
32 [报告]
发表于 2006-09-19 10:09 |只看该作者
Chain FORWARD (policy DROP)
target     prot opt source               destination
REJECT     tcp  --  anywhere             anywhere            #conn/32 > 80 reject-with icmp-port-unreachable
bad_tcp_packets  tcp  --  anywhere             anywhere
ACCEPT     all  --  anywhere             anywhere
ACCEPT     all  --  anywhere             anywhere            state RELATED,ESTABLISHED
DROP       all  --  anywhere             anywhere            domain --name "btchina.net"

逻辑问题,或者你没贴详细
贴 iptables-save 的结果看一下

论坛徽章:
0
33 [报告]
发表于 2006-09-19 10:12 |只看该作者
*filter
:INPUT DROP [1307019:85804328]
:FORWARD DROP [0:0]
:OUTPUT DROP [132:5280]
:allowed - [0:0]
:bad_tcp_packets - [0:0]
:icmp_packets - [0:0]
:tcp_packets - [0:0]
:udp_packets - [0:0]
-A INPUT -s 192.168.100.0/255.255.254.0 -i eth1 -j ACCEPT
-A INPUT -s 127.0.0.1 -i lo -j ACCEPT
-A INPUT -s 192.168.100.4 -i lo -j ACCEPT
-A INPUT -s 211.*.*.* -i lo -j ACCEPT
-A INPUT -i eth1 -p udp -m udp --sport 68 --dport 67 -j ACCEPT
-A INPUT -d 211.*.*.* -m state --state RELATED,ESTABLISHED -j ACCEPT
-A INPUT -i eth0 -p tcp -j tcp_packets
-A INPUT -i eth0 -p udp -j udp_packets
-A INPUT -i eth0 -p icmp -j icmp_packets
-A FORWARD -p tcp -m connlimit --connlimit-above 100 --connlimit-mask 32 -j REJECT --reject-with icmp-port-unreachable
-A FORWARD -p tcp -j bad_tcp_packets
-A FORWARD -i eth1 -j ACCEPT
-A FORWARD -m state --state RELATED,ESTABLISHED -j ACCEPT
-A FORWARD -m domain --name "btchina.net" -j DROP
-A OUTPUT -p tcp -j bad_tcp_packets
-A OUTPUT -s 127.0.0.1 -j ACCEPT
-A OUTPUT -s 192.168.100.4 -j ACCEPT
-A OUTPUT -s *.*.*.*-j ACCEPT
-A allowed -p tcp -m tcp --tcp-flags FIN,SYN,RST,ACK SYN -j ACCEPT
-A allowed -p tcp -m state --state RELATED,ESTABLISHED -j ACCEPT
-A allowed -p tcp -j DROP
-A bad_tcp_packets -p tcp -m tcp --tcp-flags SYN,ACK SYN,ACK -m state --state NEW -j REJECT --reject-with tcp-reset
-A bad_tcp_packets -p tcp -m tcp ! --tcp-flags FIN,SYN,RST,ACK SYN -m state --state NEW -j DROP
-A icmp_packets -p icmp -m icmp --icmp-type 8 -j ACCEPT
-A icmp_packets -p icmp -m icmp --icmp-type 11 -j ACCEPT
-A tcp_packets -p tcp -m tcp --dport 21 -j allowed
-A tcp_packets -p tcp -m tcp --dport 22 -j allowed
-A tcp_packets -p tcp -m tcp --dport 80 -j allowed
-A tcp_packets -p tcp -m tcp --dport 113 -j allowed
-A udp_packets -p udp -m udp --dport 53 -j ACCEPT
COMMIT

论坛徽章:
0
34 [报告]
发表于 2006-09-19 10:18 |只看该作者
典型的逻辑顺序问题!
iptables -I FORWARD -m domain --name "btchina.net" -j DROP

论坛徽章:
0
35 [报告]
发表于 2006-09-19 10:31 |只看该作者
platinum ,你看看第33楼的iptables-save 结果,现在是内网用户无法ping 192.168.100.1这个网关,在网关上也无法ping 内网的用户。显示ping: sendmsg: Operation not permitted
看看怎么回事

论坛徽章:
0
36 [报告]
发表于 2006-09-19 10:41 |只看该作者
原帖由 lihn 于 2006-9-19 10:31 发表
platinum ,你看看第33楼的iptables-save 结果,现在是内网用户无法ping 192.168.100.1这个网关,在网关上也无法ping 内网的用户。显示ping: sendmsg: Operation not permitted
看看怎么回事

你现在说的和你刚才问的是两码事
-A FORWARD -p tcp -j bad_tcp_packets
-A FORWARD -i eth1 -j ACCEPT
-A FORWARD -m state --state RELATED,ESTABLISHED -j ACCEPT
-A FORWARD -m domain --name "btchina.net" -j DROP

你让我看 33 楼的规则,我看了,还是逻辑问题
你说的无法 ping 网关我没具体分析原因是什么,但可以肯定的是和那个 iptables 模块无关

论坛徽章:
0
37 [报告]
发表于 2006-09-19 11:36 |只看该作者
我的系统是Redhat AS4.0按都按不上
platinum
我应该 怎么做啊?
我不懂怎么去编译内核,您是在什么系统上测试成功的?

我是不是应该换个和您同样的系统
我只有as4.0 和redhat9.0这两个系统!!!

论坛徽章:
0
38 [报告]
发表于 2006-09-19 11:39 |只看该作者
原帖由 lovegqin 于 2006-9-19 11:36 发表
我的系统是Redhat AS4.0按都按不上
platinum
我应该 怎么做啊?
我不懂怎么去编译内核,您是在什么系统上测试成功的?

我是不是应该换个和您同样的系统
我只有as4.0 和redhat9.0这两个系统!!!

其实我在 23 楼就已经给过你答案了
也许我表达能力不好,但我真的不知道该如何教会你了,因为你没有接触过编译内核的知识,这个工作对你来说可能难了点

论坛徽章:
0
39 [报告]
发表于 2006-09-19 12:50 |只看该作者

痛苦ing !!!

论坛徽章:
0
40 [报告]
发表于 2006-09-21 14:43 |只看该作者
在2.6.16.18内核下面无法编译,错误信息如下:


  1. root@muddyboot /tmp/domain-0.0.2\>make KERNEL_SRC=/usr/src/linux IPTABLES_SRC=/usr/src/iptables-1.3.5
  2. make -C /usr/src/linux SUBDIRS=/tmp/domain-0.0.2 modules
  3. make[1]: Entering directory `/usr/src/linux-2.6.16.18'
  4.   CC [M]  /tmp/domain-0.0.2/ipt_domain.o
  5. /tmp/domain-0.0.2/ipt_domain.c: In function `match':
  6. /tmp/domain-0.0.2/ipt_domain.c:32: error: dereferencing pointer to incomplete type
  7. /tmp/domain-0.0.2/ipt_domain.c:32: error: dereferencing pointer to incomplete type
  8. /tmp/domain-0.0.2/ipt_domain.c:32: error: dereferencing pointer to incomplete type
  9. /tmp/domain-0.0.2/ipt_domain.c:32: error: dereferencing pointer to incomplete type
  10. /tmp/domain-0.0.2/ipt_domain.c:32: error: dereferencing pointer to incomplete type
  11. /tmp/domain-0.0.2/ipt_domain.c:32: error: dereferencing pointer to incomplete type
  12. /tmp/domain-0.0.2/ipt_domain.c:33: error: dereferencing pointer to incomplete type
  13. /tmp/domain-0.0.2/ipt_domain.c:35: error: dereferencing pointer to incomplete type
  14. /tmp/domain-0.0.2/ipt_domain.c:35: error: dereferencing pointer to incomplete type
  15. /tmp/domain-0.0.2/ipt_domain.c:35: error: dereferencing pointer to incomplete type
  16. /tmp/domain-0.0.2/ipt_domain.c: At top level:
  17. /tmp/domain-0.0.2/ipt_domain.c:64: warning: initialization from incompatible pointer type
  18. /tmp/domain-0.0.2/ipt_domain.c:65: warning: initialization from incompatible pointer type
  19. make[2]: *** [/tmp/domain-0.0.2/ipt_domain.o] 错误 1
  20. make[1]: *** [_module_/tmp/domain-0.0.2] 错误 2
  21. make[1]: Leaving directory `/usr/src/linux-2.6.16.18'
  22. make: *** [ipt_domain.ko] 错误 2
复制代码
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP