Disable and enable firewall in Ubuntu

Source: Internet
Author: User
Disable and enable firewall in Ubuntu
1. Ubuntu uses the UFW firewall by default and supports interface operations. 
Run the UFW command on the command line to see a series of operations that can be performed. Enable
<span style="white-space:pre"></span><span style="color:#ff0000;">sudo ufw enable<span style="white-space:pre"></span>sudo ufw default deny</span>
After running the preceding two commands, the firewall is enabled and automatically enabled when the system starts. Disable all external access to the local machine, but the local access to the external is normal.
2. enable/disable
sudo ufw allow|deny [service]
 
 
Open or close a port, for example:
 
 
Sudo UFW allow SMTP allows all external IP addresses to access the local port 25/tcp (SMTP ).
Sudo UFW allow 22/tcp allows all external IP addresses to access the local port 22/tcp (SSH)
Sudo UFW allow 53 allows external access to port 53 (TCP/UDP)
Sudo UFW allow from 192.168.1.100 allows this IP address to access all local ports
sudo ufw allow proto udp 192.168.0.1 port 53 to 192.168.0.2 port 53
Sudo UFW deny SMTP prohibit external access to the SMTP service
Sudo UFW Delete allow SMTP delete a rule created above

Disable and enable firewall in Ubuntu

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.