Detailed explanation of the use of firewall in Linux

黄舟
Release: 2017-08-08 13:08:02
Original
3121 people have browsed it

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
Copy after login

2. Reload the configuration


firewall-cmd --reload
Copy after login

3, remove interface from public


firewall-cmd --zone=public --remove-interface=eno16777736
Copy after login

4, query external network Port


firewall-cmd --permanent --query-port=8080/tcp
Copy after login

5, delete port 8080, prohibit external network access


firewall-cmd --permanent --remove-port=8080/tcp
Copy after login

6 , add port 8080 for external network access


firewall-cmd --permanent --add-port=8080/tcp
Copy after login

7, restart the firewall


systemctl restart firewalld
Copy after login

8, forward the request to port 80 to 8080


firewall-cmd --add-forward-port=port=80:proto=tcp:toport=8080
Copy after login

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:
Copy after login

10, set the default zone


irewall-cmd --get-default-zone
firewall-cmd --set-default-zone=trusted
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template