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 提供了包 ...
随机推荐
- MongoDB学习笔记—Linux下搭建MongoDB环境
1.MongoDB简单说明 a MongoDB是由C++语言编写的一个基于分布式文件存储的开源数据库系统,它的目的在于为WEB应用提供可扩展的高性能数据存储解决方案. b MongoDB是一个介于关系 ...
- js去掉字符串的空格
//去左空格; function ltrim(s){ return s.replace(/(^s*)/g, ""); } //去右空格; function rtrim(s){ re ...
- 网页中tab标签切换分别用jquery和javascript源码实现
//HTML布局<ul id="tabTitle"> <li class="active">HTML5</li> <l ...
- HTML5学习笔记二 HTML基础
一.HTML 标题 HTML 标题(Heading)是通过<h1> - <h6> 标签来定义的. <h1>标题一</h1> <h2>标题二& ...
- Atitit.常见软件 数据 交换格式 标准
Atitit.常见软件 数据 交换格式 标准 1. 常见的数据格式txt ,doc ,pic,music ,vodio1 2. 通用格式json yaml phpstr1 3. 专用格式1 4. 用户 ...
- Sharepoint学习笔记—习题系列--70-576习题解析 -(Q124-Q127)
Question 124 You are designing a SharePoint 2010 application. You need to design a single feature t ...
- iOS之There was an internal API error错误
There was an internal API error. 错误原因:把Product Name作为程序名称,程序名称错乱 解决方法:检查Product Name, 不要包含中文以及特殊字符.在 ...
- xp系统下硬盘安装centos6.5
引言: 电脑系统是Windows XP,电脑没有光驱.手头没有U盘.没有移动硬盘.电脑主板不支持U盘启动,在这种情况下想安装CentOS 6.0,有木有办法? 答案:有办法,请看下面教程! 必备工具: ...
- 活用UML-软件设计高手(广州 2014年6月14-15日)
我们将在广州为您奉献高级技术课程”活用UML-软件设计高手“,首席专家张老师将会为您分享软件架构设计.数据库设计.用户体验设计及详细设计的最佳实践,帮助您成为优秀的软件设计师! 时间:2014.06. ...
- 如何查看Windows服务器运行了多长时间
前言:有时候管理.维护Windows服务器需要定期重启服务器(为什么需要重启,你懂的),但是这个"定期"有时候会受很多因素影响,例如某台服务器忘了重启:某台服务器那个时间段业务繁忙 ...