前阵子在虚拟机上装好了centos6.0,并配好了nginx+php+mysql,但是本机就是无法访问.一直就没去折腾了. 具体情况如下 1.本机能ping通虚拟机 2.虚拟机也能ping通本机 3.虚拟机能访问自己的web 4.本机无法访问虚拟己的web 后来发现是防火墙将80端口屏蔽了的缘故. 检查是不是服务器的80端口被防火墙堵了,可以通过命令:telnet server_ip 80 来测试. 1>.解决方法如下: /sbin/iptables -I INPUT -p tcp --dpor…
开启80端口 firewall-cmd --zone=public --add-port=80/tcp --permanent 出现success表明添加成功 命令含义: --zone #作用域 --add-port=80/tcp  #添加端口,格式为:端口/通讯协议 --permanent   #永久生效,没有此参数重启后失效 重启防火墙 systemctl restart firewalld.service 1.运行.停止.禁用firewalld 启动:# systemctl start  …
在CentOS 6.x版本中,默认使用的是iptables防火墙.到了CentOS 7.x版本,默认防火墙变成了firewalld.本篇通过使用firewalld开启.关闭 HTTP(80)端口,来讲述firewalld的基本使用方法. firewalld 的一切设置均使用 firewall-cmd 命令完成. 配置前先确保防火墙是运行着的: [root@bogon ~]# firewall-cmd --state running 输出running就说明运行着,否则需要开启: [root@bo…
开启80端口 1.firewall-cmd --zone=public --add-port=80/tcp --permanent  出现success表明添加成功 命令含义: --zone #作用域 --add-port=80/tcp  #添加端口,格式为:端口/通讯协议 --permanent   #永久生效,没有此参数重启后失效 重启防火墙 1.systemctl restart firewalld.service    1.运行.停止.禁用firewalld 启动:# systemctl…
我们在生产环境中,一般都是把防火墙打开的,不像测试环境,可以直接关闭掉.最近安装zabbix ,由于公司服务器既有centos 7又有centos 6,遇到了一些防火墙的问题,现在正好把centos防火墙的问题梳理一下,做一个记录. 开放其他端口同理,只需要把我这里的10050修改为其他需要开放的端口即可. 一.CentOS 7 如果打开了防火墙,需要在firewalld中添加策略,允许访问zabbix-agent端口10050和10051 以下是添加zabbix端口10050和10051端口的…
1.查看状态:iptables -L -n2.直接编辑:vi /etc/sysconfig/iptables3.端口开放:-A INPUT -m state --state NEW -m tcp -p tcp --dport 18080 -j ACCEPT4.保存文件::wq5.重启防火墙:service iptables restart备注:批量开端口 -A INPUT -p tcp -m tcp --dport 18080:18090 -j ACCEPT    …
[root@zabbix-server html]# iptables --version iptables v1.4.21 [root@zabbix-server html]# iptables -I INPUT -p tcp --dport -j ACCEPT [root@zabbix-server html]# iptables -L Chain INPUT (policy ACCEPT) target prot opt source destination ACCEPT tcp -- a…
清除所有规则: iptables -F 开放常用tcp端口: iptables -I INPUT -p tcp -m multiport --dports 20,21,22,3690,80,443,4443,8023,8888,25,110,30000:30999 -j ACCEPT iptables -I OUTPUT -p tcp -m multiport --sports 20,21,22,3690,80,443,4443,8023,8888,25,110,30000:30999 -j A…
# 安装iptables-services [root@localhost bin]# yum install iptables-services [root@localhost bin]# /bin/systemctl status iptables.service # 临时开放端口 [root@localhost sysconfig]# iptables -I INPUT -p tcp --dport -j ACCEPT # 重启iptables临时端口失效 [root@localhost…
/sbin/iptables -I INPUT -p tcp --dport 80 -j ACCEPT 写入修改 /etc/init.d/iptables save 保存修改 service iptables restart 重启防火墙,修改生效…