본문 바로가기
Linux

Ubuntu Firewall setting By UFW

by 올엠 2020. 11. 4.
반응형

The basic firewall in Ubuntu is UFW. So here’s how to use the basic UFW..

UFW enable/disable

sudo ufw enable

sudo ufw disable

Displays a warning that the firewall will be blocked on activation.

Allow and block UFW

  1. Port base, Service base:
sudo ufw allow <port>/<optional: protocol>
sudo ufw allow 80 sudo ufw allow 80/tcp sudo ufw allow http sudo ufw deny http
  1. IP base:

sudo ufw allow from <ip address>

sudo ufw allow from 192.168.0.1 sudo ufw allow from 192.168.0.0/24

 

UFW Advanced used

sudo ufw allow from <ip address> to <protocol> port <port number> proto <protocol name>

Allow 192.168.0.100 address and tcp protocol port 80

sudo ufw allow from 192.168.0.1 to any port 80

Delete UFW rule

When deleting a rule in UFW, insert the delete classification and the same rule as the Allow rule. At this time, you can check the rule through state and numbered.

sudo ufw allow from 192.168.0.1

sudo ufw delete from 192.168.0.1

 

UFW numbered rules

You can see the UFW rules with numbers attached. Rules are applied sequentially from top to bottom. You can use this to modify, delete, or add rules.

sudo ufw status numbered

delete

sudo ufw delete 1

insert

sudo ufw insert 1 allow http
반응형