1.安装iptables

yum  install  iptables* -y

2.打开端口

iptables -I INPUT -p tcp --dport  -j ACCEPT

3.查看本机关于IPTABLES的设置情况

iptables -L -n

配置
1、iptables命令格式
     iptables [-t 表] -命令 匹配 操作 (大小写敏感)
   动作选项
     ACCEPT          接收数据包
     DROP             丢弃数据包
     REDIRECT      将数据包重新转向到本机或另一台主机的某一个端口,通常功能实现透明代理或对外开放内网的某些服务
     SNAT             源地址转换
     DNAT             目的地址转换
     MASQUERADE       IP伪装
     LOG               日志功能
2、定义规则
   ①先拒绝所有的数据包,然后再允许需要的数据包
      iptalbes -P INPUT DROP
      iptables -P FORWARD DROP
      iptables -P OUTPUT ACCEPT
   ②查看nat表所有链的规则列表
      iptables -t nat -L
   ③增加,插入,删除和替换规则
     iptables [-t 表名] <-A|I|D|R> 链名 [规则编号] [-i|o 网卡名称] [-p 协议类型] [-s 源ip|源子网] [--sport 源端口号] [-d 目的IP|目标子网] [--dport 目标端口号] [-j 动作]
    参数:-A 增加
               -I 插入
               -D 删除
               -R 替换

参考文献https://www.cnblogs.com/alimac/p/5848372.html

centos 端口iptables配置的更多相关文章

  1. CentOS下iptables 配置详解

    如果你的IPTABLES基础知识还不了解,建议先去看看. 开始配置 我们来配置一个filter表的防火墙. (1)查看本机关于IPTABLES的设置情况 [root@tp ~]# iptables - ...

  2. CentOs中iptables配置允许mysql远程访问

    在CentOS系统中防火墙默认是阻止3306端口的,我们要是想访问mysql数据库,我们需要这个端口,命令如下: 1 /sbin/iptables -I INPUT -p tcp --dport 30 ...

  3. centos mysql iptables配置

    在CentOS系统中防火墙默认是阻止3306端口的,我们要是想访问mysql数据库,我们需要这个端口,命令如下: iptables -I INPUT -p tcp --dport 3036 -j AC ...

  4. Centos 7 iptables配置

    systemctl status firewalld.service #检测是否开启了firewall systemctl stop firewalld.service #关闭firewall syt ...

  5. CentOS防火墙iptables的配置方法详解

    CentOS系统也是基于linux中的它的防火墙其实就是iptables了,下面我来介绍在CentOS防火墙iptables的配置教程,希望此教程对各位朋友会有所帮助. iptables是与Linux ...

  6. CentOS下配置iptables防火墙 linux NAT(iptables)配置

    CentOS下配置防火墙 配置nat转发服务CentOS下配置iptables防火墙 linux NAT(iptables)配置 CentOS下配置iptables 1,vim /etc/syscon ...

  7. CentOS 6.x 配置iptables

    CentOS 6.x 配置iptables 来源 https://www.cnblogs.com/chillax1314/p/7976067.html iptables -P INPUT DROP-- ...

  8. CentOS下Apache配置多域名或者多端口映射

    CentOS下Apache默认网站根目录为/var/www/html,假如我默认存了一个CI项目在html文件夹里,同时服务器的外网IP为ExampleIp,因为使用的是MVC框架,Apache需开启 ...

  9. Centos下lnmp正确iptables配置规则

    查看iptable运行状态 service iptables status 清除已有规则 iptables -Fiptables -Xiptables -Z 开放端口 #允许本地回环接口(即运行本机访 ...

随机推荐

  1. memset函数用法及注意事项

    头文件 #include<cstring>// or #include<memory.h> ------------------------------------------ ...

  2. [非原创] 常用加密算法整理 AES/SSL(一)

    前言: 在伟大的计算机科学家研究下,发明了许多的加密算法,以下做个简答的描述: 一.分类 加密算法分为两种:单向加密.双向加密. 单向加密,不可逆的加密算法,只能加密不能解密: 双向加密,由对称性加密 ...

  3. LeetCode OJ:Contains Duplicate(是否包含重复)

    Given an array of integers, find if the array contains any duplicates. Your function should return t ...

  4. LeetCode OJ:Minimum Depth of Binary Tree(二叉树的最小深度)

    Given a binary tree, find its minimum depth. The minimum depth is the number of nodes along the shor ...

  5. python list的extend和append方法

    append: Appends object at the end. x = [1, 2, 3] x.append([4, 5]) print (x) gives you: [1, 2, 3, [4, ...

  6. AMD 规范使用总结

    转自:http://www.jianshu.com/p/9b44a1fa8a96 AMD模式 define和require这两个定义模块.调用模块的方法,合称为AMD模式.它的模块定义的方法非常清晰, ...

  7. CH5702 Count The Repetitions[倍增dp]

    http://contest-hunter.org:83/contest/0x50%E3%80%8C%E5%8A%A8%E6%80%81%E8%A7%84%E5%88%92%E3%80%8D%E4%B ...

  8. an easy problem(贪心)

    An Easy Problem Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 8333   Accepted: 4986 D ...

  9. java实现sendemail

    <dependency> <groupId>com.sun.mail</groupId> <artifactId>javax.mail</arti ...

  10. jira python操作,自动创建问题

    jira web api地址 http://jira.**.com/plugins/servlet/restbrowser http://jira.**.com/rest/api/2/issue/cr ...