In CentOS 7
Temporarily Open FTP Service
#Firewall-cmd--add-service=ftp
Permanently open FTP Service
#firewall-cmd--add-service=ftp--permanent
Permanently closed
#firewall-cmd--remove-service=ftp--permanent
Success
Let the setting take effect
# systemctl Restart Firewalld
Check that the settings are in effect
# iptables-l-n | grep
ACCEPT TCP -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:21 ctstate NEW
Check firewall status
# Firewall-cmd--state
Running
#systemctl Stop Firewalld
#Firewall-cmd--state
Not running
#Firewall-cmd--list-all
Public (default)
Interfaces
Sources
services:dhcpv6-client ftp SSH
Ports
Masquerade:no
Forward-ports:
Icmp-blocks:
Rich rules:
Service name 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 IPs EC Kerberos KPASSWD LDAP ldaps libvirt libvirt-tls mdns mountd MS-WBT mysql NFS ntp openvpn pmcd pmproxy pmwebapi Pmwebapi s pop3s PostgreSQL proxy-dhcp radius rpc-bind samba samba-client smtp ssh telnet tftp tftp-client transmission-client vnc- Server Wbem-https
Query the enabled state of a 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:
Firewall-cmd command in CentOS 7