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. 使用Spring框架整合Java Mail

    我的博客名为黑客之谜,今天演示的案例中会出现我的邮箱,还不赶紧收藏!我现在是小白,但是随着时间的流逝,我会逐渐向大神走进,所以,喜欢我的,或者喜欢大神的,点一波关注吧!顺便说一下,双十二快到了,有什么 ...

  2. php-cp(php连接池)扩展的安装

    今天看到php有连接池的扩展,不管效果怎么样,都值得一试,这样才会有突破. 先从guthub上搜索源码:[ https://github.com/swoole/php-cp ] 通过命令clone到自 ...

  3. vscode git连接github

    上一篇文章中介绍了vscode中git的简单使用方法vscode git的简单使用 上次只讲到了本地库的创建,这次说明下怎么push到github上 首先需要有一个github的账号  github官 ...

  4. SPAN, RSPAN, ERSPAN

    该文档摘自:Home > CCIE Routing and Switching Study Group > Discussions 由 Deben 于 2015-2-6 上午6:50 创建 ...

  5. Java方法升级

    1. 方法格式 package cn.itcast.day04.demo02; /* 方法其实就是若干语句的功能集合. 方法好比是一个工厂. 蒙牛工厂 原料:奶牛.饲料.水 产出物:奶制品 钢铁工厂 ...

  6. buuctf——facebook1

    分为注册和登陆两个页面 据大佬wp登陆页面又盲注,但我没测试 直接注册后登陆 注册后发现,会显示输入的url 根据目录扫描,发现robots.txt和flag.php robots.txt有源码备份 ...

  7. 2_1 aabb

    输出所有形如aabb的4位完全平方数(即前两位数字相等,后两位数字也相同).

  8. ubuntu apache 通过端口新建多个站点

    cd /etc/apache2/sites-available 最近的虚拟机没绑定域名,所以呢,就先用域名加端口新建几个站点用着 1. vim /etc/apapche2/apapche2.conf ...

  9. Golang 函数以及函数和方法的区别

    在接触到go之前,我认为函数和方法只是同一个东西的两个名字而已(在我熟悉的c/c++,python,java中没有明显的区别),但是在golang中者完全是两个不同的东西.官方的解释是,方法是包含了接 ...

  10. io异常

    针对异常,JVM默认的处理方案: 一旦遇到程序出现了问题,就会把问题的类名,错误原因,错误的位置等信息打印在控制台,以便我们观察. 并且,会自动从当前出问题的地方停止掉.这种处理方案虽然可以,但是不够 ...