如果系统已安装则调过安装步骤

查找安装包

yum list | grep iptables

安装iptables

yum install iptables-services

重启防火墙使配置文件生效

systemctl restart iptables.service

设置iptables防火墙为开机启动项

systemctl enable iptables.service

查看激活状态

systemctl status iptables.service

查看本机IPTABLES的设置情况

iptables -nL

开放端口,编辑配置

vim /etc/sysconfig/iptables

添加

-A INPUT -p tcp -m state --state NEW -m tcp --dport 22 -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT

重启即可

启动指令:service iptables start
重启指令:service iptables restart
关闭指令:service iptables stop

https://blog.csdn.net/u011019141/article/details/78872468?utm_source=copy

Linux iptables开放特定端口的更多相关文章

  1. Linux 防火墙开放特定端口 (iptables)

    iptables是linux下的防火墙,同时也是服务名称.   service  iptables  status        查看防火墙状态 service  iptables  start   ...

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

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

  3. Linux 防火墙iptables开放特定端口

    1.查看状态:iptables -L -n2.直接编辑:vi /etc/sysconfig/iptables3.端口开放:-A INPUT -m state --state NEW -m tcp -p ...

  4. Linux 防火墙开放特定端口 (iptables)

    1.查看状态:iptables -L -n2.直接编辑:vi /etc/sysconfig/iptables3.端口开放:-A INPUT -m state --state NEW -m tcp -p ...

  5. linux 防火墙开放特定端口与指定ip谨防

    vi etc/iptable/sysconfig/iptables linux 开放固定端口 -A INPUT -m state --state NEW -m tcp -p tcp --dport 1 ...

  6. linux iptables开放/关闭端口命令

    在CentOS/RHEL 7以前版本上开启端口 #开放端口:8080/sbin/iptables -I INPUT -p tcp --dport 8080 -j ACCEPT#将更改进行保存/etc/ ...

  7. LINUX关闭防火墙、开放特定端口等常用操作

    1. 重启后永久性生效: 开启:chkconfig iptables on 关闭:chkconfig iptables off 2. 即时生效,重启后失效: 开启:service iptables s ...

  8. CentOS 防火墙开放特定端口

    iptables是linux下的防火墙,同时也是服务名称.   service  iptables  status        查看防火墙状态 service  iptables  start   ...

  9. Win10如何设置防火墙开放特定端口 windows10防火墙设置对特定端口开放的方法

    Win10防火墙虽然能够很好地保护我们的系统,但同时也会因限制了某些端口,而给我们的操作带了一些不便.对于既想使用某些端口,又不愿关闭防火墙的用户而言,在Win10系统中设置防火墙开放特定端口就非常必 ...

随机推荐

  1. PAT甲级——A1004 Counting Leaves

    A family hierarchy is usually presented by a pedigree tree. Your job is to count those family member ...

  2. C#用API可以改程序名字

    [DllImport("user32.dll", EntryPoint = "FindWindow")] public static extern int Fi ...

  3. python 编码问题:'ascii' codec can't encode characters in position 的解决方案

    报错: 'ascii' codec can't encode characters in position 8-50: ordinal not in range(128) Python在安装时,默认的 ...

  4. css的层叠性+继承性+优先级+权重

    一.层叠性 1.含义 多种css样式叠加,浏览器处理冲突的能力. 2.原则 1>一般情况下,若出现冲突,会按照css的书写顺序,以最后的样式为准 2>样式不冲突,就不会层叠 二.css的继 ...

  5. Ionic cordova-plugin-splashscreen

    1.添加插件 cordova plugin add https://github.com/apache/cordova-plugin-splashscreen.git 2.设置启动画面 在根目录下面r ...

  6. linux学习(四)-----linux常用指令

    touch 指令 touch 指令创建空文件 基本语法 touch 文件名称 应用实例 案例 1: 创建一个空文件 hello.txt cp 指令 cp 指令拷贝文件到指定目录 基本语法 cp [选项 ...

  7. PAT甲级——A1054 The Dominant Color

    Behind the scenes in the computer's memory, color is always talked about as a series of 24 bits of i ...

  8. python初学小记

    使用PyCharm向世界打招呼! print (“Hello world!”) 介绍自己的基本信息的方法 name = input("name:")age = int(input( ...

  9. 【One by one系列】一步步开始使用Redis吧(一)

    One by one,一步步开始使用Redis吧(一) 最近有需求需要使用redis,之前也是随便用用,从来也没有归纳总结,今天想睡觉,但是又睡不着,外面阳光不错,气温回升了,2019年6月1日,成都 ...

  10. Linux 7.X 解锁用户账号

    Linux 7.X 解锁用户账号 使用指令:sudo passwd -u tomcat ,解锁. 但是会有如下提示信息: 因为 55 失败登录而锁定账户 此时,需执行指令:pam_tally2 -u ...