zoukankan      html  css  js  c++  java
  • 基于地理位置信息的traceroute

    我们在机房选择、測试网络的质量的时候,往往仅仅依据跳数、延迟、抖动、网络吞吐量等指标来衡量,非常多时候跳数并不能全然显示网络拓扑优劣,于是写了个traceroute结合whois的小脚本来直观显示每一跳所处的网络位置。


    须要安装mtr和whois


    脚本:

    [root@localhost ~]# more  geotrace.sh         

    #!/bin/bash
    echo traceroute ip:$1 from localhost
    ip=$1
    echo
    #mtr --n --report $ip|grep -v ^HOST|awk '{printf $1" "$2" ";system("whois "$2"|grep descr|head -n1|cut -c17-");printf " "}'
    mtr --n --report $ip|grep -v ^HOST|awk '{printf $1" "$2" ";system("whois "$2"|grep -e netname -e descr|cut -c17-");printf " "}
    '


    測试结果还挺令人惬意:

    [root@localhost ~]# ./geotrace.sh 8.8.8.8

    traceroute ip:8.8.8.8 from localhost

    1. 210.14.148.129 SHUJUJIA
    Beijing ShuJuJia Technology Co., Ltd.
    Triumph 170 Kai Xuan Cheng, 26th Floor, Block C
    Bei Yuan Road, Chaoyang District, Beijing City

    2. ??? 
    3. 172.17.2.1 
    4. 61.49.39.25 UNICOM-BJ
    China Unicom Beijing province network
    China Unicom

    5. 202.106.35.1 UNICOM-BJ
    China Unicom Beijing province network
    China Unicom

    6. 61.148.155.161 UNICOM-BJ
    China Unicom Beijing province network
    China Unicom

    7. 123.126.0.29 UNICOM-BJ
    China Unicom Beijing province network
    China Unicom

    8. 219.158.101.118 CNCGROUP
    CNC group
    China Unicom IP Network

    9. 219.158.3.218 ChinaUnicom-BACKBONE
    Backbone of China Unicom
    China Unicom IP Network

    10. 219.158.96.198 CNCGROUP
    CNC group
    China Unicom IP Network

    11. 219.158.25.142 ChinaUnicom-BACKBONE
    Backbone of China Unicom
    China Unicom IP Network

    12. 219.158.33.174 CNCGROUP-BACKBONE
    Backbone of CNC group
    CNC Group CHINA169 Backbone

    13. 209.85.241.58 
    14. 209.85.253.71 
    15. ???

     
    16. 8.8.8.8 
    [root@localhost ~]# 

  • 相关阅读:
    java 静态方法分析
    编译时常量与运行时常量
    springboot+elasticsearch配置实现
    spring+mybatise注解实现
    @RequestParam @RequestBody @PathVariable 等参数绑定注解详解
    @RequestBody 的正确使用办法
    springboot+jps+druid项目搭建
    python 源码安装
    liunx 时间ntp同步服务器
    spring 定时任务corn表达式
  • 原文地址:https://www.cnblogs.com/jzssuanfa/p/7264207.html
Copyright © 2011-2022 走看看