How to block an IP using iptables?

iptables -A INPUT -s xx.xx.xx.xx -j DROP

How to block an IP for a specific port:

iptables -A INPUT -p tcp -s xx.xx.xx.xx --dport PORT -j DROP

How to allow access to an IP?

iptables -A INPUT -s xx.xx.xx.xx -j ACCEPT

How to allow access to an IP to a specific port using iptables?

iptables -A INPUT -p tcp -s xx.xx.xx.xx --dport PORT -j ACCEPT

where, xx.xx.xx.xx is the remote IP address and PORT is the port number you wish to allow/deny access to.

How to block a scanner on your server for example “w00tw00t.at.ISC.SANS” using iptables?

iptables -I INPUT -p tcp --dport 80 -m string --algo bm --string 'GET /w00tw00t.at.ISC.SANS.' -j DROP

Quick How-To deny/allow IP using iptables的更多相关文章

  1. ip route,ip rule, iptables和docker的端口映射

    iptables 默认5个表, 不可增加其他表 raw 用于配置数据包,raw 中的数据包不会被系统跟踪. filter 是用于存放所有与防火墙相关操作的默认表. nat 用于 网络地址转换(例如:端 ...

  2. nginx安全:配置allow/deny控制ip访问(ngx_http_access_module)

    一,nginx中allow/deny指令的用途 1, Nginx的deny和allow指令是由ngx_http_access_module模块提供, Nginx安装默认内置了该模块 2, nginx访 ...

  3. nginx deny 封IP

    官方文档地址:http://nginx.org/en/docs/http/ngx_http_access_module.html#deny Syntax: deny address | CIDR | ...

  4. Linux 使用 iptables屏蔽IP段

    netfilter/iptables IP 信息包过滤系统是一种功能强大的工具,可用于添加.编辑和除去规则,这些规则是在做信息包过滤决定时,防火墙所遵循和组成的规则.这些规则存储在专用的信息包过滤表中 ...

  5. linux使用iptables屏蔽ip地址

    一.iptables命令介绍: netfilter/iptables(简称为iptables)组成Linux平台下的包过滤防火墙,与大多数的Linux软件一样,这个包过滤防火墙是免费的,在安装系统的时 ...

  6. iptables rule

    和H3C中的acl很像,或者就是一会事,这就是不知道底层的缺陷,形式一变,所有的积累都浮云了 参考准确的说copy from http://www.ibm.com/developerworks/cn/ ...

  7. 第8章 Iptables与Firewalld防火墙

    章节简述: 红帽RHEL7系统已经用firewalld服务替代了iptables服务,新的防火墙管理命令firewall-cmd与图形化工具firewall-config. 本章节基于数十个防火墙需求 ...

  8. The Beginner’s Guide to iptables, the Linux Firewall

    Iptables is an extremely flexible firewall utility built for Linux operating systems. Whether you’re ...

  9. Nginx网站使用CDN之后禁止用户真实IP访问的方法

    做过面向公网WEB的运维人员经常会遇见恶意扫描.拉取.注入等图谋不轨的行为,对于直接对外的WEB服务器,我们可以直接通过 iptables .Nginx 的deny指令或是程序来ban掉这些恶意请求. ...

随机推荐

  1. Jmeter函数引用和函数重定向【转】

    在jmeter中的[选项]中选择[函数助手对话框]---这些函数可以高速有效的帮助我们开展自动化编写与校验!!!!!! 如图: 重点!!!本章的侧重点不讲函数的具体使用,函数具体的使用与java类似, ...

  2. 二创建maven父子项目

    关于maven中的parent聚合一直都有没好好总结,固有这篇. ------------------------------------------------------------------- ...

  3. java Response 设置中文编码

    response.setHeader("Content-type", "text/html;charset=UTF-8"); response.setChara ...

  4. Luogu P2107 小Z的AK计划 堆贪心

    好久不做这种题了... 存一下每个点的位置和时间,由于达到某个位置跟之前去哪里AK的无关,所以在时间超限后,可以用大根堆弹掉之前消耗时间最大的,来更新答案,相当于去掉之前花费最大的,直到时间不在超限. ...

  5. 江西财经大学第一届程序设计竞赛 D

    链接:https://www.nowcoder.com/acm/contest/115/D来源:牛客网 题目描述 事情,是这样的. 有这么一天双休日的中午. 我刚把我衣服扔进了洗衣机,然后拿了个小板凳 ...

  6. 2015苏州大学ACM-ICPC集训队选拔赛(2)1002

    草爷要的雷 Problem Description 扫雷一直是风靡实验室的重要娱乐游戏,在赛前赛后.刷题疲惫的时候,扫一局雷经常可以让队员们感受到身心的振奋,毕竟,劳逸结合刷题,防猝死才是硬道理.但是 ...

  7. Codeforces Round #334(div.2)(新增不用二分代码) B

    B. More Cowbell time limit per test 2 seconds memory limit per test 256 megabytes input standard inp ...

  8. hdu1387 模拟队列

    Team Queue Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Su ...

  9. BigDecimal取整

    Java中BigDecimal取整方法 BigDecimal bd = new BigDecimal("12.1"); long l = bd.setScale( 0, BigDe ...

  10. java——简易版build模式

    参考教程:https://blog.csdn.net/fanxudonggreat/article/details/78927773 public class Computer { private S ...