iptables能够做什么
前言
在这两篇博文中已经具体分析了iptable的原理和在openwrt里面的实例
http://www.cnblogs.com/tanhangbo/p/4550455.html
http://www.cnblogs.com/tanhangbo/p/4518254.html
可以概括出iptables/Netfilter 这一套系统就是用户空间可控的在内核空间的一套钩子
下面看看iptables究竟能做什么。
NAT
- 使用SNAT功能可以将内网IP转换为公网IP,实现在外部的Ethernet口上面
- 封包出在post routing上面将内网ip转换为公网ip
- 封包进在pre routing上面将公网ip转换为内网的ip
- 注意到Netfilter会标记这个状态,不然回来的包会找不到源头。
- 使用DNAT功能可以实现DMZ主机的功能,实现在外部的Ethernet口上面
- 封包进在pre routing上面将公网ip转换为内网指定的DMZ主机的ip
- 封包出去时在post routing上面将内网的数据包发送到对应的源主机。
防火墙
- 可以根据ip、MAC地址、端口、协议来丢弃某些数据包,比如internet上面有人想连接到本机的SSH,那么对外部接口关闭SSH的端口22就可以起到一些作用。
负载均衡
注意到下面的选项:
Thismodule matches every 'n'th packet--every valueMatch every 'value' packet[--counter num]Useinternal counter number 'num'.Defaultis'0'.[--start num]Initialize the counter at the number 'num' insetad of '0'.Most between '0'and'value'-1.[--packet num]Match on 'num' packet.Most be between '0'and'value'-1.来源: http://linux.die.net/man/8/iptables
BALANCEThis allows you to DNAT connections in a round-robin way over a given range of destination addresses.--to-destination ipaddr-ipaddrAddress range to round-robin over.
这里有两个做法不同的例子:
http://www.cnblogs.com/silenceli/p/3569849.html
http://wjw465150.iteye.com/blog/423704
防止DDOS攻击
参考此文:
http://sookk8.blog.51cto.com/455855/321242
日志功能
用户空间日志:
ULOGThis target provides userspace logging of matching packets.Whenthis target issetfor a rule, the Linux kernel will multicast this packet through a netlink socket.Oneor more userspace processes may then subscribe to various multicast groups and receive the packets.Like LOG,thisis a "non-terminating target", i.e. rule traversal continues at the next rule.
内核日志:
LOGTurn on kernel logging of matching packets.Whenthis option issetfor a rule, the Linux kernel will print some information on all matching packets (like most IP header fields) via the kernel log (where it can be read with dmesg or syslogd(8)).Thisis a "non-terminating target", i.e. rule traversal continues at the next rule.Soif you want to LOG the packets you refuse,use two separate rules with the same matching criteria, first using target LOG then DROP (or REJECT).
参考资料:
http://linux.die.net/man/8/iptables
iptables能够做什么的更多相关文章
- 使用iptables做端口转发
通过iptables可以做转发 #!/bin/sh IPT="/sbin/iptables" /bin/echo "1" > /proc/sys/net/ ...
- iptables rule
和H3C中的acl很像,或者就是一会事,这就是不知道底层的缺陷,形式一变,所有的积累都浮云了 参考准确的说copy from http://www.ibm.com/developerworks/cn/ ...
- squid透明代理+iptables防火墙,多网卡详细配置
squid透明代理+iptables防火墙详细配置 看到很多人都在不停地问iptables+squid做透明代理的问题,鄙人不才,斗胆在此做统一解答.如有任何纰漏还望各位批评指教. ========= ...
- iptables初探
一,前言 本来想起个名字叫做"小白都是怎么学习iptables的?"或者"你为什么还不了解iptables?"等等,就像简书上的头条文章,虽然被说成" ...
- linux iptables规则介绍
今天又学习了一下iptables,做一点总结来方便以后查阅. Netfilter(网络过滤器)是Linux操作系统核心层内部的一个数据包处理模块,主要负责数据包的拦截和转发,而iptables是Net ...
- 使用iptables基于MAC地址进行访控
近日完成一台基于CentOS的SVN服务器配置,由于该服务器上的文件非常重要,仅部分用户需要访问,最后决定采用iptables来做访控,并且是根据MAC地址来限制,为了便于后期维护,防火墙的配置是通过 ...
- Iptables 指南 1.1.19
Iptables 指南 1.1.19 Oskar Andreasson oan@frozentux.net Copyright © 2001-2003 by Oskar Andreasson 本文在符 ...
- 15、iptables详解
-- http://www.netfilter.org/ http://www.iptables.org/ --参考路径 http://www.netfilter.org/docume ...
- iptables 及容器网络分析
本文独立博客阅读地址:https://ryan4yin.space/posts/iptables-and-container-networks/ 本文仅针对 ipv4 网络 iptables 提供了包 ...
随机推荐
- 关于在线编辑器的选择:tinymce - nilcms
一开始使用的是百度开发的编辑器:ueditor.使用方便,很容易就部署了.现在发现此编辑器也就做一些安全性的更新,而且对于这个编辑器也越来越不喜欢了. 1.臃肿.[1.4.3.3 PHP 版本].下载 ...
- Mysql(Mariadb) 基础操作语句 (持续更新)
基础SQL语句,记录以备查阅.(在HeiDiSql中执行) # 创建数据库 Create Database If Not Exists VerifyIdear Character Set UTF8; ...
- navigationController 返回前N个视图
前提是,由N个视图跳转过来的. //返回前n个 NSInteger index=[[self.navigationController viewControllers]indexOfObject:se ...
- 【百度文库课程】Java语言基础与OOP入门学习笔记一
一. Java的历史与由来 原名Oak,针对嵌入式系统开发设计,语法与C/C++基本一致 二. Java语言特点 Java由四方面组成:Java编程语言.Java类文件格式.Java虚拟机和Java应 ...
- 移动AD的计算机到对应的OU的powershell脚本
#//************************************************************* #//编辑人: #//编辑单位: #//编辑作用:移动计算机到对应的O ...
- ABAP程序互调用:SUBMIT、CALL TRANSACTION、LEAVE TO TRANSACTION
声明:原创作品,转载时请注明文章来自SAP师太技术博客( 博/客/园www.cnblogs.com):www.cnblogs.com/jiangzhengjun,并以超链接形式标明文章原始出处,否则将 ...
- 好用的第三方控件,Xcode插件(不断更新)
第三方控件类: 1.提示框 MBProgressHUD: 是一款非常强大的.提供多种样式的提示框.使用起来简单.方便.可以在GitHub上查看具体的使用方法. https://github.com ...
- 【Android】实现XML解析的几种技术
本文介绍在Android平台中实现对XML的三种解析方式. XML在各种开发中都广泛应用,Android也不例外.作为承载数据的一个重要角色,如何读写XML成为Android开发中一项重要的技能. 在 ...
- UITableview中怎么找到每个cell
一个朋友问我:我在每个cell中都添加了两个按钮(记为btnA和btnB),点击btnA时,对应的cell中添加一个子控件,再点击btnB时,对应的cell中的子控件就移除,怎么做到? 百度了一下,发 ...
- android 图片性能优化
本章讲述在android开发中,图片处理方面的优化.包括知识点为大图加载,图片压缩,图片缓存处理及开源图片处理框架Universal-Image-Loader. 1.图片引发的内存不足 当在andro ...