Comcast是一个用来模拟各种常用的网络问题的工具,例如延迟、带宽限制以及丢包等等问题。
Comcast使用可移植的方式封装了各种系统工具,例如ipfw和pfctl来注入网络通信失败问题。
安装$gogetgithub.com/tylertreat/comcast使用在Linux中 Comcast支持很多选项,包括设备、延迟、目标、默认带宽、丢包、协议和端口等。
$comcast--device=eth0--latency=250--target-bw=1000--default-bw=1000000--packet-loss=10%--target-addr=8.8.8.8,10.0.0.0/24--target-proto=tcp,udp,icmp--target-port=80,22,1000:2000OnOSX,Comcastwillcheckfor pfctl support(asofYosemite),whichsupportsthesameoptionsasabove.If pfctl isnotavailable,itwilluse ipfw instead,whichsupportsdevice,latency,targetbandwidth,andpacket-lossoptions.
OnBSD(with ipfw),Comcastcurrentlysupportsonly:device,latency,targetbandwidth,andpacketloss.
$comcast--device=eth0--latency=250--target-bw=1000--packet-loss=10%Thiswilladd250msoflatency,limitbandwidthto1Mbps,anddrop10%ofpacketstothetargetted(onLinux)destinationaddressesusingthespecifiedprotocolsonthespecifiedportnumbers(slowlane).Thedefaultbandwidthspecifiedwillapplytoallegresstraffic(fastlane).Toturnthisoff,runthefollowing:
$comcast--stopBydefault,comcastwilldeterminethesystemcommandstoexecute,logthemtostdout,andexecutethem.The --dry-run flagwillskipexecution.
评论