iptables 只拒绝某个ip的所有连接
来源:互联网 发布:centos终端能输入中文 编辑:程序博客网 时间:2024/04/30 11:13
linux下IPTABLES配置详解如果你的IPTABLES基础知识还不了解,建议先去看看.开始配置我们来配置一个filter表的防火墙.(1)查看本机关于IPTABLES的设置情况[root@tp ~]# iptables -L -nChain INPUT (policy ACCEPT)target prot opt source destination Chain FORWARD (policy ACCEPT)target prot opt source destination Chain OUTPUT (policy ACCEPT)target prot opt source destination Chain RH-Firewall-1-INPUT (0 references)target prot opt source destination ACCEPT all -- 0.0.0.0/0 0.0.0.0/0 ACCEPT icmp -- 0.0.0.0/0 0.0.0.0/0 icmp type 255 ACCEPT esp -- 0.0.0.0/0 0.0.0.0/0 ACCEPT ah -- 0.0.0.0/0 0.0.0.0/0 ACCEPT udp -- 0.0.0.0/0 224.0.0.251 udp dpt:5353 ACCEPT udp -- 0.0.0.0/0 0.0.0.0/0 udp dpt:631 ACCEPT all -- 0.0.0.0/0 0.0.0.0/0 state RELATED,ESTABLISHED ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 state NEW tcp dpt:22 ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 state NEW tcp dpt:80 ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 state NEW tcp dpt:25 REJECT all -- 0.0.0.0/0 0.0.0.0/0 reject-with icmp-host-prohibited 可以看出我在安装linux时,选择了有防火墙,并且开放了22,80,25端口.如果你在安装linux时没有选择启动防火墙,是这样的[root@tp ~]# iptables -L -nChain INPUT (policy ACCEPT)target prot opt source destination Chain FORWARD (policy ACCEPT)target prot opt source destination Chain OUTPUT (policy ACCEPT)target prot opt source destination 什么规则都没有.(2)清除原有规则.不管你在安装linux时是否启动了防火墙,如果你想配置属于自己的防火墙,那就清除现在filter的所有规则.[root@tp ~]# iptables -F 清除预设表filter中的所有规则链的规则[root@tp ~]# iptables -X 清除预设表filter中使用者自定链中的规则我们在来看一下[root@tp ~]# iptables -L -nChain INPUT (policy ACCEPT)target prot opt source destination Chain FORWARD (policy ACCEPT)target prot opt source destination Chain OUTPUT (policy ACCEPT)target prot opt source destination 什么都没有了吧,和我们在安装linux时没有启动防火墙是一样的.(提前说一句,这些配置就像用命令配置IP一样,重起就会失去作用),怎么保存.[root@tp ~]# /etc/rc.d/init.d/iptables save这样就可以写到/etc/sysconfig/iptables文件里了.写入后记得把防火墙重起一下,才能起作用.[root@tp ~]# service iptables restart现在IPTABLES配置表里什么配置都没有了,那我们开始我们的配置吧如何用 iptables 禁止某个ip?1、添加对 114.32.207.47 的过滤(直接 DROP 掉)iptables -I INPUT -s 114.32.207.47 -j DROP 2、检查设置是否正常iptables --listChain INPUT (policy ACCEPT)target prot opt source destination DROP all -- 114-32-207-47.HINET-IP.hinet.net anywhere Chain FORWARD (policy ACCEPT)target prot opt source destination Chain OUTPUT (policy ACCEPT)target prot opt source destination 单个IP的命令是 iptables -I INPUT -s 115.236.160.83 -j DROP
0 0
- iptables 只拒绝某个ip的所有连接
- iptables限制某个端口的连接数
- iptables允许某个ip访问
- iptables 限制指定ip的连接数
- 使用iptables屏蔽来自某个国家的IP
- iptables 必须先拒绝所有,在允许
- linux防火墙iptables封IP,拒绝指定IP和网段的办法
- 转载:AWK只打印某个域后的所有域
- iptables防火墙只允许指定ip连接指定端口、访问指定网站
- 搜索某个网段内所有在线IP的一串命令
- 嵌入式 使用iptables限制同一ip的连接数
- IPTABLES可以限制每个ip的最大连接数
- 动态检测secure日志文件,iptables拒绝恶意IP
- kill连接某个数据库的所有进程(Ms SqlServer)
- 用SQL语句断开某个数据库的所有活动连接
- SQL SERVER 2008 删除某个数据库的所有连接进程
- SQL清除某个数据库的所有数据库连接
- 查询使用某个用户连接到数据库的所有客户端
- xml和json相互转换的代码
- stm32Flash模拟eeprom心得(原创)
- OJ 嘻刷刷 我想放假
- Qt Project Build error PRJ0019: 工具从"Moc'ing xxx.h..."
- NSDictionary或NSArray与JSON字符串相互转换
- iptables 只拒绝某个ip的所有连接
- settimeout计时器实例
- Guess3
- habernate注解模式多表关联
- 贴片电容器容量怎么换算?
- Linux中查看CPU信息
- 2012年5月SAT香港真题解析
- ie6中li插入图片后下方有空隙(经典bug)多种解决方法
- 双链表创建(尾插法)