rkey

rkey

deepin Firewall

deepin firewalld#

Deepin is a Linux distribution based on Debian.

image

Its default firewall is iptables. Unlike firewalld, iptables is a rule-based firewall that requires manual configuration of rules to open and close ports.

You can use the following command to view the current iptables rules:

sudo iptables -L

You can edit the rules in the /etc/iptables/rules.v4 file. For example, if you want to allow access to port 80, you can add the following rule:

sudo iptables -A INPUT -p tcp --dport 80 -j ACCEPT

Installing firewalld can make it easier to manage firewall rules. You can use the following command to install firewalld:

sudo apt install firewalld

After that, you can use the following commands to start and stop the firewalld service:

sudo systemctl start firewalld
sudo systemctl stop firewalld

You can use the following command to add port 80 to the firewalld rules:

sudo firewall-cmd --add-port=80/tcp --permanent
sudo firewall-cmd --reload

Note that the default rule of firewalld is to deny all inbound connections.

Choosing between iptables and firewalld on Deepin depends on your personal preference and needs. If you frequently need to add, delete, or change firewall rules, firewalld may be more suitable for you.

deepin view open port list#

On Deepin, you can use the following command to view the current list of open ports:

  1. View using the netstat command
sudo netstat -tunlp

The above command will display all currently open ports and their associated processes.

  1. View using the lsof command
sudo lsof -i -P -n | grep LISTEN

The above command will list all currently listening ports and detailed information about their associated processes.

  1. View using the iptables command
sudo iptables -L -n -v

This command will list all rules in the iptables rule table, including open ports.

Note that if the firewall is blocking a port, that port will not be displayed regardless of which command is used. If you want to allow a port, you need to modify the firewall configuration, such as adding a rule to allow the port.

Deepin iptables view open port list#

On Deepin, you can use the following command to view the current open ports:

sudo iptables -L -n -v --line-numbers | grep ACCEPT

This command will list all allowed ports in the iptables rule table along with their rule information.

Additionally, if you want to check whether a specific port is open, you can use the following command:

sudo iptables -L -n -v --line-numbers | grep <port_number>

The above command will list the rule information related to the specified port in the iptables rule table.

Please note that iptables is a rule-based firewall that requires manual configuration of rules to open and close ports. If you find that a port is not open, you need to manually add the corresponding rule, as shown in the example:

sudo iptables -A INPUT -p tcp --dport <port_number> -j ACCEPT

The above command will allow all packets on TCP port <port_number> to enter the system.

To make the rules permanent, you need to save the rules to the firewall configuration:

sudo service iptables save

After saving the rules, these rules will be automatically loaded if the system is restarted.

deepin uninstall firewalld#

To uninstall Firewalld in Deepin, you can follow these steps:

  1. Stop and disable the Firewalld service:
sudo systemctl stop firewalld
sudo systemctl disable firewalld
  1. Remove Firewalld:
sudo apt remove firewalld
  1. (Optional) Remove Firewalld's configuration files:
sudo rm -rf /etc/firewalld

Please note that after uninstalling Firewalld, Deepin will automatically revert to the default iptables firewall. If you want to use other firewall software as a replacement, feel free to install and configure the software of your choice.

Loading...
Ownership of this post data is guaranteed by blockchain and smart contracts to the creator alone.