[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 -- anywhere anywhere tcp dpt:http
ACCEPT all -- anywhere anywhere state RELATED,ESTABLISHED
ACCEPT icmp -- anywhere anywhere
ACCEPT all -- anywhere anywhere
ACCEPT tcp -- anywhere anywhere state NEW tcp dpt:ssh
REJECT all -- anywhere anywhere reject-with icmp-host-prohibited Chain FORWARD (policy ACCEPT)
target prot opt source destination
REJECT all -- anywhere anywhere reject-with icmp-host-prohibited Chain OUTPUT (policy ACCEPT)
target prot opt source destination

[root@zabbix-server html]# service iptables save
iptables: Saving firewall rules to /etc/sysconfig/iptables:[ 确定 ]

 

测试访问

删除刚刚添加的80端口

[root@zabbix-server html]# iptables -D INPUT  -p tcp --dport  -j ACCEPT
[root@zabbix-server html]# iptables -L
Chain INPUT (policy ACCEPT)
target prot opt source destination
ACCEPT all -- anywhere anywhere state RELATED,ESTABLISHED
ACCEPT icmp -- anywhere anywhere
ACCEPT all -- anywhere anywhere
ACCEPT tcp -- anywhere anywhere state NEW tcp dpt:ssh
REJECT all -- anywhere anywhere reject-with icmp-host-prohibited Chain FORWARD (policy ACCEPT)
target prot opt source destination
REJECT all -- anywhere anywhere reject-with icmp-host-prohibited Chain OUTPUT (policy ACCEPT)
target prot opt source destination [root@zabbix-server html]# service iptables save
iptables: Saving firewall rules to /etc/sysconfig/iptables:[ 确定 ]

测试访问

iptables 开放80端口以及删除80端口的规则的更多相关文章

  1. [转载]CENTOS 6.0 iptables 开放端口80 3306 22端口

    原文地址:6.0 iptables 开放端口80 3306 22端口">CENTOS 6.0 iptables 开放端口80 3306 22端口作者:云淡风轻 #/sbin/iptab ...

  2. Iptables 防火墙开放常见的22,53,80端口

    用iptables防火墙 iptables -F # 允许包从22端口进入 iptables -A INPUT -p tcp --dport 22 -j ACCEPT # 允许从22端口进入的包返回 ...

  3. (转载)CentOS: 开放80、22、3306端口操作

    (转载)http://blog.sina.com.cn/s/blog_3eba8f1c0100tsox.html #/sbin/iptables -I INPUT -p tcp --dport 80 ...

  4. 【转】CentOS: 开放80、22、3306端口操作

    #/sbin/iptables -I INPUT -p tcp --dport 80 -j ACCEPT#/sbin/iptables -I INPUT -p tcp --dport 22 -j AC ...

  5. CentOS7防火墙开启与关闭以及开放6379,3306,80等端口

    CentOS7用firewall防火墙替代了原来的iptables,所以我们应该使用firewall的一些命令.如下:1.关闭防火墙 systemctl stop firewalld.service ...

  6. centos7防火墙iptables开放常用端口

    清除所有规则: iptables -F 开放常用tcp端口: iptables -I INPUT -p tcp -m multiport --dports 20,21,22,3690,80,443,4 ...

  7. linux将80端口映射到指定端口命令

    1.添加一个端口映射 将80端口映射到8088端口命令如下: iptables -t nat -I PREROUTING -p tcp --dport 80-j REDIRECT --to-port ...

  8. Linux中使用iptables开放特定端口

    禁止其他主机对该特定主机进行访问和远程连接控制,所以只开放特定端口 只控制INPUT链就可达到控制其他主机对该主机的访问. 1.首先关闭INPUT链 iptables -P INPUT DROP 使用 ...

  9. docker上部署nginx容器80端口自动转443端口

    拉去nginx镜像 # docker pull nginx 运行nginx容器config用于拷贝nginx配置文件 # docker run --name nginxconfig -d docker ...

随机推荐

  1. eclipse利用sql语句对Oracle数据库进行操作

    对Oracle数据库执行操作的sql语句中表名和列名都需用英文双引号("")括起来. 注(\为转义符) 1.插入数据 sql = "insert into \" ...

  2. [USACO09MAR]Moon哞哞叫Moon Mooing(模拟)

    链接:https://ac.nowcoder.com/acm/contest/1086/F来源:牛客网 题目描述 A full moon casts some sort of spell on the ...

  3. NOIP 2004 T3 合唱队形(DP、最长上升/下降子序列)

    链接:https://ac.nowcoder.com/acm/contest/1082/C来源:牛客网 题目描述 N位同学站成一排,音乐老师要请其中的(N-K)位同学出列,使得剩下的K位同学排成合唱队 ...

  4. 十六、linux系统网络基础

    1.网络是由IP构成的:network + host,以至于我们使用网络向外发信息,不会发错. 2.子网掩码这里要知道两点: 1)子网掩码不可能出现交叉部分,换句话说不会出现01010101的交叉现象 ...

  5. WebElement--定位经验

    通常,我们这页面中定位一个元素,如果HTML中明明有却定位不到,我们一定会从这两个方面考虑. 第一:是不是页面中有多个iframe/frame结构,很多情况下我们需要通过切换iframe/frame结 ...

  6. php测试使用小的mysql存储过程

    <?php //前提是php.ini里面要开通mysqli的扩展./*$link = mysqli_connect('localhost','root','','chinatupai');  $ ...

  7. Redis为什么这么快以及持久化机制

    1.首先我们谈一下为什么Redis快: 一. Redis是纯内存数据库,一般都是简单的存取操作,线程占用的时间很多,时间的花费主要集中在IO上,所以读取速度快. 二. 再说一下IO,Redis使用的是 ...

  8. ambulance|severely|halt

    N-COUNT 救护车An ambulance is a vehicle for taking people to and from hospital. very seriously 严重地 Thei ...

  9. 解密优秀博士成长史 ——微软亚洲研究院首届博士生学术论坛Panel讨论经验总结

    --微软亚洲研究院首届博士生学术论坛Panel讨论经验总结" title="解密优秀博士成长史 --微软亚洲研究院首届博士生学术论坛Panel讨论经验总结"> 编者 ...

  10. 转载【docker】CMD ENTRYPOINT 的使用方法

    原文:https://blog.csdn.net/u010900754/article/details/78526443