Chinaunix首页 | 论坛 | 博客
  • 博客访问: 517259
  • 博文数量: 110
  • 博客积分: 3971
  • 博客等级: 中校
  • 技术积分: 1175
  • 用 户 组: 普通用户
  • 注册时间: 2006-06-20 23:27
文章分类

全部博文(110)

文章存档

2015年(2)

2014年(1)

2013年(1)

2011年(9)

2010年(28)

2009年(12)

2008年(13)

2007年(23)

2006年(21)

我的朋友

分类: WINDOWS

2008-07-02 11:55:48

linux如何做到port mirror
使用iptables的patch-o-matic extra repository内的ROUTE模组.以下以Gentoo为例说明如何安装

1.从ftp下载最新的patch-0-matic snapshot


2.解压缩tar -xjvf patch-o-matic-ng-20080521.tar.bz2

3.必须先确保你现在安装的iptables有启用extensions的USE参数(等等ebuild会来参考)

4.执行ebuild `equery w iptables` unpack (会自动下载并解压缩iptables)

5.到刚刚解压缩的patch-o-matic-ng资料夹

6.执行./runme –download

7.然后她会一个一个问你是否要安装每一个模组如果只需要ROUTE,可以改下指令./runme –download ROUTE
接下来他会问你kernel和iptables所在路径
程式码:
 # ./runme -download ROUTE 
b] Where is your kernel source directory? [/usr/src/linux] [b](Gentoo预设路径就在此
firewall/iptables-1.4.0-r1/work/iptables-1.4.0/ [b](这是刚刚上面unpack后的地方,也就是iptables的原始码)[/b]
8.现在kernel和iptables sources已经被patch了,接下来就是到kernel中把需要的模组编译进来

9. # cd /usr/src/linux

10. # make menuconfig

11 .刚刚的ROUTE在Networking -> Networking supporttem support -> Networking options ->
Network packet filtering framework (Netfilter) -> IP: Netfilter Configuration -> 最下面多出ROUTE target support,把他M起來吧 Network packet filtering framework (Netfilter) -> IP: Netfilter Configuration ->最下面多出ROUTE target support,把他M起来吧

12.接下来重新编译并安装新的模组

13. # make modules modules_install

14.接下来编译并安装iptables

15. # ebuild `equery w iptables` install
# ebuild `equery w iptables` qmerge

安裝完成安装完成

接下來使用說明: 接下来使用说明:
擷取網站說明撷取网站说明
引用引用
ROUTE target options: ROUTE target options:
--oif ifname Send the packet out using `ifname' network interface.
--iif ifname Change the packet's incoming interface to `ifname'.
 --gw ip Route the packet via this gateway.
--continue Route the packet and continue traversing the rules.
--tee Route a copy of the packet, but continue traversing
the rules with the original packet, undisturbed.
 
所以就以上只要下兩個指令就可以了所以就以上只要下两个指令就可以了
程式碼:程式码:
 iptables -A PREROUTING -t mangle -j ROUTE --gw 192.168.1.50 --tee
 iptables -A POSTROUTING -t mangle -j ROUTE --gw 192.168.1.50 --tee

阅读(2048) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~