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. Redis-消息

    Redis 发布订阅(实际开发不使用) Redis 发布订阅(pub/sub)是一种消息通信模式:发送者(pub)发送消息,订阅者(sub)接收消息. Redis 客户端可以订阅任意数量的频道. 下图 ...

  2. C:类型限定符

  3. ZooKeeper下载安装配置-单机版配置

    1,下载地址:http://apache.fayea.com/zookeeper/ 2,检查环境变量(需要确保配置了环境变量): java -version 3,安装配置: (1)解压 tar -zx ...

  4. [BPNN]BP神经网络实现

    BP神经网络实现 以3层网络为例,Python实现: 1.代码框架 主要函数: Init函数:设定InputLayer nodes.HiddenLayer nodes.OutputLayer node ...

  5. echart 重新加载

    myechart2.clear(); myechart2.setOption(options[1]);

  6. Ubuntu 安装 uWSGI

    uWSGI官方网址: https://pypi.org/project/uWSGI/ 使用如下命令安装: pip install uWSGI 报如下错: Collecting uWSGI Using ...

  7. map的使用-Hdu 2648

    Shopping Time Limit: 10000/5000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total S ...

  8. 13 DFT变换的性质

    DFT变换的性质 线性性质 \[ \begin{aligned} y[n]&=ax[n]+bw[n]\xrightarrow{DFT}Y[k]=\sum_{n=0}^{N-1}(ax[n]+ ...

  9. SpringBoot与Shiro整合

    一.数据库设计 ​ 这里主要涉及到五张表:用户表,角色表(用户所拥有的角色),权限表(角色所涉及到的权限),用户-角色表(用户和角色是多对多的),角色-权限表(角色和权限是多对多的).表结构建立的sq ...

  10. Maven学习笔记:Maven简介

    Maven的概念 Maven是基于项目对象模型(POM,Project Object Model),可以通过描述信息来管理项目的构建,报告和文档的软件管理工具 Maven除了以程序构建能力为特色之外, ...