依赖 libpcap 线上服务器安装 https://github.com/session-replay-tools/tcpcopy.git ./configure --prefix=/usr/local/tcpcopy --pcap-capturemake && make install 辅助服务器安装 https://github.com/session-replay-tools/intercept.git 下载后解压 ./configure --prefix=/usr/local/intercept make && make install 1.同网段环境 192.168.1.2 线上服务器 192.168.1.3 测试服务器(可以将辅助服务安装到测试服务上面) 192.168.1.4 辅助服务器 #启动辅助服务192.168.1.4 /usr/local/intercept/sbin/intercept -i eth0 -F 'tcp and src port 8055' -d 192.168.1.2 #复制流量-c修改访问的ip /usr/local/tcpcopy/sbin/tcpcopy -F 'tcp and dst port 8055' -x 8055-192.168.1.3:8055 -s 192.168.1.4 -c 172.16.55.x -d 192.168.1.3 #静态路由,将172.16.55的包全部转到辅助服务器 route add -net 172.16.55.0 netmask 255.255.255.0 gw 192.168.1.4 2.跨网段 192.168.66.214 线上服务器 192.168.72.28 辅助服务器(可以将辅助服务安装到测试服务上面) 192.168.72.17 测试服务器(必须和辅助服务器同网段) /usr/local/tcpcopy/sbin/intercept -i eth0 -F tcp and src port 10054 -d #启动转发服务192.168.72.17 #复制流量-c 包装为tcpcopy服务器上的网段ip,不能是和192.168.2.2通讯的ip,所以这里包装为192.168.100.x /usr/local/tcpcopy/sbin/tcpcopy -x 10054-192.168.72.17:10054 -s 192.168.72.28 -c 192.168.100.x -d #测试服务器添加路由 |
|
来自: jas0n_liu > 《linux系统&服务》