Ubuntu Simple firewall UFW configuration record

Source: Internet
Author: User

I am operating under root, the normal user needs sudo permission
UFW Disable off
UFW Enable Open
This file can be closed IPv6
/etc/default/ufw
View Rules
UFW status
Example of adding a rule:

            ufw default allow outgoing            ufw default deny incoming                   ufw default deny   关闭所有外部访问端口            ufw allow ssh       ufw allow 22            ufw allow 80/tcp             ufw allow http/tcp            ufw allow 1725/udp            ufw allow 25:29/udp            ufw allow from 123.45.67.89            ufw allow from 123.45.67.89/24            ufw allow from 123.45.67.89 to any port 22 proto tcp             sudo ufw allow from 192.168.1.1 允许此IP访问所有的本机端口             sudo ufw deny proto tcp from 10.0.0.0/8 to 192.168.0.1 port 22 要拒绝所有的TCP流量从10.0.0.0/8 到192.168.0.1地址的22端口

========================================
Log directory: Vim/var/log/ufw.log
sudo ufw logging on boot log
sudo ufw logging off log
sudo ufw logging Low|medium|high

    1. Sep 15:08:14 The preceding values list the date, time, and host name of your server. The remaining important information includes:
      • [UFW BLOCK]: This is where the description of the recording event begins. In this example, it means that the connection is blocked.
      • In: If it contains a value, then the event is an incoming event
      • Out: If it contains a value, then the event is an outgoing event
      • Mac: Combination of destination and source MAC address
      • SRC: IP of package source
      • DST: IP for package destination
      • LEN: Packet length
      • TTL: Packet ttl, or time to live. Before the destination is found, it jumps between the routers until it expires.
      • PROTO: Protocol for packets
      • SPT: The source port of the package
      • DPT: Destination port of the package
      • WINDOW: The size of the packets that the sender can receive
      • SYN URGP: Indicates whether a three-time handshake is required. 0 indicates no need.

========================================
Three to see the operating system port monitoring

Netstat-an | grep LISTEN | Grep-v ^unix "
Netstat-ntulp
Lsof-i-n-p

Ubuntu Simple firewall UFW configuration record

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.