Chinaunix

标题: 问个ipfw的用法 [打印本页]

作者: mehqy    时间: 2013-04-07 17:41
标题: 问个ipfw的用法
假如防火墙规则里面有这么两条:
00421 deny tcp from 18.202.67.157 to me dst-port 80 in
00421 deny tcp from 18.192.43.3 to me dst-port 80 in
两条的编号都一样,但是限制的IP不一样,我想删除第二条记录,求教语法是怎样写的?
作者: lsstarboy    时间: 2013-04-07 22:13
好像只能删除,然后再重建第一条。
多说一句:出现这种情况都是事先没做好规划,如果想限制多个IP,最好用table。
作者: mehqy    时间: 2013-04-08 15:44
请教写法或者举个例!!谢谢回复 2# lsstarboy


   
作者: lsstarboy    时间: 2013-04-08 19:20
ipfw add 421 deny ip from table(2) to me 80 in
ipfw table 2 add 18.202.67.157
ipfw table 2 add 2.3.4.5
ipfw table 2 add 3.4.5.6

删除:
ipfw table 2 delete 2.3.4.5

清空:
ipfw table 2 flush
作者: mehqy    时间: 2013-04-10 11:21
test_freebsd# ipfw add 421 deny ip from table(2) to me 80 in
Badly placed ()'s.
怎么不行呢??回复 4# lsstarboy


   
作者: lsstarboy    时间: 2013-04-10 13:39
大多数shell中,小括号要转义才能用,前面加个反斜杠。
作者: mehqy    时间: 2013-04-25 17:45
回复 6# lsstarboy


    谢谢,我用双引号也可以




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