Home >Operation and Maintenance >Linux Operation and Maintenance >Detailed explanation of the use of firewall in Linux
This article mainly introduces the relevant information about the use of firewall in Linux. Here are the commands used to help everyone learn and understand. Friends in need can refer to
Firewall in Linux Summary of usage
Simple use of firewall
1. Display all configurations
firewall-cmd --list-all-zones
2. Reload the configuration
firewall-cmd --reload
3, remove interface from public
firewall-cmd --zone=public --remove-interface=eno16777736
4, query external network Port
firewall-cmd --permanent --query-port=8080/tcp
5, delete port 8080, prohibit external network access
firewall-cmd --permanent --remove-port=8080/tcp
6 , add port 8080 for external network access
firewall-cmd --permanent --add-port=8080/tcp
7, restart the firewall
systemctl restart firewalld
8, forward the request to port 80 to 8080
firewall-cmd --add-forward-port=port=80:proto=tcp:toport=8080
9, check which services and ports the firewall has opened now
[root@localhost ~]# firewall-cmd --list-all public (default, active) interfaces: eno16777736 sources: services: dhcpv6-client ssh ports: 8080/tcp masquerade: no forward-ports: port=80:proto=tcp:toport=8080:toaddr= icmp-blocks: rich rules:
10, set the default zone
irewall-cmd --get-default-zone firewall-cmd --set-default-zone=trusted
The above is the detailed content of Detailed explanation of the use of firewall in Linux. For more information, please follow other related articles on the PHP Chinese website!