The firewall-cmd command in CentOS 7, centosfirewall-cmd

Source: Internet
Author: User

The firewall-cmd command in CentOS 7, centosfirewall-cmd

In CentOS 7

Ftp service is currently available
# Firewall-cmd -- add-service = ftp

Permanently open ftp service
# Firewall-cmd -- add-service = ftp -- permanent
Permanently close
# Firewall-cmd -- remove-service = ftp -- permanent
Success

Make settings take effect
# Systemctl restart firewalld

Check whether the settings take effect
# Iptables-L-n | grep 21
ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt: 21 ctstate NEW

Check the 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-client dhcp dhcpv6 dhcpv6-client dns ftp high-availability http https imaps ipp-client ipsec kerberos kpasswd ldap ldaps libvirt-tls mdns mountd ms-wbt mysql nfs ntp openvpn pmcd pmproxy pmwebapi pmwebapis pop3s postgresql proxy-dhcp radius rpc-bind samba-client smtp ssh telnet tftp-client transmission-client vnc-server wbem-https

Query the Service Activation status
# Firewall-cmd -- query-service ftp
Yes
# Firewall-cmd -- query-service ssh
Yes
# Firewall-cmd -- query-service samba
No
# Firewall-cmd -- query-service http
No

Add the Port to be opened by 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:

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.