linux 查本机公网ip 网站接口 nmap工具

网站接口

# 国内某网站的接口,只返回IP
curl whatismyip.akamai.com

# 更多用法访问ifconfig.co
wget -qO - ifconfig.co
  
curl icanhazip.com
dig +short myip.opendns.com @resolver1.opendns.com
  
curl ident.me
curl v4.ident.me
curl v6.ident.me

#返回IP和地区
curl cip.cc
  
#需要翻x,只返回IP
curl ip.appspot.com
  
# 多网站获取ip接口shell脚本
wget https://raw.githubusercontent.com/rsp/scripts/master/externalip-benchmark
chmod a+x externalip-benchmark
./externalip-benchmark

 

nmap工具

nping是nmap的子命令、子工具

查询自己公网IP

nping --echo-client "public" echo.nmap.org --udp
 

SENT (1.9332s) UDP 192.168.1.106:53 > 45.33.32.156:40125 ttl=64 id=38352 iplen=28 
CAPT (2.0617s) UDP 221.218.209.62:53 > 45.33.32.156:40125 ttl=50 id=38352 iplen=28 
RCVD (2.1899s) ICMP [45.33.32.156 > 192.168.1.106 Port unreachable (type=3/code=3) ] IP [ttl=49 id=542 iplen=56 ]
SENT (2.9411s) UDP 192.168.1.106:53 > 45.33.32.156:40125 ttl=64 id=38352 iplen=28 
CAPT (3.0566s) UDP 221.218.209.62:53 > 45.33.32.156:40125 ttl=50 id=38352 iplen=28 
RCVD (3.1620s) ICMP [45.33.32.156 > 192.168.1.106 Port unreachable (type=3/code=3) ] IP [ttl=49 id=636 iplen=56 ]
SENT (3.9442s) UDP 192.168.1.106:53 > 45.33.32.156:40125 ttl=64 id=38352 iplen=28 
CAPT (4.0713s) UDP 221.218.209.62:53 > 45.33.32.156:40125 ttl=50 id=38352 iplen=28 
RCVD (4.1685s) ICMP [45.33.32.156 > 192.168.1.106 Port unreachable (type=3/code=3) ] IP [ttl=49 id=856 iplen=56 ]
SENT (4.9476s) UDP 192.168.1.106:53 > 45.33.32.156:40125 ttl=64 id=38352 iplen=28


221.218.209.62 就是我们的公网IP
 

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值