1.安装iptable iptable-service

#先检查是否安装了iptables
service iptables status
#安装iptables
yum install -y iptables
#升级iptables
yum update iptables
#安装iptables-services
yum install iptables-services

2.禁用/停止自带的firewalld服务

systemctl stop firewalld.service && sudo systemctl disable firewalld.service

3.将iptables置为开机自启

chkconfig iptables on

4.iptables的常用命令

service iptables  start      #启动服务

service iptables  stop     #停止服务

service iptables  restart  #重启服务

service iptables  status     #重启服务

5.查看iptables规则

iptables -L -n

6.附上常用端口开放文档

# Generated by iptables-save v1.4.7 on Wed Jul 11 20:48:21 2018
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
-A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
-A INPUT -p icmp -j ACCEPT
-A INPUT -i lo -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 21 -j ACCEPT
-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
-A INPUT -p tcp -m state --state NEW -m tcp --dport 3306 -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 443 -j ACCEPT
-A INPUT -j REJECT --reject-with icmp-host-prohibited
-A FORWARD -j REJECT --reject-with icmp-host-prohibited
# 上句之后添加的iptables无效
COMMIT
# Completed on Wed Jul 11 20:48:21 2018

iptables安装的更多相关文章

  1. Linux防火墙iptables安装配置--使用远程工具Xmanager和ftp服务安装配置

    一.linux关闭防火墙:    a.用户直接在终端输入:service iptables stop     查看防火墙状况:service iptables status  b.root用户在终端输 ...

  2. CentOS7 iptables安装及操作

    添加规则时的考量点: (1)要实现哪种功能:判断添加在哪张表上: (2)报文流经的路径:判断添加在哪个链上: 链上规则的次序: (1)同类规则(访问同一应用),匹配范围小的放上面: (2)不同类规则( ...

  3. centos下iptables安装

    [root@localhost ~]# yum install iptables -y[root@localhost ~]# yum install iptables-services 查看安装情况 ...

  4. iptables安装失败后-------------firewalld回归

    yum install firewalld systemctl stop iptables; systemctl mask iptables; systemctl unmask firewalld s ...

  5. CentOS7安装iptables防火墙

    CentOS7默认的防火墙不是iptables,而是firewalle. 安装iptable iptable-service #先检查是否安装了iptables service iptables st ...

  6. entOS7安装iptables防火墙,试验未通过

    CentOS7默认的防火墙不是iptables,而是firewalle. 安装iptable iptable-service #先检查是否安装了iptables service iptables st ...

  7. centos6.5 安装iptables

    阿里云默认是没有安装iptables 安装 yum install -t iptables yum install iptables-services 检查iptables服务的状态 service ...

  8. CentOS 7安装iptables服务,以及常用命令

    之前使用的是CentOS6.5,并且学艺不精,用啥查啥,用完就忘.并且网上大部分资料是基于CentOS7之前的版本. 在CentOS7中,默认的防火墙不是iptables,而是firewalld.而且 ...

  9. CentOS7安装配置iptables防火墙

    转载请注明出处:http://blog.csdn.net/l1028386804/article/details/50779761 CentOS7默认的防火墙不是iptables,而是firewall ...

随机推荐

  1. 搭建Linux运行环境-虚拟机

    1.虚拟机软件介绍 虚拟机(Virtual Machina)软件就是一套特殊的软件,它可以作为系统独立运行,也可以运行与系统之上. 若是运行与系统之上的虚拟机软件,在一台电脑(PC或笔记本等)上安装虚 ...

  2. luoguP2502旅行

    2006河南省选 思路:(参考题解) 枚举最大的边(第\(i\)条),从这条边开始由大到小枚举.添边,当\(s\)和\(t\)联通时,此时即为以第\(i\)条边为最大边的答案,比较每个答案,判断输出. ...

  3. matplotlib 中的柱状图

    def drawBar(): pyplot.bar(range(5),[100,200,300,400,400]) pyplot.xticks(range(5),['A','B','C','D','E ...

  4. 一次String的错误使用

    今日,在写代码的过程中,程序执行一个方法居然出现了heap space溢出的异常. 从来还没有遇到这样的异常,打断点发现是做字符串拼接时出现此异常. 所以知道了是String使用的异常,因为我做的操作 ...

  5. Django与Ajax

    一.Ajax简介 AJAX(Asynchronous Javascript And XML)翻译成中文就是“异步Javascript和XML”.即使用Javascript语言与服务器进行异步交互,传输 ...

  6. Django报错:OSError: raw write() returned invalid length 4 (should have been between 0 and 2)

    在使用Django时Django报错:Django报错:OSError: raw write() returned invalid length 4 (should have been between ...

  7. STM32L1 串口相应驱动开发

    初始化设置: GPIO_InitTypeDef GPIO_InitStructure; NVIC_InitTypeDef NVIC_InitStructure; USART_InitTypeDef U ...

  8. centos/redhat/ubuntu不同之处

    前言:最近用久了ubuntu,发现这个和centos还是有很大差别的,以下是我的个人总结: centos/redhat/ubuntu不同之处: 1.关系理解:centos和redhat,你可以理解为是 ...

  9. 2018-2019-2 网络对抗技术 20165328 Exp1 PC平台逆向破解

    实验目的: 本次实践的对象是一个名为pwn1的linux可执行文件. 该程序正常执行流程是:main调用foo函数,foo函数会简单回显任何用户输入的字符串. 该程序同时包含另一个代码片段,getSh ...

  10. 基于.net的分布式系统限流组件(限流算法:令牌算法和漏斗算法)

    转载链接:https://www.cnblogs.com/vveiliang/p/9049393.html 1.令牌桶算法 令牌桶算法是比较常见的限流算法之一,大概描述如下: 1).所有的请求在处理之 ...