Ubuntu16.04自带防火墙ufw用法

共561个字

ufw命令的示例用法:

ufw status # 查看ufw防火墙是否在工作,查看使用中的规则

ufw enable # 启动ufw防火墙

ufw default deny # 启动默认防御(阻止外部联接,放行对外联接)

ufw allow 53 # 允许其它主机访问本机53端口,协议包含tcp和udp

ufw allow 25/tcp # 允许其它主机使用tcp协议访问本机25端口

ufw allow smtp # UFW也可以检查 /etc/services文件,明白服务的名字及对应的端口和协议

# UFW同时支持出入口过滤。用户可以使用in或out来指定向内还是向外。如果未指定,默认是inufw allow in http # 许可访问本机http端口

ufw reject out smtp # 禁止访问外部smtp端口,不告知“被防火墙阻止”

ufw deny out to 192.168.1.1 # 禁止本机192.168.1.1对外访问,告知“被防火墙阻止”

ufw delete deny 80/tcp # 要删除规则,只要在命令中加入delete就行了

实例:

1.设置允许访问 SSH
sudo ufw allow 22/tcp

2.设置允许访问 http
sudo ufw allow 80/tcp

3.设置允许访问 https
sudo ufw allow 443/tcp

4.设置允许访问 pptp
sudo ufw allow 1723/tcp

❤ 喜欢 920

3条回应:“Ubuntu16.04自带防火墙ufw用法”

  1. gamefly说道:

    My brother recommended I might like this web site.
    He was entirely right. This post truly made my day.

    You can not imagine simply how much time I had spent for this info!
    Thanks!

  2. whoah this weblog is excellent i like studying your articles.
    Stay up the great work! You already know, a lot of people
    are searching around for this info, you can help them greatly.

  3. Your style is really unique in comparison to other people
    I’ve read stuff from. I appreciate you for posting when you’ve got the opportunity, Guess I will just bookmark this page.

发表评论

必填项已用*标注

归档于 Ubuntu