linux tcptraceroute tcpping安装使用

linux tcptraceroute tcpping安装使用1.首先安装依赖包libpcapyuminstall-ylibpcap2.下载tcptracerouterpm包,并安装rpm-ivhtcptraceroute-1.5-0.beta7.el6.rf.x86_64.rpmtcptraceroute121.46.29.1155810-n-q1tracerouteto121….

大家好,又见面了,我是你们的朋友全栈君。

1.首先安装依赖包libpcap yum install -y libpcap 2.下载tcptraceroute rpm包,并安装 rpm -ivh tcptraceroute-1.5-0.beta7.el6.rf.x86_64.rpm tcptraceroute 121.46.29.115 5810 -n -q 1 traceroute to 121.46.9.135 (121.46.9.135), 30 hops max, 60 byte packets 1 10.0.12.254 1.296 ms 2 10.1.3.250 2.478 ms 3 * 4 180.76.225.253 0.369 ms 5 182.61.255.2 4.030 ms 6 182.61.253.121 3.815 ms 7 182.61.253.163 1.516 ms 8 103.216.40.75 3.131 ms 9 121.46.29.115 <syn,ack> 35.470 ms tcpping脚本 vi tcpping.sh #!/bin/sh # # tcpping: test response times using TCP SYN packets # URL: http://www.vdberg.org/~richard/tcpping.html # # uses tcptraceroute from http://michael.toren.net/code/tcptraceroute/ # # (c) 2002-2005 Richard van den Berg <richard@vdberg.org> under the GPL # http://www.gnu.org/copyleft/gpl.html # # 2002/12/20 v1.0 initial version # 2003/01/25 v1.1 added -c and -r options # now accepting all other tcptraceroute options # 2003/01/30 v1.2 removed double quotes around backquotes # 2003/03/25 v1.3 added -x option, courtesy of Alvin Austin <alvin@crlogic.com> # 2005/03/31 v1.4 added -C option, courtesy of Norman Rasmussen <norman@rasmussen.org> # 2007/01/11 v1.5 catch bad destination addresses # 2007/01/19 v1.6 catch non-root tcptraceroute # 2008/02/10 v1.7 make -C work when reverse lookup fails, courtesy of Fabrice Le Dorze <Fabrice.LeDorze@apx.fr> ver="v1.7" format="%Y%m%d%H%M%S" d="no" c="no" C="no" ttl=255 seq=0 q=1 r=1 w=3 topts="" usage () { name=`basename $0` echo "tcpping $ver Richard van den Berg <richard@vdberg.org>" echo echo "Usage: $name [-d] [-c] [-C] [-w sec] [-q num] [-x count] ipaddress [port]" echo echo " -d print timestamp before every result" echo " -c print a columned result line" echo " -C print in the same format as fping's -C option" echo " -w wait time in seconds (defaults to 3)" echo " -r repeat every n seconds (defaults to 1)" echo " -x repeat n times (defaults to unlimited)" echo echo "See also: man tcptraceroute" echo } _checksite() { ttr=`tcptraceroute -f ${ttl} -m ${ttl} -q ${q} -w ${w} $* 2>&1` if echo "${ttr}" | egrep -i "(bad destination|got roo)" >/dev/null 2>&1; then echo "${ttr}" exit fi } _testsite() { myseq="${1}" shift [ "${c}" = "yes" ] && nows=`date +${format}` [ "${d}" = "yes" ] && nowd=`date` ttr=`tcptraceroute -f ${ttl} -m ${ttl} -q ${q} -w ${w} $* 2>/dev/null` host=`echo "${ttr}" | awk '{print $2 " " $3}'` rtt=`echo "${ttr}" | sed 's/.*] //' | awk '{print $1}'` not=`echo "${rtt}" | tr -d ".0123456789"` [ "${d}" = "yes" ] && echo "$nowd" if [ "${c}" = "yes" ]; then if [ "x${rtt}" != "x" -a "x${not}" = "x" ]; then echo "$myseq $nows $rtt $host" else echo "$myseq $nows $max $host" fi elif [ "${C}" = "yes" ]; then if [ "$myseq" = "0" ]; then echo -n "$1 :" fi if [ "x${rtt}" != "x" -a "x${not}" = "x" ]; then echo -n " $rtt" else echo -n " -" fi if [ "$x" = "1" ]; then echo fi else echo "${ttr}" | sed -e "s/^.*\*.*$/seq $myseq: no response (timeout)/" -e "s/^$ttl /seq $myseq: tcp response from/" fi # echo "${ttr}" } while getopts dhq:w:cr:nNFSAEi:f:l:m:p:s:x:C opt ; do case "$opt" in d|c|C) eval $opt="yes" ;; q|w|r|x) eval $opt="$OPTARG" ;; n|N|F|S|A|E) topt="$topt -$opt" ;; i|l|p|s) topt="$topt -$opt $OPTARG" ;; f|m) ttl="$OPTARG" ;; ?) usage; exit ;; esac done shift `expr $OPTIND - 1` if [ "x$1" = "x" ]; then usage exit fi max=`echo "${w} * 1000" | bc` if [ `date +%s` != "%s" ]; then format="%s" fi _checksite ${topt} $* if [ "$x" = "" ]; then while [ 1 ] ; do _testsite ${seq} ${topt} $* & pid=$! if [ "${C}" = "yes" ]; then wait $pid fi seq=`expr $seq + 1` sleep ${r} done else while [ "$x" -gt 0 ] ; do _testsite ${seq} ${topt} $* & pid=$! if [ "${C}" = "yes" ]; then wait $pid fi seq=`expr $seq + 1` x=`expr $x - 1` if [ "$x" -gt 0 ]; then sleep ${r} fi done fi exit :wq! chmod +x tcpping.sh [root@beijing012033 ~]# ./tcpping.sh 121.46.129.33 5810 traceroute to 121.46.129.33 (121.46.129.33), 255 hops max, 60 byte packets seq 0: tcp response from 121.46.129.33 (121.46.129.33) <syn,ack> 35.456 ms traceroute to 121.46.129.33 (121.46.129.33), 255 hops max, 60 byte packets seq 2: tcp response from 121.46.129.33 (121.46.129.33) <syn,ack> 35.456 ms traceroute to 121.46.129.33 (121.46.129.33), 255 hops max, 60 byte packets seq 1: tcp response from 121.46.129.33 (121.46.129.33) <syn,ack> 35.449 ms traceroute to 121.46.129.33 (121.46.129.33), 255 hops max, 60 byte packets seq 4: tcp response from 121.46.129.33 (121.46.129.33) <syn,ack> 35.519 ms traceroute to 121.46.129.33 (121.46.129.33), 255 hops max, 60 byte packets seq 5: tcp response from 121.46.129.33 (121.46.129.33) <syn,ack> 35.473 ms traceroute to 121.46.129.33 (121.46.129.33), 255 hops max, 60 byte packets seq 3: tcp response from 121.46.129.33 (121.46.129.33) <syn,ack> 35.470 ms traceroute to 121.46.129.33 (121.46.129.33), 255 hops max, 60 byte packets seq 7: tcp response from 121.46.129.33 (121.46.129.33) <syn,ack> 35.528 ms traceroute to 121.46.129.33 (121.46.129.33), 255 hops max, 60 byte packets seq 6: tcp response from 121.46.129.33 (121.46.129.33) <syn,ack> 35.479 ms traceroute to 121.46.129.33 (121.46.129.33), 255 hops max, 60 byte packets traceroute to 121.46.129.33 (121.46.129.33), 255 hops max, 60 byte packets seq 9: tcp response from 121.46.129.33 (121.46.129.33) <syn,ack> 35.478 ms seq 8: tcp response from 121.46.129.33 (121.46.129.33) <syn,ack> 35.516 ms traceroute to 121.46.129.33 (121.46.129.33), 255 hops max, 60 byte packets seq 10: tcp response from 121.46.129.33 (121.46.129.33) <syn,ack> 35.452 ms traceroute to 121.46.129.33 (121.46.129.33), 255 hops max, 60 byte packets seq 11: tcp response from 121.46.129.33 (121.46.129.33) <syn,ack> 35.529 ms traceroute to 121.46.129.33 (121.46.129.33), 255 hops max, 60 byte packets seq 12: tcp response from 121.46.129.33 (121.46.129.33) <syn,ack> 35.521 ms traceroute to 121.46.129.33 (121.46.129.33), 255 hops max, 60 byte packets seq 13: tcp response from 121.46.129.33 (121.46.129.33) <syn,ack> 35.404 ms traceroute to 121.46.129.33 (121.46.129.33), 255 hops max, 60 byte packets seq 14: tcp response from 121.46.129.33 (121.46.129.33) <syn,ack> 35.502 ms traceroute to 121.46.129.33 (121.46.129.33), 255 hops max, 60 byte packets seq 15: tcp response from 121.46.129.33 (121.46.129.33) <syn,ack> 35.514 ms traceroute to 121.46.129.33 (121.46.129.33), 255 hops max, 60 byte packets seq 17: tcp response from 121.46.129.33 (121.46.129.33) <syn,ack> 35.515 ms traceroute to 121.46.129.33 (121.46.129.33), 255 hops max, 60 byte packets seq 16: tcp response from 121.46.129.33 (121.46.129.33) <syn,ack> 35.462 ms traceroute to 121.46.129.33 (121.46.129.33), 255 hops max, 60 byte packets seq 18: tcp response from 121.46.129.33 (121.46.129.33) <syn,ack> 35.442 ms traceroute to 121.46.129.33 (121.46.129.33), 255 hops max, 60 byte packets seq 20: tcp response from 121.46.129.33 (121.46.129.33) <syn,ack> 35.518 ms traceroute to 121.46.129.33 (121.46.129.33), 255 hops max, 60 byte packets seq 19: tcp response from 121.46.129.33 (121.46.129.33) <syn,ack> 35.415 ms traceroute to 121.46.129.33 (121.46.129.33), 255 hops max, 60 byte packets seq 21: tcp response from 121.46.129.33 (121.46.129.33) <syn,ack> 35.453 ms traceroute to 121.46.129.33 (121.46.129.33), 255 hops max, 60 byte packets seq 22: tcp response from 121.46.129.33 (121.46.129.33) <syn,ack> 35.461 ms traceroute to 121.46.129.33 (121.46.129.33), 255 hops max, 60 byte packets seq 23: tcp response from 121.46.129.33 (121.46.129.33) <syn,ack> 35.462 ms traceroute to 121.46.129.33 (121.46.129.33), 255 hops max, 60 byte packets -d 打印本机每发出一个tcp包的当前时间戳 -c 打印一版纯数字的信息,可以用它来粘贴到excel表格 并制成延时抖动表 -C 另一种格式的纯数字制表信息 -w 设置等待时间(秒) 默认为3秒 -r 设置不管有无tcp包回复,本机间隔多少时间重复发送tcp握手包 这个那啥,可以用作ddos哦?! -x 设置本机发送多少次tcp包,默认为空 即无限制重复发送

 

