1. 前提条件

iptables >= 1.4.5

kernel-devel >= 3.7

2.  安装依赖包

 代码如下 复制代码
# yum install gcc gcc-c++ make automake unzip zip xz kernel-devel-`uname -r` iptables-devel perl-Text-CSV_XS

3.  安装xtables-addons

 代码如下 复制代码

# wget http://sourceforge.net/projects/xtables-addons/files/Xtables-addons/2.3/xtables-addons-2.3.tar.xz/download

# xz -d xtables-addons-2.3.tar.xz

# tar xvf xtables-addons-2.3.tar

# cd xtables-addons-2.3

# ./configure

# make

# make install

4. geoip相关套件

 代码如下 复制代码

# cd geoip

# ./xt_geoip_dl   www.111cn.net

# ./xt_geoip_build GeoIPCountryWhois.csv

# mkdir -p /usr/share/xt_geoip/

# cp -rp {BE,LE} /usr/share/xt_geoip/

5. 编写iptables规则。如拒绝台湾地区IP

 代码如下 复制代码

# iptables -I INPUT -m geoip --src-cc TW -j DROP

 

linux中利用iptables+geoip过滤指定IP的更多相关文章

  1. linux下通过iptables只允许指定ip地址访问指定端口的设置方法

    这篇文章主要介绍了linux下通过iptables只允许指定ip地址访问指定端口的设置方法,需要的朋友可以参考下. 首先,清除所有预设置 iptables -F#清除预设表filter中的所有规则链的 ...

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

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

  3. Linux中的iptables防火墙策略

    0x01 简介 iptables其实不是真正的防火墙,我们可以把它理解成一个客户端代理,用户通过iptables这个代理,将用户的安全设定执行到对应的"安全框架"中,这个" ...

  4. linux 中使用iptables 防止ddocs及cc攻击配置 。

    #防止SYN攻击,轻量级预防 iptables -N syn-floodiptables -A INPUT -p tcp –syn -j syn-floodiptables -I syn-flood ...

  5. iptables只允许指定ip地址访问指定端口

    首先,清除所有预设置 iptables -F#清除预设表filter中的所有规则链的规则 iptables -X#清除预设表filter中使用者自定链中的规则 其次,设置只允许指定ip地址访问指定端口 ...

  6. iptables只允许指定ip访问本机的指定端口

    首先,清除所有预设置 iptables -F 其次,设置只允许指定ip地址访问指定端口 1.在tcp协议中,禁止所有的ip访问本机的1521端口. iptables -I INPUT -p tcp - ...

  7. c#中HttpWebRequest使用Proxy实现指定IP的域名请求

    原文:http://www.cnblogs.com/greenerycn/archive/2010/04/11/httpwebreques_host_modify_By_set_proxy.html ...

  8. Linux中利用crontab创建计划任务

    在linux中启动crontab服务: /etc/init.d/crond  start crontab的命令格式 crontab -l   显示当前的crontab 文件(默认编写的crontab文 ...

  9. Linux中利用grep命令如何检索文件内容详解

    前言 Linux系统中搜索.查找文件中的内容,一般最常用的是grep命令,另外还有egrep命令,同时vi命令也支持文件内容检索.下面来一起看看Linux利用grep命令检索文件内容的详细介绍. 方法 ...

随机推荐

  1. hdu 4740 The Donkey of Gui Zhou bfs

    The Donkey of Gui Zhou Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.hdu.edu.cn/showproble ...

  2. scu 4436: Easy Math 水题

    4436: Easy Math Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.scu.edu.cn/soj/problem.actio ...

  3. ProgressBarLayoutView

    https://github.com/alter-ego/ProgressBarLayoutView

  4. Center OS jdk tomcat安装

    一.jdk安装 1.下载jdk    jdk-6u26-linux-i586-rpm.bin    2  安装jdk    #sh jdk-6u26-linux-i586-rpm.bin 3.#set ...

  5. 用Systemtap探索MySQL

    http://www.actionsky.com/docs/archives/168#Systemtap 目录 1 Systemtap 2 Systemtap 观测点的支持程度 2.1 官方编译的My ...

  6. Windows内存管理和linux内存管理

    windows内存管理 windows 内存管理方式主要分为:页式管理,段式管理,段页式管理. 页式管理的基本原理是将各进程的虚拟空间划分为若干个长度相等的页:页式管理把内存空间按照页的大小划分成片或 ...

  7. Golang学习 - errors 包

    ------------------------------------------------------------ Go 语言使用 error 类型来返回函数执行过程中遇到的错误,如果返回的 e ...

  8. 在加载模块时出现cannot insert '*.ko': Device or resource busy错误

    制作了一个模块,在加载是出现了cannot insert '*.ko': Device or resource busy错误. 原因: 是由于模块使用的是静态分配设备号,而这个设备号已经被系统中的其他 ...

  9. CSS 之 内层div填充margin,外层div的背景色不会覆盖该margin

    外层元素(如div)中只有一个非空子元素,此时margin是被折叠了.两者之间取最大的margin值,表现在外层父元素上,而不是内层子元素. 注意: (1)只有垂直方向上才会出现此现象,水平方向不会出 ...

  10. Youth(青春)

    Youth is not a time of life; it is a state of mind; it is not a matter of rosy cheeks, red lips and ...