#查看默认防火墙状态
[root@localhost init.d]# firewall-cmd --state
running
#关闭firewall
[root@localhost init.d]# systemctl stop firewalld.service
#禁止firewall开机启动
[root@localhost init.d]# systemctl disable firewall.service
Failed to execute operation: Access denied
[root@localhost init.d]# firewall-cmd --state
not running
CentOS 7 采用了 firewalld 防火墙,查询是否开启23端口
firewall-cmd --query-port=23/tcp
no
显示23端口没有开启使用下面命令开启23端口
firewall-cmd --zone=public --add-port=23/tcp --permanent
success
重新加载firewall-cmd
firewall-cmd --complete-reload
success
重新查询23端口是否开放
firewall-cmd --query-port=23/tcp
yes