转载于:https://www.cnblogs.com/vincent-liang/p/8528279.html

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。

发布者:全栈程序员-用户IM,转载请注明出处:https://javaforall.cn/151485.html原文链接:https://javaforall.cn

【正版授权,激活自己账号】: Jetbrains全家桶Ide使用,1年售后保障,每天仅需1毛

【官方授权 正版激活】: 官方授权 正版激活 支持Jetbrains家族下所有IDE 使用个人JB账号...

(0)


相关推荐

  • Spring AOP 实现监控方法执行的时间(统计service中方法执行的时间)

    项目中有时候会遇到统计方法执行的时间,来对项目进行优化!下面是我自己在工作中遇到的问题,和我自己的解决方法。要统计出项目中方法执行时间大于1秒的那些方法!我们的项目开发使用的是SpringMVC 那么首先想到使用 Aop Aspet 切面统计,那样子更加方便也高效。1:打开切面!因为项目使用的SpringMVC,项目中的配置文件就配置的 &lt;aop:aspectj-autoproxy …

  • VSCode设置中文语言显示

    VSCode设置中文语言显示 Vscode是一款开源的跨平台编辑器。默认情况下,vscode使用的语言为英文(us),如何将其显示语言修改成中文了?1)打开vscode工具;2)使用快捷键组合【Ctrl+Shift+p】,在搜索框中输入“configuredisplaylanguage”,点击确定后;3)修改locale.json文件下的属性“locale”为“zh-CN”;4)重启vscode工具;…

  • windows10修改host文件_手机修改hosts文件

    windows10修改host文件_手机修改hosts文件Windows修改host文件在实际的开发中,有时我们会修改windows的hosts文件,达到指定域名映射到指定ip上的功能。修改方式如下:1.windows中hosts文件位置(win10):C:\Windows\System32\drivers\etc\hosts2.修改方式#将www.aaa.com域名映射到127.0.0.1IP地址上127.0.0.1www.aaa.com3.应用在不用重启系统情况下,应用修改后的hosts文件,打开

    2022年10月12日
  • 使用tcpdump抓包分析网络请求_抓包报文分析

    使用tcpdump抓包分析网络请求_抓包报文分析tcpdump是一个用于截取网络分组,并输出分组内容的工具,简单说就是数据包抓包工具。tcpdump凭借强大的功能和灵活的截取策略,使其成为Linux系统下用于网络分析和问题排查的首选工具。tcpdump提供了源代码,公开了接口,因此具备很强的可扩展性,对于网络维护和入侵者都是非常有用的工具。tcpdump存在于基本的Linux系统中,由于它需要将网络界面设置为混杂模式,普通用户不能正常执行,但具备root权限的用户可以直接执行它来获取网络上的信息。因此系统中存在网络分析工具主要不是对本机安全的威胁,而是对

    2022年10月14日
  • 【Qt】下载与安装「建议收藏」

    【Qt】下载与安装「建议收藏」Qt下载与安装很简单,大家按照下面的步骤一步步安装就可以了。

  • 每一趟安心出行的背后,都有哪些黑科技?

    每一趟安心出行的背后,都有哪些黑科技?导读:寄托着满当当期待与希望的20年代第一个新年,让一场态势凶猛的新型冠状病毒压抑的连呼吸都变得艰难。但不同的是,这一次,我们共同的努力,都会让社会好得…

发表回复

您的电子邮箱地址不会被公开。

关注全栈程序员社区公众号