Summary of firewall usage in Linux
- 2020-06-12 11:40:06
- OfStack
Summary of firewall usage in Linux
firewall is simple to use
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 the outer network port
firewall-cmd --permanent --query-port=8080/tcp
5. Delete port 8080 and forbid 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 port 8080
firewall-cmd --add-forward-port=port=80:proto=tcp:toport=8080
9, see 1 which services and ports are now open on the firewall
[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 Linux firewall in the simple example, if you have any questions please leave a message or to this site community exchange discussion, thank you for reading, hope to help you, thank you for your support to this site!