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


    谢谢,我用双引号也可以
页: [1]
查看完整版本: 问个ipfw的用法