CentOS 7 firewall-cmd Command Detailed introduction _linux

Source: Internet
Author: User
Tags ssh centos bacula



CentOS 7 firewall-cmd Command

Centos 7 firewall commands


In CentOS 7



Centos 7 firewall cmd

Open FTP Service temporarily
# Firewall-cmd--add-service=ftp





Permanent Open FTP Service
# Firewall-cmd--add-service=ftp--permanent

How to open firewall in centos 7



Permanently closed
# Firewall-cmd--remove-service=ftp--permanent
Success





Let the settings take effect
# systemctl Restart Firewalld


Turn on firewall centos 7


Check that the settings are in effect
# iptables-l-N | grep 21
ACCEPT TCP--0.0.0.0/0 0.0.0.0/0 TCP dpt:21 ctstate NEW





Check firewall status
# Firewall-cmd--state
Running


Enable port firewall centos 7


# Systemctl Stop Firewalld
# Firewall-cmd--state
Not running

How to check firewall rules in centos 7

# firewall-cmd--list-all public
(default)
 interfaces:
 Sources:
 services:dhcpv6-client ftp ssh
 Ports:
 masquerade:no
 forward-ports:
 icmp-blocks:
 Rich rules:


Name of service in FIREWALLD



# firewall-cmd--get-service
amanda-client bacula bacula-client dhcp DHCPv6 dhcpv6-client DNS FTP 
High-availability http HTTPS imaps IPP ipp-client IPSec Kerberos kpasswd 
LDAP ldaps libvirt libvirt-tls MDNs mountd m S-WBT MySQL NFS ntp openvpn
 pmcd pmproxy pmwebapi pmwebapis pop3s postgresql proxy-dhcp radius 
rpc-bind Samba SA mba-client smtp ssh telnet tftp tftp-client transmission-client vnc-server Wbem-https



The enabled state of the query service
# Firewall-cmd--query-service FTP
Yes
# firewall-cmd--query-service SSH
Yes
# Firewall-cmd--query-service Samba
No
# Firewall-cmd--query-service http
No





Join the Port you want to open yourself



# firewall-cmd--add-port=3128/tcp
# firewall-cmd--list-all public
(default)
 interfaces:
 sources:
 services:dhcpv6-client ftp ssh
 ports:3128/tcp
 masquerade:no
 forward-ports:
 icmp-blocks:
 Rich rules:


Thank you for reading, I hope to help you, thank you for your support for this site!

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.