Linux命令终端如何查询本机的内外网IP地址
生活随笔
收集整理的這篇文章主要介紹了
Linux命令终端如何查询本机的内外网IP地址
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
文章目錄
- 查詢本機外網 IP 地址
- 查詢本機內網 IP 地址
查詢本機外網 IP 地址
[root@htlwk0001host ~]# curl ifconfig.me # 太慢了,不行[root@htlwk0001host ~]# curl icanhazip.com 47.114.59.104[root@htlwk0001host ~]# curl ident.me # 太慢了,不行[root@htlwk0001host ~]# curl whatismyip.akamai.com 47.114.59.224[root@htlwk0001host ~]# [root@htlwk0001host ~]# curl tnx.nl/ip # 不行 127.0.0.1 --- after 12 years of service, tnx.nl/ip is no more. ---[root@htlwk0001host ~]# curl myip.dnsomatic.com 47.114.59.224[root@htlwk0001host ~]# [root@htlwk0001host ~]# curl myip.ipip.net 當前 IP:47.114.59.104 來自于:中國 浙江 杭州 阿里云/電信/聯通/移動/教育網[root@htlwk0001host ~]# curl http://members.3322.org/dyndns/getip 47.114.59.104查詢本機內網 IP 地址
[root@htlwk0001host ~]# ifconfig eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500inet 172.19.116.91 netmask 255.255.240.0 broadcast 172.19.127.255inet6 fe80::216:3eff:fe15:b7f3 prefixlen 64 scopeid 0x20<link>ether 00:16:3e:15:b7:f3 txqueuelen 1000 (Ethernet)RX packets 39472104 bytes 15521220904 (14.4 GiB)RX errors 0 dropped 0 overruns 0 frame 0TX packets 38258459 bytes 15199147861 (14.1 GiB)TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536inet 127.0.0.1 netmask 255.0.0.0inet6 ::1 prefixlen 128 scopeid 0x10<host>loop txqueuelen 1000 (Local Loopback)RX packets 17170519 bytes 9777458856 (9.1 GiB)RX errors 0 dropped 0 overruns 0 frame 0TX packets 17170519 bytes 9777458856 (9.1 GiB)TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0[root@htlwk0001host ~]# ifconfig eth0 eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500inet 172.19.116.91 netmask 255.255.240.0 broadcast 172.19.127.255inet6 fe80::216:3eff:fe15:b7f3 prefixlen 64 scopeid 0x20<link>ether 00:16:3e:15:b7:f3 txqueuelen 1000 (Ethernet)RX packets 39472688 bytes 15521320121 (14.4 GiB)RX errors 0 dropped 0 overruns 0 frame 0TX packets 38259098 bytes 15199345538 (14.1 GiB)TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0說明:
eth0:是指第一個物理網卡,具體叫光纖以太網接口卡,學名 Fiber Ethernet Adapter0。物理網卡這里指的是服務器上實際的網絡接口設備,這里我服務器上雙網卡,在系統中看到多個物理網卡則分別對應 eth0、eth1、eth2…,類似 Windows 裝了好幾個網卡,會顯示本地連接1、本地連接2、本地連接3…
lo:localhost,127.0.0.1
en0:en0 是邏輯上的網絡接口名,enx(x是一個數字,代表第幾塊網卡)是標準以太網接口,ent0 是物理設備,en0 是邏輯設備。查看網絡接口信息時,假設看到三個網絡接口,en0, en1, en2,但是只有 en1 的狀態是 Available 的,說明目前只有這個口已經插上網線在使用,而其它的并沒有在用
總結
以上是生活随笔為你收集整理的Linux命令终端如何查询本机的内外网IP地址的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: linux的复制命令(linux的复制)
- 下一篇: 已经创建了AWS EC2实例,Linux