ubuntu18防火墙相关操作

1.安装防火墙

 apt-get install ufw 

2.启用防火墙

 ufw enable 

3.禁用防火墙

 ufw disable  

4.查看防火墙状态

 ufw status 

5.允许外部访问80端口

 ufw allow 80 

6.删除添加的规则

 ufw delete allow 80 

7.允许此ip访问本机所有端口

 ufw allow from 192.168.0.105 

8.禁止端口通过

 uwf deny 服务(端口)

9.查看端口状态

 lsof -i:端口号  

推荐设置

apt-get install ufw
ufw enable
ufw default deny 

#如有特殊需要,开启相应服务
ufw allow 端口  

猜你喜欢

转载自www.cnblogs.com/dch0/p/12695922.html