[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. LGOJ1861 星之器

    前置扯淡 我对这个题目的评价和网上各位大佬的一样:人类智慧题 (显然我不具有人类智慧--) Description link 现在有一个 \(n \times m\) 的矩阵\(A\),里面的每个元素 ...

  2. springboot FreeMarker template error

    注释掉<#list>xxx</#list> 现在运行就不报错了

  3. 向通用自动驾驶部门Cruise投资22.5亿美元,软银打得什么主意?

    5月29日,加利福尼亚州的一辆特斯拉Model S撞上停在路边的警车.据透露,当时这辆特斯拉正处于自动辅助驾驶即Autopilot模式.而在今年,这已经不是第一次特斯拉自动驾驶模式出问题了.此外,Ub ...

  4. Wanna go back home

    题目描述 Snuke lives on an infinite two-dimensional plane. He is going on an N-day trip. At the beginnin ...

  5. Xen入门系列四【Xen 管理实操】

    1. 克隆一台虚拟机 # virt-clone -o base -n vm-clone -f /vm/vm-clone.img 参数说明: -o 原虚拟机的名称:必须为关闭或者暂停状态. -n 新虚拟 ...

  6. matplotlib,seaborn中文乱码问题的解决

    方法一:指定字体 import matplotlib.pyplot as plt myfont = matplotlib.font_manager.FontProperties(fname='/hom ...

  7. [LC] 198. House Robber

    You are a professional robber planning to rob houses along a street. Each house has a certain amount ...

  8. 2)header的使用

    header() 函数向客户端发送原始的 HTTP 报头. 认识到一点很重要,即必须在任何实际的输出被发送之前调用 header() 函数(在 PHP 以及更高的版本中,您可以使用输出缓存来解决此问题 ...

  9. zabbix报错

    zabbix报错  原文:https://www.cnblogs.com/dbslinux/p/9465803.html https://www.cnblogs.com/losbyday/catego ...

  10. sshd启动故障“Failed to start OpenSSH Server daemon ”解决方法