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 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
# 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