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. 我的Android进阶之旅------>Android系统设置默认来电铃声、闹钟铃声、通知铃声

    首先了解Android系统本身提供的默认铃声文件,这些文件都放在  /system/media/audio  文件夹下. /system/media/audio/ringtones   系统来电铃声 ...

  2. JAX-WS HandlerChain使用具体解释

    JAX-WS的Handler和Servlet的Filter相似,能够对全部WebServicer进行拦截,在Handler中能够记录日志.权限控制.对请求的SOAP消息进行加密.解密等.JAX-WS提 ...

  3. hibernate 中HQL查询

    由于比较简单,在此处只写一些HQL语言. 表关系,多对一. CREATE TABLE `user` ( `id` ) NOT NULL AUTO_INCREMENT, `uname` varchar( ...

  4. Refresh Tokens: When to Use Them and How They Interact with JWTs

    In this post we will explore the concept of refresh tokens as defined by OAuth2. We will learn why t ...

  5. unity, GUI.Button texture is black

    GUI.Button(rect,tex),结果显示出来tex是黑的,原来是因为我以前在别处调用了GUI.contentColor =Color.black. 参考:http://answers.uni ...

  6. c++,当const char*为0时,不能将其直接赋给string

    下面程序会崩溃: const char* t_objName = (obj!=NULL)?obj->getName(): 0; string objName=t_objName; cout< ...

  7. jquery操作复选框(checkbox)十二技巧

    jquery操作复选框(checkbox)的12个小技巧. 1.获取单个checkbox选中项(三种写法)$("input:checkbox:checked").val()或者$( ...

  8. beans.xml的用法

    beans.xml <?xml version="1.0" encoding="UTF-8" ?> <beans xmlns="ht ...

  9. SAP ECC6安装系列二:安装前的准备工作

    原作者博客 http://www.cnblogs.com/Michael_z/ ======================================== 安装 Java  1,安装 Java, ...

  10. iTunes历史各个版本下载地址

    地址:http://www.oldapps.com/itunes.php