1. 查看本机公网IP
1.1 curl ifconfig.me
1.2 ipinfo.io
1.3 test-ipv6.com
1.4 more
2. 查看本机IP,host
2.1 hostname
2.2 查看本机IP:ip
2.3 查看无线网连接信息:iw
2.4 实时查看网路连接信息:iftop
2.5 分类查看网络连接信息:ss
3. 测试与外部的连通
3.1 telnet {host} {port}
3.2 nc -vz {host} {port}
3.3 nmap -p {port} {host}
3.4 sudo nping --tcp -p {port} {host}
3.5 wget www.baidu.com
3.6 curl
4. speedtest
5. more

1. 查看本机公网IP

1.1 curl ifconfig.me

https://ifconfig.me/
Command Line Interface

  • $ curl ifconfig.me ⇒ 112.20.121.81
  • $ curl ifconfig.me/ip ⇒ 112.20.121.81
  • $ curl ifconfig.me/host ⇒ unavailable
  • $ curl ifconfig.me/ua ⇒ Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.116 Safari/537.36
  • $ curl ifconfig.me/port ⇒ 43344
  • $ curl ifconfig.me/lang ⇒ en,zh;q=0.9,en-US;q=0.8,zh-CN;q=0.7,zh-TW;q=0.6,zh-HK;q=0.5
  • $ curl ifconfig.me/keepalive ⇒
  • $ curl ifconfig.me/connection ⇒
  • $ curl ifconfig.me/encoding ⇒ gzip, deflate, br
  • $ curl ifconfig.me/mime ⇒ text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9
  • $ curl ifconfig.me/charset ⇒
  • $ curl ifconfig.me/via ⇒ 1.1 google
  • $ curl ifconfig.me/forwarded ⇒ 112.20.121.81, 216.239.38.21

or

  • $ curl ifconfig.me/all
  • $ curl ifconfig.me/all.xml
  • $ curl ifconfig.me/all.json

1.2 ipinfo.io

https://ipinfo.io/
 ip: "112.20.121.81"
 city: "Suzhou"
 region: "Jiangsu"
 country: "CN"
 loc: "31.3041,120.5954"
 timezone: "Asia/Shanghai"
 asn: Object
 asn: "AS56046"
 name: "China Mobile communications corporation"
 domain: "chinamobile.com"
 route: "112.20.96.0/19"
 type: "isp"
 company: Object
 privacy: Object
 vpn: false
 proxy: false
 tor: false
 hosting: false
 abuse: Object
 address: "China Mobile Communications Corporation, 29, Jinrong Ave., Xicheng District, Beijing, 100032"
 country: "CN"
 email: "abuse@chinamobile.com"
 name: "haijun li"
 network: "112.0.0.0/10"
 phone: "+86 1052686688"

1.3 test-ipv6.com

https://test-ipv6.com/

江苏 苏州 移动 = 项目 = (翻-) 日本
Your IPv4 address on the public Internet appears to be 112.20.121.81 公网 IPv4 地址 你的公网 IPv4 地址是 139.162.*.*
  公网 IPv6 地址 你的公网 IPv6 地址是 2400:8902::f03c:92ff:*:*
Your Internet Service Provider (ISP) appears to be CMNET-JIANGSU-AP China Mobile communications corporation 运营商(ISP) 你的运营商(ISP)是 LINODE-AP Linode, LLC
Tests using this web site are unreliable from your location.
从您所在的位置使用该网站进行的测试不可靠。
   
No IPv6 address detected 检测IPv6地址 ? 你已接入 IPv6,因此我们增加了一个标签页,显示你能否访问其他 IPv6 网站。
You appear to be able to browse the IPv4 Internet only.
You will not be able to reach IPv6-only sites.
   
To ensure the best Internet performance and connectivity, ask your ISP about native IPv6.    
We are sometimes unable to detect Teredo and 6to4 when using HTTPS.    
HTTPS support on this web site is in beta. HTTPS支持 本站的 HTTPS 功能正在开放测试。
Your DNS server (possibly run by your ISP) appears to have IPv6 Internet access. DNS服务器
的 IPv6 状态
你的 DNS 服务器(可能由运营商提供)没有接入或没有配置 IPv6,将来这可能会妨碍你访问纯 IPv6 网站。
‘ 0/10 IPv6 状况评分 ‘ 9/10

