Ubuntu default firewall install, enable, view status

Source: Internet
Author: User
Tags iptables

Ubuntu9. 10 The default is the UFW firewall, which already supports the interface operation. Run the UFW command at the command line to see a list of possible actions for the prompt. One of the simplest operations:sudoUFW Status checks the state of the firewall and my return is: inactivesudoUFW version Firewall versions: UFW0.29-4UBUNTU1 Copyright -- theCanonical Ltd.ubuntu system is installed by default UFW.1. InstallationsudoApt-getInstallUFW2. EnablesudoUFW EnablesudoUFW Default deny runs the above two commands, the firewall is turned on and is turned on automatically when the system starts. All external access to the native is turned off, but the native access is normal externally. 3OpenDisabledsudoUFW allow|deny [service] turns a port on or off, for example:sudoUFW allow SMTP allows all external IPs to access the native 25/TCP (SMTP) portsudoUFW allow A/TCP allows all external IPs to access the native 22/TCP (SSH) PortsudoUFW allow -Allow external access to port 53 (tcp/UDP)sudoUFW allow from192.168.1.100allow this IP to access all native portssudoUFW allow Proto UDP192.168.0.1Port -To192.168.0.2Port -sudoUFW deny SMTP disables external access to the SMTP servicesudoUFW Delete Allow SMTP to delete a rule established above4. View firewall StatussudoUFW Status General user, just the following settings:sudoApt-getInstallUFWsudoUFW EnablesudoUFW default deny above three commands are safe enough, if you need to open certain services, then use sudo ufw allow to open. Open/Turn off the firewall (the default setting is ' Disable ')sudoUFW enable|Disable conversion log statussudoUFW Logging on|off set default policy (e.g. "mostly open" vs "mostly closed")sudoUFW default allow|deny license or shielded port (you can view the list of services in "status"). A protocol: Port can be used to specify a form that exists in theThe service name in/etc/services can also be passed through the meta-data of the package. The ' Allow ' parameter will add the entry to/etc/ufw/maps, and ' deny ' is the opposite. The basic syntax is as follows:sudoUFW allow|deny [service] shows the listening state of the firewall and port, see/var/lib/ufw/maps. The numbers in parentheses will not be displayed. sudoUFW STATUSUFW Use example: Allow -Port $sudoUFW allow -Disabled -Port $sudoUFW Delete Allow -Allow thePort $sudoUFW allow the/TCP Disable thePort $sudoUFW Delete Allow the/TCP allows SMTP port $sudoUFW allow SMTP to delete the SMTP port license $sudoUFW Delete Allow SMTP allows a specific ip$sudoUFW allow from192.168.254.254Delete the above rule $sudoUFW Delete allow from192.168.254.254Linux2The. 4 kernel later provides a very good firewall tool: netfilter/Iptables, he is free and powerful, can control the incoming and outgoing information, it can achieve firewall, NAT (network address translation) and data packet segmentation and other functions. NetFilter work inside the kernel, while iptables is the table structure that lets the user define the rule set. But Iptables's rules are slightly "complex", so Ubuntu provides UFW as a setting tool to simplify some of Iptables's settings, with the background still iptables. UFW is the abbreviation of uncomplicated firewall, some complex settings or to go to iptables. UFW related files and folders are:/etc/ufw/: There are some UFW environment settings files, such as Before.rules, After.rules, sysctl.conf, ufw.conf, and forIP6 's Before6.rule and After6.rules. These files generally follow the default settings for OK. If UFW is turned on,/etc/ufw/sysctl.conf will overwrite the default/etc/sysctl.conf file, if your original/etc/sysctl.conf has been modified, after the start of UFW, if there is a new assignment in/etc/ufw/sysctl.conf, it will overwrite/ Etc/sysctl.conf, otherwise the/etc/sysctl.conf will prevail. Of course you can modify the "ipt_sysctl=" in/ETC/DEFAULT/UFW"entry to set which sysctrl.conf to use./var/lib/ufw/User.rules This file is a set of some of our firewall rules, open probably can see, sometimes we can directly modify the file, do not use the command to set. After the change, remember UFW reload restart UFW make the new rule take effect. Here are some examples of the UFW command line: UFW enable/disable: Open/Close UFWUFW Status: View the UFW rules that have been defined UFW default allow/deny: Foreign access default allow/reject UFW allow/deny -: Allow/Deny access to Port 20, after 20 can be followed by/tcp or/UDP, which represents a TCP or UDP packet. UFW Allow/deny SERVICENAME:UFW from/etc/services, and filter the corresponding service ports. UFW allow proto TCP from10.0.1.0/TenTo native IP port -: Allowed since 10.0.1.0/10 of TCP packets access the 25 port of this machine. UFW Delete allow/deny -: Deletes the previously defined"Allow/Deny access to port 20"The rules

Ubuntu default firewall install, enable, view status

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.