1、添加防火墙规则
格式:
npfruleadd [netifname] [rule] [input | output] [allow | deny] [args...]

eg:
    npfruleadd en1 mac input deny 11:22:33:44:55:66
    npfruleadd en1 ip input allow 192.168.0.5 192.168.0.10
    npfruleadd lo0 udp input deny 0.0.0.0 255.255.255.255 433 500
    npfruleadd wl2 tcp input deny 192.168.0.1 192.168.0.200 169 169

注意:ip与端口号均为范围

2、删除防火墙规则
格式:(rule sequence num 通过命令 npfs 查看)
npfruledel [netifname] [input | output] [rule sequence num]

eg:
    npfruledel en1 input 1

3、查看当前防火墙规则
格式:
npfs

4、使用防火墙关闭telnet端口(23)

npfruleadd en1 tcp input deny 192.168.0.1 192.168.0.255 23 23

Logo

腾讯云面向开发者汇聚海量精品云计算使用和开发经验,营造开放的云计算技术生态圈。

更多推荐