• 51272

    文章

  • 499

    评论

  • 40

    友链

  • 最近新加了换肤功能,大家多来逛逛吧~~~~
  • 喜欢这个网站的朋友可以加一下QQ群,我们一起交流技术。

Ubuntu关闭防火墙的方法(ufw/iptables)

695856371Web网页设计师②群 | 172816590(满)Web网页设计师①群, 喜欢本站的朋友可以收藏本站,或者加入我们大家一起来交流技术!

欢迎来到梁钟霖个人博客网站。本个人博客网站提供最新的站长新闻,各种互联网资讯。 还提供个人博客模板,最新最全的java教程,java面试题。在此我将尽我最大所能将此个人博客网站做的最好! 谢谢大家,愿大家一起进步!

How do I disable the firewall in Ubuntu Linux server edition? How do I turn off the firewall in Ubuntu Linux version 12.04 or 14.04 LTS server?
The latest version of Ubuntu comes with a program called ufw. It is used for managing a Linux firewall and aims to provide an easy to use interface for the user.

 

A Note About ufw

As I said earlier, the latest version of Ubuntu comes with ufw (now it is the default firewall configuration tool for Ubuntu). It is developed to ease iptables firewall configuration, ufw provides a user friendly way to create an IPv4 or IPv6 host-based firewall.

 

List ufw firewall rules, enter:

$ sudo ufw status verbose
Sample outputs:

Status: active
Logging: on (low)
Default: deny (incoming), allow (outgoing), deny (routed)
New profiles: skip
 
To                         Action      From
--                         ------      ----
71.81.22.14 80/tcp        ALLOW IN    Anywhere
71.81.22.15 80/tcp        ALLOW IN    Anywhere

To disable ufw based firewall, enter:

$ sudo ufw disable

 

List current firewall rules and stop firewall (old method)

You can type the following command to see if firewall is active or not (open a terminal or ssh session and type the following command):
$ sudo iptables -L -n
Sample outputs:

Chain INPUT (policy ACCEPT)
target     prot opt source               destination         
ACCEPT     udp  --  0.0.0.0/0            0.0.0.0/0           udp dpt:53 
ACCEPT     tcp  --  0.0.0.0/0            0.0.0.0/0           tcp dpt:53 
ACCEPT     udp  --  0.0.0.0/0            0.0.0.0/0           udp dpt:67 
ACCEPT     tcp  --  0.0.0.0/0            0.0.0.0/0           tcp dpt:67 
 
Chain FORWARD (policy ACCEPT)
target     prot opt source               destination         
ACCEPT     all  --  0.0.0.0/0            192.168.122.0/24    state RELATED,ESTABLISHED 
ACCEPT     all  --  192.168.122.0/24     0.0.0.0/0           
ACCEPT     all  --  0.0.0.0/0            0.0.0.0/0           
REJECT     all  --  0.0.0.0/0            0.0.0.0/0           reject-with icmp-port-unreachable 
REJECT     all  --  0.0.0.0/0            0.0.0.0/0           reject-with icmp-port-unreachable 
 
Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination

You can save existing firewall rules as follows:
$ sudo iptables-save > firewall.rules
Finally, type the following commands to stop firewall and flush all the rules:
$ sudo iptables -X
$ sudo iptables -t nat -F
$ sudo iptables -t nat -X
$ sudo iptables -t mangle -F
$ sudo iptables -t mangle -X
$ sudo iptables -P INPUT ACCEPT
$ sudo iptables -P FORWARD ACCEPT
$ sudo iptables -P OUTPUT ACCEPT

 

A note about GUI tools for Ubuntu desktop systems

You can also use GUI tool to enable or disable Firewall under Ubuntu Linux desktop edition by visiting System > Administration > Firewall configuration option:

Fig.01: Disabling Firewall In Ubuntu Linux

Fig.01: Disabling Firewall In Ubuntu Linux

Simply unselect “Enabled” option to turn off the firewall.

 

 



转载原创文章请注明出处,转载至: 梁钟霖个人博客www.liangzl.com

您觉喜欢本网站,或者觉得本文章对您有帮助,那么可以选择打赏。
打赏多少,您高兴就行,谢谢您对梁钟霖这小子的支持! ~(@^_^@)~

  • 微信扫一扫

  • 支付宝扫一扫

    支付宝打赏

0条评论

Loading...


发表评论

电子邮件地址不会被公开。 必填项已用*标注

自定义皮肤
注册梁钟霖个人博客