参考文档:https://github.com/session-replay-tools/tcpcopy
辅助机器Assistant Server:
1、下载最新版本
git clone git://github.com/session-replay-tools/intercept.git
2、安装intercept
缺少libpcap:
checking for pcap.h ... not found
安装libpcap:
1)Libpcap下载: 官方地址-http://www.tcpdump.org/#latest-release 即可下载最新版本的libpcap。
2)解压libpcap-1.9.0.tar: tar -xvf libpcap-1.9.0.tar
3)配置生成makefile文件:cd到libpcap解压目录libpcap-1.4.0, 执行 ./configure。执行到这一步可能会遇到缺少flex包的问题:
checking for flex... no
checking for lex... no
configure: error: Neither flex nor lex was found.
解决办法:安装flex包---- sudo apt-get install flex
再次./configure, 遇到 缺少 YACC的错误
checking for capable yacc/bison... insufficient
configure: error: yacc is insufficient to compile libpcap.
libpcap requires Bison, a newer version of Berkeley YACC with support
for reentrant parsers, or another YACC compatible with them.
解决办法:安装byacc包--- sudo apt-get install -y byacc
4) make
5) make install
线上服务器 Online Server:
1、下载最新版本
git clone git://github.com/session-replay-tools/tcpcopy.git
安装成功后
cd tcpcopy
./configure
make
make install
2、运行TCPCopy
//如果发起请求的客户端ip地址来自于其它网段的话
利用tcpcopy的-c参数,修改客户端源ip地址,这样就方便设置路由
比如:./tcpcopy -x 11311-10.100.10.31:11511 -s 10.100.10.32 -c 192.168.100.x
相应路由设置:
route add -net 192.168.100.0 netmask 255.255.255.0 gw 10.100.10.32
route add -net xxx.xxx.xxx.0 netmask 255.255.255.0 gw 辅助服务器的ip地址
tcpcopy参数的含义:
./tcpcopy -x 线上服务器监听端口号-测试服务器ip地址:测试服务器监听端口
遇到的问题:
如果提示服务器未安装git,则执行:
apt-get install git
提示有些包not found,然后会有建议:apt-get update