https://test-ipv6.com/index.html.zh_CN
https://test-ipv6.com/index.html.en_US
右上角的翻译图标可以选择语言
https://test-ipv6.com/locale.html.zh_CN
https://test-ipv6.com/locale.html.en_US

1.4 more

https://www.whatismyip.com/
http://www.ip138.com/

2. 查看本机IP,host

2.1 hostname

$ hostname --h
  -i, --ip-addresses         addresses for the host name
  -s, --short                short host name

$ hostname -i
192.168.31.177
$ hostname -s
tompc

$ hostnamectl
   Static hostname: tompc
         Icon name: computer-laptop
           Chassis: laptop
        Machine ID: 213df5b115df44afa70277ddc24726ef
           Boot ID: b23409079ab346719ec9f813d597e0dd
  Operating System: Arch Linux
            Kernel: Linux 5.5.4-arch1-1
      Architecture: x86-64

2.2 查看本机IP:ip

ip address
$ ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    ...
2: enp0s25: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc fq_codel state DOWN group default qlen 1000
    ...
3: wlp16s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
    ...
    inet 192.168.31.177/24 brd 192.168.31.255 scope global dynamic noprefixroute wlp16s0
       ...

$ ip route get 8.8.8.8
8.8.8.8 via 192.168.31.1 dev wlp16s0 src 192.168.31.177 uid 1001
    cache

2.3 查看无线网连接信息:iw

$ iw dev wlp16s0 link
Connected to 28:6c:07:42:39:c5 (on wlp16s0)
SSID: China-cHen
freq: 2457
RX: 1157552869 bytes (1181154 packets)
TX: 433099068 bytes (972681 packets)
signal: -52 dBm
rx bitrate: 24.0 MBit/s
tx bitrate: 48.0 MBit/s
bss flags: short-slot-time
dtim period: 1
beacon int: 100

$ iw dev wlp16s0 info
Interface wlp16s0
ifindex 3
wdev 0x1
addr 00:1c:bf:3e:5c:8c
ssid China-cHen
type managed
wiphy 0
channel 10 (2457 MHz), width: 20 MHz (no HT), center1: 2457 MHz
txpower 13.00 dBm

2.4 实时查看网路连接信息:iftop

$ sudo iftop -P -N -p -i wlp16s0 -m 100m

2.5 分类查看网络连接信息:ss

https://www.cnblogs.com/sztom/p/10810508.html#335
查看主机监听的端口,本地IP地址及tcp数字端口号(t:tcp; n:数字显示;l监听)
$ ss -tnl

显示名称,比如上面的127.0.0.1:53显示为tigger:domain; 端口22显示为ssh等。
$ ss -tlr

加上p,显示pid
$ ss -tlrp

所有的tcp连接
ss -tan

查看所有tcp,udp,数字显示,显示pid
$ ss -tuanp

查看所有tcp,udp,名称显示,显示pid
$ ss -tuarp

不推荐使用的Linux网络命令及其替代品 (iproute2 替代 net-tools)
https://www.cnblogs.com/sztom/articles/10764994.html

3. 测试与外部的连通

$ ping www.google.com
$ tracepath www.google.com
$ traceroute www.google.com

3.1 telnet {host} {port}

曾经广泛使用的命令之一,逐渐淘汰中。用于测试服务器之间的基本连接,即服务器与另一台网络设备的IP。
$ telnet www.baidu.com 80

3.2 nc -vz {host} {port}

Ncat(又名nc)是一个功能强大的网络实用程序,具有许多功能,例如绑定和接受连接,远程执行命令,写入和读取数据等。它同时适用于IPv4和IPv6。
$ nc -vz www.baidu.com 80
www.baidu.com [183.232.231.172] 80 (http) open

还可以使用nc绑定连接来侦听特定端口。当您没有正在运行的实际服务但要确保存在连接时,这可能很方便。
要开始监听端口: nc -l $PORTNUMBER

3.3 nmap -p {port} {host}

