Firewall CMD command in CentOS 7

 
In CentOS 7
Temporarily open FTP service
# is firewall – CMD – add – service = FTP
 
Open the FTP service permanently
# is firewall – CMD – add – service = FTP – permanent
Permanent ban
# is firewall – CMD – remove – service = FTP – permanent
success
 
Enabling Settings
# systemctl restart firewalld
 
Check if the Settings are in effect
# iptables – L – n | grep 21
 
ACCEPT the TCP – 0.0.0.0/0 0.0.0.0/0 TCP DPT: 21 ctstate NEW
Check firewall status
# is firewall – CMD – state
 
running
 
# systemctl stop firewalld
 
# is firewall – CMD – state
 
not running
 
 
# is firewall – CMD – list – all
Public (default) interfaces: sources: services: dhcpv6-client FTP SSH ports: masquerade: no forward-ports: ICMP-blocks: rich rules:
 
The name of the service in FirewallD
# firewall-cmd –get-service amanda-client bacula DHCP dhcpv6 dhcpv6-client DNS FTP high-availability HTTP HTTPS iMAP ipp ipp ip-client ipsec kerberos kpasswd ldap ldaps libvirt libvirt-tls mdns mountd ms-wbt mysql nfs ntp openvpn pmcd pmproxy pmwebapi pmwebapis pop3s postgresql proxy-dhcp radius rpc-bind samba samba-client smtp ssh telnet tftp tftp-client transmission-client vnc-server wbem-https
 
Query the enabling status of the 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
# 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: 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: The icmp – blocks: rich rules:
 
 

Read More: