Chinaunix

标题: 请教iptables参数问题 [打印本页]

作者: hhzhaokun    时间: 2006-04-03 10:56
标题: 请教iptables参数问题
如下规则:
$iptables -A output -i eth0 -p tcp ! -y -s 192.168.0.0/24 \
          -d 0/0 1024-65535 -j ACCEPT


请老大帮忙看一下 ! -y参数是什么意思?谢谢
作者: race    时间: 2006-04-03 11:05
iptables没有-y这个功能吧?
作者: kenduest    时间: 2006-04-03 11:11
原帖由 hhzhaokun 于 2006-4-3 10:56 发表
如下规则:
$iptables -A output -i eth0 -p tcp ! -y -s 192.168.0.0/24 \
          -d 0/0 1024-65535 -j ACCEPT

请老大帮忙看一下 ! -y参数是什么意思?谢谢


语法一堆问题...

1. iptables 没有 -y 这个参数,这应该只有出现于 ipchains 那年代才有的参数。

2. 那个写法整个换成 ipchains 也不会过,dport 根本写错。


  1. $ man ipchains

  2. [!] -y, --syn

  3. Only match TCP packets with the SYN bit set and the ACK and FIN bits cleared.         Such packets are used to  request TCP  connection  initiation;  for example, blocking such  packets coming in an interface will prevent incoming TCP connections, but outgoing  TCP
  4. connections  will         be  unaffected.   This option is only meaningful when the protocol type  is set  to TCP.   If the "!" flag precedes the "-y", the sense of the option is inverted.

复制代码


若你系统有装甚至还是使用 ipchains 的话,请先看 manpage。

另外,iptables 的年代已经很少会使用 --syn 这种参数,因为有更好方式可以比对判断,像是:

  1. iptables -A INPUT -m state --state NEW -j ....
复制代码


要使用 iptables 的话,好好把 iptables 的 packet tracking 好好了解一下,不要使用 ipchains 观念来写 firewall rule。

==

[ 本帖最后由 kenduest 于 2006-4-3 11:14 编辑 ]
作者: hefish    时间: 2006-04-03 11:13
man里面好像没有-y
作者: hhzhaokun    时间: 2006-04-03 11:27
我是在Linux Red Hat Security and Optimization(红帽Linux安全与优化)这本书里看到的例子,里边没对这个参数做说明.




欢迎光临 Chinaunix (http://bbs.chinaunix.net/) Powered by Discuz! X3.2