current position:Home>Linux Firewall port

Linux Firewall port

2022-01-27 02:12:37 Carrot rabbit

cento7.4 Firewall port

Linux System operation and Maintenance Notes ,CentOS 7.4 Firewall configuration

1、 see firewall Service status

systemctl status firewalld
 Insert picture description here

2、 see firewall The state of

firewall-cmd --state
 Insert picture description here

3、 Turn on 、 restart 、 close 、firewalld.service service

Turn on

service firewalld start


service firewalld restart


service firewalld stop

4、 View firewall rules

firewall-cmd --list-all
 Insert picture description here

5、 Inquire about 、 to open up 、 Close the port

Copy code

Check whether the port is open

firewall-cmd --query-port=8080/tcp

to open up 80 port

firewall-cmd --zone=public --add-port=80/tcp --permanent

Remove port

firewall-cmd --permanent --remove-port=8080/tcp
# service iptables restart ( After modifying the configuration, restart the firewall )
firewall-cmd --reload

Parameter interpretation
firwall-cmd yes Linux Operations provided firewall A tool for
–zone Scope
–add-port=80/tcp # Add port , The format is : port / Communication protocol
–permanent permanent , Failure after restart without this parameter

copyright notice
author[Carrot rabbit],Please bring the original link to reprint, thank you.

Random recommended