相思资源网 Design By www.200059.com

 CentOS 7 中firewall-cmd命令

在 CentOS 7

暂时开放 ftp 服务
# firewall-cmd --add-service=ftp

永久开放 ftp 服务
# firewall-cmd --add-service=ftp --permanent

永久关闭
# firewall-cmd --remove-service=ftp --permanent
success

让设定生效
# systemctl restart firewalld

检查设定是否生效
# iptables -L -n | grep 21
ACCEPT     tcp  --  0.0.0.0/0            0.0.0.0/0            tcp dpt:21 ctstate NEW

检查防火墙状态
# 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:

在 FirewallD 的服务名称

# firewall-cmd --get-service
amanda-client bacula bacula-client dhcp dhcpv6 dhcpv6-client dns ftp 
high-availability http https imaps ipp ipp-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

查询服务的启用状态
# firewall-cmd --query-service ftp
yes
# firewall-cmd --query-service ssh
yes
# firewall-cmd --query-service samba
no
# firewall-cmd --query-service http
no

自行加入要开放的 Port

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

感谢阅读,希望能帮助到大家,谢谢大家对本站的支持!

标签:
CentOS,7,firewall-cmd命令,CentOS,7,firewall-cmd命令详解,CentOS,7,firewall-cmd

相思资源网 Design By www.200059.com
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
相思资源网 Design By www.200059.com

评论“CentOS 7 中firewall-cmd命令详细介绍”

暂无CentOS 7 中firewall-cmd命令详细介绍的评论...