爱意满满的作品展示区。
Showfom
26.39D
1.99D

做了个网站,每天定时更新 chnroutes 以及 curl 获取当前 IPv4 出口地址

  •  
  •   Showfom ·
    PRO
    · May 14, 2015 · 4996 views
    This topic created in 4055 days ago, the information mentioned may be changed or developed.

    下载地址

    http://ip.gs/chnroutes/

    这样就不用每次自己在电脑里执行了,本地下载 apnic 的资源实在是慢,服务器里快多了。

    因为 Linuxip-downMac 下的 ip-down 文件名冲突,所以我在文件名前面加入了前缀方便区别

    目前设置了每天北京时间 1314 分更新一次

    crontab 的内容,假设你的目录在 /var/www/chnroutes/

    14 13 * * * cd /var/www/chnroutes/ && /usr/bin/python /var/www/chnroutes/chnroutes.py -p mac
    14 13 * * * cd /var/www/chnroutes/ && /usr/bin/python /var/www/chnroutes/chnroutes.py -p linux
    14 13 * * * cd /var/www/chnroutes/ && /usr/bin/python /var/www/chnroutes/chnroutes.py -p win
    

    chnroutes 使用方法

    请参考

    https://github.com/fivesheep/chnroutes

    其他

    同时 ip.gs 还有一个很好的用法,在终端下输入 curl ip.gs 即可获取当前自己的外网出口 IPv4 地址

    感谢

    IP 数据库由 http://www.ipip.net/ 提供

    15 replies    2015-05-18 10:00:05 +08:00
    Septembers
        1
    Septembers  
       May 14, 2015
    感谢 虽然我用不上
    winooxx
        2
    winooxx  
       May 14, 2015 via Android
    支持!
    694380889
        3
    694380889  
       May 14, 2015
    我使用 curl ip.gs 获取到的地址是错的
    fengzhihai2014
        4
    fengzhihai2014  
       May 14, 2015
    赞一个
    Delbert
        5
    Delbert  
       May 14, 2015
    curl ip.gs 和 curl ip.cn 得到的IP地址不同。
    Delbert
        6
    Delbert  
       May 14, 2015
    ip.gs 为 219.231.x.x 网段 山东省济南市 山东大学
    ip.cn 为 222.175.x.x 网段 山东省济南市 电信
    ip.tl 为 2001:da8:7000:6033:xxxx:xxxx:xxxx:xxxx
    Yien
        7
    Yien  
       May 14, 2015 via Android
    感谢分享
    Showfom
        8
    Showfom  
    OP
    PRO
       May 14, 2015
    @Delbert 我擦。。。那你到底是什么出口
    aiguozhedaodan
        9
    aiguozhedaodan  
       May 14, 2015 via Android
    @Delbert
    @Showfom
    校园网至少有两个出口,教育网出口就会是效果1,电信出口就会是效果2,同理也能看到移动和联通的出口。至少我这里是这样。
    Delbert
        10
    Delbert  
       May 14, 2015
    @Showfom 电脑本机IP是第一个,ipconfig /all得到。
    @aiguozhedaodan 也就是说,走电信出口的话,实际上得不到我真正的IP地址?

    @Showfom 我宿舍和实验室还不一个网段,晚上回去看一下。
    Themyth
        11
    Themyth  
       May 14, 2015
    已经使用,感谢:)
    Showfom
        12
    Showfom  
    OP
    PRO
       May 15, 2015
    @Delbert 说明我们的 IP 段在教育网访问的列表里?
    Delbert
        13
    Delbert  
       May 15, 2015
    @Showfom

    不是,只能说获取到了真实的本机ip。
    实际上页面访问ip.cn也是219,但是curl就不是……

    而且每个人的ip都是独立的公网ip(学校人好多的说。)
    mingyun
        14
    mingyun  
       May 17, 2015
    pH
        15
    pH  
       May 18, 2015
    @Delbert 类似这种校园网的IP,确实感觉是多种的。一直对这个比较烦。
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   857 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 54ms · UTC 19:51 · PVG 03:51 · LAX 12:51 · JFK 15:51
    ♥ Do have faith in what you're doing.