[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. mysql之DTS的那些事

    最近才考虑数据库迁移,想起了之前做DTS踩过的那些坑. 基于数据库迁移,比如从源A库迁移到源B库,包括但不限于数据库上云. 数据库迁移方案有两种场景: (1).停机迁移方案 这种方案是允许停服的场景, ...

  2. 对象数组和for循环遍历输出学生的信息

    public class Student { private int no; private String name; private int age; public Student(int no, ...

  3. javaScript 面向对象 触发夫级构造函数

    class Person{ constructor(name,age){ //直接写属性 this.name=name; this.age=age; console.log('a'); } showN ...

  4. python+selenium自动化测试之登录

    selenium_login.py import unittest from selenium import webdriver class LoginTest(unittest.TestCase): ...

  5. 3.redis kyes命令

    Keys命令 1.1设置key的生存时间 Redis在实际使用过程中更多的用作缓存,然而缓存的数据一般都是需要设置生存时间的,即:到期后数据销毁. EXPIRE key seconds         ...

  6. 吴裕雄--天生自然 python开发学习:在Cenos 7 系统上安装配置python3.6.5

    安装相关依赖包. 在终端下输入命令:sudo yum -y install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-deve ...

  7. 对TD tree的使用体验及建议

    TDtree与QQ空间有着相似的功能,你可以在里面发表自己的感受与心情,也可以存储照片或者给喜欢的说说点赞.发表评论等,可以说这是一个将QQ空间从QQ里独立出来的软件.作为一个娱乐性的软件,它的功能还 ...

  8. asp.net 管道处理模式

  9. django框架进阶-auth认证系统-长期维护

    ##################    django的认证系统     ####################### 我们在开发一个网站的时候,无可避免的需要设计实现网站的用户系统.此时我们需要 ...

  10. perf4j+logback配置 非spring 可使用注解

    最近项目打算使用perf4j进行性能监控,由于项目没有使用spring,而又不想对代码入侵过高,打算使用注解的方式进行接入.perf4j采用AspectJ库实现AOP. 具体接入方法如下: logba ...