最小化安装 CentOS7 后,很多端口默认是不打开的,需要通过  firewall-cmd   把这些端口打开。

检查防火墙状态

# firewall-cmd --state
running

 关闭防火墙

# systemctl stop firewalld
# firewall-cmd --state
not running

 查看开放端口列表

# firewall-cmd --list-all
public (default, active)
interfaces: docker0 enp0s3
sources:
services: dhcpv6-client ssh
ports:
masquerade: no
forward-ports:
icmp-blocks:
rich rules:

暂时开放http 服务

# firewall-cmd --add-service=http

永久开放http 服务

# firewall-cmd --add-service=http --permanent

永久关闭http 服务

# firewall-cmd --remove-service=http --permanent

让设定生效

# systemctl restart firewalld

获取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 http
yes

开放指定的端口

# firewall-cmd --add-port=/tcp
# firewall-cmd --list-all
public (default)
interfaces:
sources:
services: dhcpv6-client ftp ssh
ports: /tcp
masquerade: no
forward-ports:
icmp-blocks:
rich rules:

最新文章

  1. PHP设计模式(六)原型模式(Prototype For PHP)
  2. Objective-C中小怪兽的逻辑
  3. 【十大经典数据挖掘算法】Naïve Bayes
  4. win10U盘 安装
  5. look
  6. 证明Dijkstra中加入S的点已经最优
  7. linux下打开chm文件的方法
  8. rpmdb: BDB0113 错误
  9. 从ramdisk根文件系统启动Linux成功,及使用initramfs启动linux
  10. nyoj 540 奇怪的排序
  11. 过滤器(Filter)
  12. angularJS学习手册(1)
  13. 启用DHCP中继代理,实现跨子网服务 - Win 2003 Server
  14. 再造轮子之网易彩票-第一季(IOS 篇 by sixleaves)
  15. hiho 1015 KMP
  16. jenkins添加类ubuntu/centos节点报错
  17. 17.结构体(typedef)
  18. TP5新增模块
  19. 翻译:SockJS-node文档(一)
  20. go tail

热门文章

  1. TSL230选型
  2. linux管理员
  3. ecshop 后台批量上传商品 完整上传
  4. ecshop购物流程中去掉email邮箱
  5. QQ旅程server分析01-网关server
  6. WPF 3D: MeshGeometry3D纹理坐标的正确定义
  7. TMS320F28335项目开发记录2_CCS与JTAG仿真器连接问题汇总
  8. 【HDU】5256 系列转换(上涨时间最长的序列修饰)
  9. C++面试宝典2011版
  10. li排序