Firewall-cmd command in CentOS 7

Source: Internet
Author: User
Tags bacula

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

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.