具有数百种功能的流行工具。通常,这被视为安全工具。nmap可让您测试单个IP /端口或该范围内的IP。
nmap -PNp {port} {host}
$ nmap -p 443 www.baidu.com
PORT    STATE SERVICE
443/tcp open  https

3.4 sudo nping --tcp -p {port} {host}

nping是用于网络数据包生成,响应分析和响应时间测量的开源工具。
nping允许用户生成各种协议的网络数据包,从而使他们可以通过虚拟方式调整协议头的任何字段。
nping可以用作检测活动主机的简单ping实用程序,但也可以用作原始数据包生成器。
$ sudo nping --tcp -p 80 www.baidu.com
$ sudo nping --tcp -p 8000 www.baidu.com

3.5 wget www.baidu.com

wget是用于下载/测试HTTP,HTTPS和FTP的有用命令。使用wget进行测试非常简单。
$ wget www.baidu.com

3.6 curl

URL检索实用程序和库. 可以使用curl远程登录到端口: curl -v telnet://$IP:$PORT
也可以使用curl下载数据。它支持多种协议-HTTP,HTTPS,FTP,IMAP,LDAP,POP3,SCP,SFTP,GOPHER等。

$ curl -v telnet://www.baidu.com:443
*   Trying 183.232.231.174:443...
* TCP_NODELAY set
* Connected to www.baidu.com (183.232.231.174) port 443 (#0)

$ curl -v telnet://www.baidu.com:8000
*   Trying 183.232.231.172:8000...
* TCP_NODELAY set

$ curl 网址 //返回网页源码
如果要把这个网页保存下来,可以使用`-o`参数,这就相当于使用wget命令了。
$ curl -o [文件名] www.sina.com

4. speedtest

$ speedtest-cli
Retrieving speedtest.net configuration...
Testing from China Mobile Guangdong (112.20.121.81)...
Retrieving speedtest.net server list...
Selecting best server based on ping...
Hosted by China Mobile 5G (Wuxi) [40.47 km]: 19.538 ms
Testing download speed................................
Download: 16.30 Mbit/s
Testing upload speed..................................
Upload: 5.10 Mbit/s

Chrome 浏览器
https://www.speedtest.net/
https://www.speedtest.cn/
https://fast.com/zh/cn/

5. more

如何从Linux或Unix命令行ping和测试特定端口
https://www.cyberciti.biz/faq/ping-test-a-specific-port-of-machine-ip-address-using-linux-unix/

Linux实用程序,用于测试网络连接
https://geekflare.com/linux-test-network-connectivity/

https://www.whatismyip.com/linux-ip-commands/

nmap
https://www.cnblogs.com/sztom/p/10970772.html

wget,curl,aria2
https://www.cnblogs.com/sztom/p/10765319.html

Linux系统使用ss命令查看端口状态
https://www.cnblogs.com/sztom/p/10810508.html

Wireshark用户指南
https://www.cnblogs.com/sztom/articles/10977415.html

故障网络连接故障排除,第2部分:基本网络命令(2011)
https://www.cnblogs.com/sztom/articles/10813032.html

有用的基于Web的工具(from dougvitale.wordpress.com)
https://www.cnblogs.com/sztom/articles/10812699.html

IP show的更多相关文章

  1. Tcp/ip 报文解析

    在编写网络程序时,常使用TCP协议.那么一个tcp包到底由哪些东西构成的呢?其实一个TCP包,首先需要通过IP协议承载,而IP报文,又需要通过以太网传送.下面我们来看看几种协议头的构成 一 .Ethe ...

  2. 网站定位之---根据IP获得区域

    记得以前做一个培训机构网站时候需要定位,那时候用的搜狐的api,不是很精准. demo:https://github.com/dunitian/LoTCodeBase/tree/master/NetC ...

  3. 通过 floating IP 访问 VIP - 每天5分钟玩转 OpenStack(126)

    前面我们是直接用 curl 测试 VIP,在更为真实的场景中通常会使用 floating IP 访问 VIP. 下面我们给 VIP 关联一个 floating IP,再进行测试. 访问 Project ...

  4. PHP获取客户端IP

    /** * 获取客户端IP */ function getClientIp() { $ip = 'unknown'; $unknown = 'unknown'; if (isset($_SERVER[ ...

  5. 获取 dhcp IP 过程分析 - 每天5分钟玩转 OpenStack(91)

    前面我们已经讨论了 DHCP agent 的配置以及 namespace 如何隔离 dnsmasq 服务,本节将以 cirros-vm1 为例分析获取 DHCP IP 的详细过程. 在创建 insta ...

  6. Java获取本机的IP与MAC地址

    有些机器有许多虚拟的网卡,获取IP地址时会出现一些意外,所以需要一些验证: // 获取mac地址 public static String getMacAddress() { try { Enumer ...

  7. 根据ip判断返回城市名称查询当地天气

    <?phpheader("content-type:text/html;charset=utf-8");date_default_timezone_set("Asi ...

  8. TCP/IP基础

    TCP/IP 是用于因特网 (Internet) 的通信协议. 计算机通信协议是对那些计算机必须遵守以便彼此通信的规则的描述. 什么是 TCP/IP? TCP/IP 是供已连接因特网的计算机进行通信的 ...

  9. CentOS:ECDSA host key "ip地址" for has changed and you have requested strict checking(转)

    原文地址:http://blog.csdn.net/ausboyue/article/details/52775281 Linux SSH命令错误:ECDSA host key "ip地址& ...

  10. TCP/IP之TCP_NODELAY与TCP_CORK

    TCP/IP之Nagle算法与40ms延迟提到了Nagle 算法.这样虽然提高了网络吞吐量,但是实时性却降低了,在一些交互性很强的应用程序来说是不允许的,使用TCP_NODELAY选项可以禁止Nagl ...

随机推荐

  1. js加密(八)新浪微博登录

    1. url: https://weibo.com/ 2. target: 登录 3. 分析.由于需要填写验证码,本篇只分析破解用户名和密码加密部分,不做验证码识别. 3.1 老规矩,F12,随便输入 ...

  2. 你了解真正的 restful API 吗?

    本文原创地址,博客:https://jsbintask.cn/2019/03/20/api/restful-api-best-practices/(食用效果最佳),转载请注明出处! 前言 在以前,一个 ...

  3. AspectRatio图片的宽高比、Card 卡片组件

    一.AspectRatio 组件 AspectRatio 的作用是根据设置调整子元素 child 的宽高比. AspectRatio 首先会在布局限制条件允许的范围内尽可能的扩展,widget 的高度 ...

  4. java内存模型中工作内存并不一定会同步主内存的情况分析

    其实是为了填之前的一个坑  在一个多线程的案例中出现了阻塞的情况. https://www.cnblogs.com/hetutu-5238/p/10477875.html   其中的第二个问题,即多个 ...

  5. vue动态加载jQuery插件

    要先npm安装jQuery插件哦 window.$=$; window.jQuery=$; function loadJs(Url,callback){ var Nscript=document.cr ...

  6. C语言:把分数最低的学生数据放入数组b所指的数组中,-从键盘输入若干字符串,写入文件myfile4中,用-1作字符输入结束的标志,

    //学生记录由学号和成绩组成,N名学生的数据已放入主函数中的结构体数组中,fun函数:把分数最低的学生数据放入数组b所指的数组中,分数最低的学生可能不止一个.人数返回. #include <st ...

  7. java -jar命令运行jar包时指定外部依赖jar包 linxux or windows

    前尘回顾: setup.bat [chenquan@hostuser tartest]$ cat ../setup.sh javac -encoding UTF-8 -Djava.ext.dirs=. ...

  8. windows ,linux永久和临时修改pip源

    临时修改(建议)pypi镜像源方法:如果有untrust 报错,可使用https开头的网站,或加上--trusted 例如: pip install pywin32 -i http://mirrors ...

  9. 【JavaWeb+Echarts+EL表达式】用图表形式展示数据

    1. Echarts环境配置 https://www.echartsjs.com/zh/download.html 选择需要的,然后等待Build完成之后,就会自动弹出下载框啦! 把下载好的js放在w ...

  10. DataGrid 獲取 制定 row Col 單元格

    public static class DataGridHelper     {         /// <summary>                  /// Gets the v ...