author:headsen chen

date:2018-06-04  11:20:38

notice:This  article is created by headsen chen himself and not allowed to copy.or you will count law questions.

#启动
service iptables start
chkconfig iptables on
情况原先的规则
iptables -F #允许特定网段和地址访问
iptables -I INPUT -s 192.168.1.0/24 -j ACCEPT
iptables -I INPUT -s 121.23.45.146 -j ACCEPT iptables -I INPUT -p tcp -s 121.23.45.146 --dport 22 -j ACCEPT
iptables -I INPUT -p tcp -s 10.0.0.0/16 --dport 22 -j ACCEPT #内部回环口
iptables -I OUTPUT -o eth0 -j ACCEPT
iptables -I INPUT -i lo -j ACCEPT #默认规则
iptables -P INPUT DROP
iptables -P OUTPUT ACCEPT
iptables -P FORWARD DROP #允许httpd服务过来访问
iptables -A INPUT -p tcp --dport 80 -j ACCEPT #允许ping服务
iptables -A INPUT -p icmp --icmp-type 8 -j ACCEPT #允许长连接访问(必须是tcp和udp及其他协议都允许的,否则光tcp则不行,yum都无法运行!!!)
iptables -A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT #限制某个单独ip访问
iptables -I INPUT -p tcp -s 146.56.32.147 --dport 80 -j DROP #保存防火墙:
service iptables save
iptables-save >/bb.txt

centos-iptables-scripts的更多相关文章

  1. mac pfctl / centos iptables 使用

    mac使用pfctl 为了测试zk client的重连功能,需要模拟zk client与zk server网络连接出现问题的情况,经过查询资料发现可以使用防火墙阻止zk server启动端口上的流量实 ...

  2. Centos iptables防火墙关闭启动详解

    CentOS .0默认使用的是firewall作为防火墙,使用iptables必须重新设置一下 .直接关闭防火墙 systemctl stop firewalld.service #停止firewal ...

  3. CentOS iptables防火墙的基本应用讲解

    iptables是Linux下不错的防火墙软件,本文主要给大家介绍下iptables的安装.规则增加和清除.开放指定端口.屏蔽指定ip和ip段等CentOS下iptables的基本应用. 一.ipta ...

  4. centos iptables

    1.查看本机关于IPTABLES的设置情况iptables -L -niptables --listmore /etc/sysconfig/iptablesservice iptables statu ...

  5. [daily][centos][iptables][firewalld] firewalld的初步了解

    CentOS7中默认使用firewalld代替了iptables . 接下来将对firewalld, 做一些初步的了解. 首先读一下, redhat的文档: https://access.redhat ...

  6. 【服务器防护】centos iptables 防火墙设置 mac过滤

    1.阻止MAC地址为XX:XX:XX:XX:XX:XX主机的所有通信: iptables -A INPUT -s 192.168.1.21 -m mac --mac-source XX:XX:XX:X ...

  7. centos IPTables 配置方法

    entos IPTables 配置方法 http://os.51cto.com/art/201103/249359_1.htm iptables 指南 1.1.19 http://www.frozen ...

  8. Centos iptables防火墙设置

    iptables的基本语法格式 iptables [-t 表名] 命令选项 [链名] [条件匹配] [-j 目标动作或跳转]说明:表名.链名用于指定iptables命令所操作的表和链,命令选项用于指定 ...

  9. centos iptables关于ping

    配置iptables策略后,一般来说INPUT都是DROP然后配置需要通过的 当执行: iptables -P INPUT DROP 后,机器就不能被ping通了! 因为icmp没有添加到规则中! 于 ...

  10. centos iptables 数据转发

    iptables -t nat -I PREROUTING -p tcp --dport 3389 -j DNAT --to 38.X25.X.X02 iptables -t nat -I POSTR ...

随机推荐

  1. C# XMLOperate

    using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.X ...

  2. Aperture Time与NPLC

    NPLC工频周期数 NPLC是采样电源的周期倍数,N代表是多少倍,PLC与采样电源有关 交流电源的干扰是很厉害的.为了减少交流电源的干扰,一个常用的方法就是把测量周期尽可能的取成交流周波的整数倍,这样 ...

  3. python pip的安装流程,以及使用pip更新,卸载第三方模块

    在Python的学习过程中,肯定会遇到很多安装模块的地方,可以使用easy_install安装,但是easy_install相对于pip而言,最大的缺陷就是它所安装的模块是不能够卸载的,其他功能是和p ...

  4. TOTP:Time-based One-time Password Algorithm(基于时间的一次性密码算法)

    TOTP:Time-based One-time Password Algorithm(基于时间的一次性密码算法) TOTP - Time-based One-time Password Algori ...

  5. WebIM技术---编写前端WebSocket组件

    过去我们想要实现一个实时Web应用通常会考虑采用ajax轮循或者是long polling技术,但是因为频繁的建立http连接会带来多余的请求以及消息精准性的问题,让我们在实现实时Web应用时头疼不已 ...

  6. js和jquery获取屏幕的高度

    Javascript: 网页可见区域宽: document.body.clientWidth网页可见区域高: document.body.clientHeight网页可见区域宽: document.b ...

  7. 微信JS-SDK文档

    微信JS SDK 调用详解   微信JS SDK 调用详解... 1 概述... 2 使用说明... 2 接口调用说明... 4 基础接口... 4 判断当前客户端版本是否支持指定JS接口... 5 ...

  8. JS调用asp.net后台方法:PageMethods

    先帮朋友宣传一下程序人生(http://www.manong123.com)的网站,里面都是开发感悟,开发人员创业,支持一下吧~ 原来是通过PageMethods来实现的. 举个列子: Default ...

  9. 测试网站访问速度的方法(GTmetrix)

     全方位的免费网站速度测试工具 — GTmetrix 它结合了Google Page Speed和Yahoo! YSlow的网页速度测试功能,并且提供可行的建议帮你改善网站速度.会根据网站的具体情况, ...

  10. TensorFlow基础笔记(3) cifar10 分类学习

    TensorFlow基础笔记(3) cifar10 分类学习 CIFAR-10 is a common benchmark in machine learning for image recognit ...