2

linux 上查询 ip 归属地

 2 years ago
source link: https://xujinzh.github.io/2022/06/10/linux-check-ip-domain/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

linux 上查询 ip 归属地

2022-06-10technologylinux

2 583 1 分钟

公网 ip 地址唯一标识了服务器在互联网上的地址。那如何知道自己服务器的公网 ip 地址,又如何知道某一个 ip 地址的归属地呢?本篇介绍一个命令来查询上面的信息。所有命令以普通用户运行。

查询自己电脑的公网 ip

# linux or Mac 
curl cip.cc

# Windows
telnet cip.cc
ftp cip.cc

结果类似下面这样,ip 地址不同输出结果不同

IP	: 43.188.123.xxx
地址 : 日本 日本

数据二 : 日本

数据三 : 中国 | 腾讯

URL : http://www.cip.cc/43.188.123.xxx

如果只想知道自己的电脑的 ip 地址,不想输出其他信息

# linux or Mac 
curl ip.cip.cc

# Windows
telnet ip.cip.cc
ftp ip.cip.cc

结果只有 ip 地址。但实践中发现该命令会出现无响应的情况。但该命令却是网站:http://www.cip.cc/ 上推广的命令,此处省略10000行。

查询 ip 地址归属地

该命令只需要在上面的命令中增加 ip 地址即可,方法如下

# linux or Mac 
curl cip.cc/43.188.123.xxx

# Windows
telnet cip.cc/43.188.123.xxx
ftp cip.cc/43.188.123.xxx
感谢支持!

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK