Linux查看公网IP和私网(内网)IP的方法
查看Linux公网IP地址
查看Linux公网IP很简单,结合第三方网站辅助一下即可,直接curl一下ip.sb或者cip.cc即可
curl ip.sb # 只显示ipv4curl cip.cc #显示ipv4和地址信息
查看Linux的内网IP地址
ifconfig -a
直接执行上述命令即可查看到内网IP
拓展:查询公网ip
cip.cc
命令行查询(详细):# UNIX/Linux:
curl cip.cc# Windows:
telnet cip.cc
ftp cip.cc命令行查询(纯ip):#UNIX/Linux:
curl ip.cip.cc# Windows:
telnet ip.cip.cc
ftp ip.cip.cc
ip.sb
- Example (Plain text): https://api.ip.sb/ip (Listen on both IPv4 and IPv6) or
curl ip.sb
- Example (Plain text): https://api-ipv4.ip.sb/ip (Listen on IPv4 only) or
curl -4 ip.sb
orcurl ipv4.ip.sb
- Example (Plain text): https://api-ipv6.ip.sb/ip (Listen on IPv6 only) or
curl -6 ip.sb
orcurl ipv6.ip.sb
Usage example (Shell script):
#!/bin/ship=$(curl -s https://api.ip.sb/ip)
echo "My IP address is: $ip"
Output example:
IPv4 address:
192.0.2.2
IPv6 address:
2001:db8::2
GeoIP (Get IP address location in JSON format):
Calling the API endpoint without any parameter will return location information for the visitor IP address:
- Example (JSON): https://api.ip.sb/geoip
- Example (JSONP): https://api.ip.sb/geoip?callback=getgeoip
Appending an IP address as parameter will return location information for this IP address:
- Example (JSON): https://api.ip.sb/geoip/185.222.222.222
- Example (JSONP): https://api.ip.sb/geoip/185.222.222.222?callback=getgeoip
- Example (JSON): https://api.ip.sb/geoip/2a09::
- Example (JSONP): https://api.ip.sb/geoip/2a09::?callback=getgeoip
Usage example:
<script type="application/javascript">
function getgeoip(json){document.write("Geolocation information for IP address: ", json.ip);document.write("Country: ", json.country);document.write("Latitude: ", json.latitude);document.write("Longitude: ", json.longitude);
}
</script><script type="application/javascript" src="https://api.ip.sb/geoip?callback=getgeoip"></script>
Usage example (jQuery):
<script type="application/javascript">
$(document).ready(function() {$.getJSON("https://api.ip.sb/geoip?callback=?",function(json) {document.write("Geolocation information for IP address: ", json.ip);document.write("Country: ", json.country);document.write("Latitude: ", json.latitude);document.write("Longitude: ", json.longitude);});
});
</script>
JSON Output Schema
The output is a JSON object containing the following elements:
Please note that the IP location database may not contain all information about a given IP. In this case, only the available data is displayed.
- ip (Visitor IP address, or IP address specified as parameter)
- country_code (Two-letter ISO 3166-1 alpha-2 country code)
- country (Name of the country)
- region_code (Two-letter ISO-3166-2 state / region code for US and Canada, FIPS 10-4 region codes otherwise)
- region (Name of the region)
- city (Name of the city)
- postal_code (Postal code / Zip code)
- continent_code (Two-letter continent code)
- latitude (Latitude)
- longitude (Longitude)
- organization (ASN + ISP name)
- timezone (Time Zone)
Output example:
The following example use xTom server IP: city, region, and postal code information is not available and thus not present in the output JSON object:
{"ip": "185.255.55.55","country_code": "NL","country": "Netherlands","continent_code": "EU","latitude": 52.3824,"longitude": 4.8995,"asn": "3214","organization": "xTom Limited","timezone": "Europe/Amsterdam",
}
参考:
IP查询 - 查IP(www.cip.cc)查IP(www.cip.cc)网站, 提供免费的IP查询服务,命令行查询IP, 并且支持'PC网站, 手机网站, 命令行(Windows/UNIX/Linux)' 三大平台, 是个多平台的IP查询网站, 更新即使, 数据准确是我们的目标https://www.cip.cc/
https://ip.sb/api/https://ip.sb/api/
Linux查看公网IP和私网(内网)IP的方法相关推荐
- Linux搭建GitLab私有仓库,并内网穿透实现公网访问
文章目录 前言 1. 下载Gitlab 2. 安装Gitlab 3. 启动Gitlab 4. 安装cpolar 5. 创建隧道配置访问地址 6. 固定GitLab访问地址 6.1 保留二级子域名 6. ...
- 七月文章导读【TCP/IP相关】:解密 TCP/IP;什么是公网ip?什么是内网ip?为什么ip地址通常以192.168开头?
Table of Contents 解密 TCP/IP! TCP/IP是什么 网络分层 分层 封装 地址 端口 域名系统 分用 小结 什么是公网ip?什么是内网ip?为什么ip地址通常以192.168 ...
- 公网域名如何解析到内网IP服务器——快解析域名映射外网访问
在本地搭建主机应用后,由于没有公网IP或没有公网路由权限,在需要发布互联网时,就需要用到外网访问内网的一些方案.由于内网IP在外网不能直接访问,通常就用通过外网域名来访问内网的方法.那么,公网域名如何 ...
- 没有公网IP,快速免费内网穿透
在大内网环境下,没有公网IP非常普遍.而如何没有公网IP的环境下,外网访问内网,常见通过内网穿透来实现,毕竟自己买一个公网IP,费用可不小. 内网穿透,主要通过第三方公网IP服务器进行数据转发,不需要 ...
- 公网如何SSH远程连接内网服务器
公网如何SSH远程连接内网Linux服务器 文章目录 公网如何SSH远程连接内网Linux服务器 1. 注册cpolar账号 2. 安装配置cpolar内网穿透 2.1 安装客户端 2.2 进行tok ...
- 详细谈电脑ip、域名、内网、外网、localhost、127.0.0.1、网关等通讯基础知识(易懂)
1. ip地址与域名的定义以及其关系 ip地址的定义: IP地址(Internet Protocol Address)是指互联网协议地址,又译为网际协议地址. IP地址是IP协议提供的一种统一的地址格 ...
- dcn网络与公网_ip 中的,内网,外网,公网,dcn网络,分别是什么意思?
展开全部 ip中的,内网62616964757a686964616fe78988e69d8331333433646465,外网,公网,dcn网络,分别是: 1.内网ip: 内网也就是局域网,内网的计算 ...
- Apache 2.4.7在CentOS6.4中安装配置反向代理解决单外网IP对应多个内网主机的方法实践
欢迎转载,转载时请保留全文及出处. Apache 2.4.7在CentOS6.4中安装配置反向代理解决单外网IP对应多个内网主机的方法实践 Apache安装 下载源程序(http://httpd.ap ...
- 推断给定的IP地址是否是内网IP
/*** 推断给定的IP地址是否是内网IP* * @author GaoHuanJie*/ public class Test{public boolean isInnerIP(String ipAd ...
- 【内网—内网转发】——代理转发_ew(Earthworm)代理转发
文章目录 一.环境准备: 二.工具: 三.概念: 四.学习目的: 五.ew(Earthworm)介绍: 六.ew(Earthworm)使用说明: 七.ew(Earthworm)正向代理(适用于被控服务 ...
最新文章
- SecureCRT连接CentOS阿里云,小键盘在VIM情况下,无法输入数字反而出现英文
- NOS跨分区灾备设计与实现
- 深度学习之循环神经网络(4)RNN层使用方法
- 深度学习目标检测之 YOLO v1
- 【JAVA基础篇】基本数据类型及自动类型转换
- Visual Studio 2013无法打开IIS Express Web的解决办法
- PHP统计订单表,订单售后表金额
- 千兆网卡为什么慢_宽带300M,光猫是千兆的,电脑网卡和无线路由器都是千兆的。但是速度仍是100M。这是为什么?...
- 大二学生web期末大作业 在线电影网站 HTML+CSS+JS
- 解决 MDK 5 无法生成 .axf 文件的问题
- Allegro中的测试点 Test Point
- vue生成条形码和二维码并打印
- win10商店打不开_win10自带的照片查看器打不开的修复方法
- webservice接口等待时间_调用webservice超时问题的解决
- 【高项】风险管理(ITTO)
- android前端开发工具,分享七个非常有用的Android开发工具和工具包
- 1650支持服务器内存,帧数提升10%!GTX 1650配单双通道内存性能有何不同
- 人工智能教育创新探索
- 0818Python总结-lock,Semaphore,event,Queue,生产者和消费者模型,JoinableQueue
- SAP大中华区公布Q4及全年财报 软件及相关服务成亮点
热门文章
- 信创操作系统--统信UOS桌面版(使用Systemd管理系统服务)
- 刷 百度排名,百度(google)搜索提示下拉关联词的一个简易思路··
- 解决Worm.Win32.AutoRun.soq 病毒
- The server returned the following error: 无法与服务器建立连接(0x80072EFD)
- 我在垃圾场捡到一个黑匣子,拆给大家看看
- 软件测试-------三角形逻辑覆盖
- 单侧上行速度测试软件,20210708-确认 低开单边上行,箱体理论几乎是贯穿a股运行周期的,如果平时容易过分看好行情,或者过分看弱行情,不妨就以最中庸的箱体去验证。... - 雪球...
- android wear iphone7,多款 Android Wear 智能手表不兼容iPhone 7
- Codeforces Round #677 (Div. 3) C. Dominant Piranha
- oracle 修改pkg命令,oracle简单PKG(包)编写