美文网首页
查看linux服务器公网ip

查看linux服务器公网ip

作者: 小代码 | 来源:发表于2017-06-09 10:59 被阅读0次

    Q:我要你的服务器ip,做ip白名单。

    遇到这种情况怎么办?ip命令查看?


    ip adrr.png

    看到了么,没有。这可急死我了,看不到公网ip,问网管么,不及时啊啊!!!
    以下方法:

    1. curl 查看ip
    curl cip.cc
    curl ifconfig.me
    curl ifconfig.me/all
    curl www.pubyun.com/dyndns/getip
    curl members.3322.org/dyndns/getip
    
    1. 登录阿里云查看登录IP


      阿里云服务器登录
    2. 设置nginx返回ip

    location /ip {
                    expires 0;
                    add_header Content-Type "text/plain;charset=utf-8";
                    return 200 "Your IP Address:$remote_addr";
            }
    

    这种方法前提是你的服务器不准使用CDN动态加速,否则取得的就是加速机器的ip咯。
    测试下:

    用了CDN动态加速的域名IP
    https://portal.chinacache.com/api/getRealIP.html
    真实IP
    http://www.pubyun.com/dyndns/getiphttp://www.ip138.com

    1. traceroute
      traceroute
      说明:traceroute不是很准,切记。

    相关文章

      网友评论

          本文标题:查看linux服务器公网ip

          本文链接:https://www.haomeiwen.com/subject/pabxqxtx.html