Thứ Năm, 29 tháng 9, 2022

How to Check Firewall Status in Ubuntu Firewall

 

How to Check Firewall Status in Ubuntu Firewall

In the last lesson we learned how to enable and disable Ubuntu Firewall in Ubuntu Linux. In This tutorial we are going to learn how to check the firewall status in Ubuntu UFW.

To check firewall status use the ufw status command in the terminal.

sudo ufw status

If the firewall is enabled, you will see the list of firewall rules and the status as active. If the firewall is disabled, you will get the message “Status: inactive”.

For more detailed status use verbose option with ufw status command.

sudo ufw status verbose

Verbose option displays additional settings including default firewall settings.

How to Check Firewall Status in Ubuntu Firewall

Display firewall rule numbers

The numbered option of the ufw status command will display the rule number.

sudo ufw status numbered

ufw status firewall rule number

Once we know the rule number, We can use rule number to modify existing firewall rules. For example, I can delete the firewall rule number by typing

sudo ufw delete 4

Filter Firewall status with grep command

The Linux grep command will help us to filter the output of the ufw status command.

Example : Display default firewall policy

sudo ufw status verbose | grep -i default

ubuntu firewall status default policy

Example : Filter the by specific port

sudo ufw status | grep 22

Rules related to the ssh port 22 will be displayed

ubuntu firewall status filter port

sudo ufw status | grep -i deny

ubuntu check firewall status ufw
This time we filter the status to display firewall rules that have

Không có nhận xét nào:

Đăng nhận xét