linux 查看公网IP和获取网卡名称

获取网卡名称

lshw -c network | grep -E "logical name'  

一、命令查询 

方法1:

apt install curl

curl ifconfig.me

方法2:

echo `nc ns1.dnspod.net 6666`

方法3:

curl cip.cc

方法4:

curl ipinfo.io

方法5:

curl myip.ipip.net

 

二、网页查询法

方法1:登录网站:http://www.whatismyip.com/

方法2:登录网站:http://www.ip138.com/

方法2:登录网站: ifconfig.me/

————————————————————————————————————————————————————————————————————————————————————————————————————————————————

ifconfig.me 提供的其他接口

Command Line Interface

$ curl ifconfig.me 115.198.99.80
$ curl ifconfig.me/ip 115.198.99.80
$ curl ifconfig.me/host  
$ curl ifconfig.me/ua Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36 Edge/16.16299
$ curl ifconfig.me/port 30735
$ curl ifconfig.me/lang zh-CN
$ curl ifconfig.me/keepalive  
$ curl ifconfig.me/connection Keep-Alive
$ curl ifconfig.me/encoding gzip, deflate
$ curl ifconfig.me/mime text/html, application/xhtml+xml, image/jxr, */*
$ curl ifconfig.me/charset  
$ curl ifconfig.me/via  
$ curl ifconfig.me/forwarded  
$ curl ifconfig.me/all ip_addr: 115.198.99.80
remote_host:
user_agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36 Edge/16.16299
port: 30735
lang: zh-CN
connection: Keep-Alive
keep_alive:
encoding: gzip, deflate
mime: text/html, application/xhtml+xml, image/jxr, */*
charset:
via:
forwarded:
$ curl ifconfig.me/all.xml
    
    Keep-Alive
    gzip, deflate
    
    115.198.99.80
    
    zh-CN
    text/html, application/xhtml+xml, image/jxr, */*
    30735
    
    Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36 Edge/16.16299
    
$ curl ifconfig.me/all.json {"connection":"Keep-Alive","ip_addr":"115.198.99.80","lang":"zh-CN","remote_host":"","user_agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36 Edge/16.16299","charset":"","port":"30735","via":"","forwarded":"","mime":"text/html, application/xhtml+xml, image/jxr, */*","keep_alive":"","encoding":"gzip, deflate"}

你可能感兴趣的:(linux 查看公网IP和获取网卡名称)