當前位置:首頁 » 雲伺服器 » 伺服器如何查看IP

伺服器如何查看IP

發布時間: 2022-01-08 18:14:41

❶ 怎麼查看linux伺服器的ip地址

我們可以通過如下方法獲取linux系統伺服器的公網IP出口。可以根據自己不同需求方式進行調用。

下面小編收集一些方法:
curl 純文本格式輸出:
curl http://icanhazip.com
curl http://ifconfig.me
curl http://curlmyip.com
curl http://ip.appspot.com
curl http://ipinfo.io/ip
curl http://ipecho.net/plain
curl http://www.trackip.net/i
curl XML格式輸出:
curl http://ifconfig.me/all.xml
curl JSON格式輸出:
curl http://ipinfo.io/json
curl http://ifconfig.me/all.json
curl http://www.trackip.net/ip?json
curl 得到所有IP細節 (挖掘機):
curl http://ifconfig.me/all
使用 DYDNS (當你使用 DYDNS 服務時有用)
curl -s 'http://checkip.dyndns.org' | sed 's/.*Current IP Address: ([0-9.]*).*/1/g'
curl -shttp://checkip.dyndns.org/ | grep -o;"[[:digit:].]+"
使用 Wget 代替 Curl
wgethttp://ipecho.net/plain -O - -q ; echo
wgethttp://observebox.com/ip -O - -q ; echo
使用 host 和 dig 命令
host -t a http://dartsclink.com | sed 's/.*has address //'
dig +short http://myip.opendns.com @resolver1.opendns.com<pr》
bash 腳本示例:
#!/bin/bash
PUBLIC_IP=`wgethttp://ipecho.net/plain -O - -q ; echo`
echo $PUBLIC_IP
這里獲取到公網IP以後,自己還上傳到了一個線上伺服器,畢竟公司這里申請的是公網IP,每隔幾天都要更換一下。家裡或其他地方如果要連接公司內部的虛擬機或管理路由器,就要獲取准確公網IP才可以。
這里就簡單寫了一個腳本定期執行,獲取到公網IP以後上傳到一台線上的伺服器,這樣每次可以直接通過登錄伺服器獲取到公司的公網出口IP了,公司內部測試機器linux上部署的腳本如下:
#!/bin/bash
curl http://ipinfo.io/ip > public_ip.txt
rsync -avz /home/yunwei/public_ip.txt 1.2.3.4:/home/yunwei/
以後每次到線上1.2.3.4的伺服器cat /home/yunwei/public_ip.txt 就知道公司IP了。

❷ 如何查看本機的伺服器IP和埠

方法步驟如下:

1、首先打開計算機,在計算機內打開運行界面,在運行界面的輸入框內輸入cmd。

熱點內容
java數組的定義方法 發布:2025-03-14 00:53:25 瀏覽:515
壓縮性綳帶 發布:2025-03-14 00:30:21 瀏覽:181
如何給樹莓派編譯適合的軟體 發布:2025-03-14 00:29:45 瀏覽:374
c語言編譯器雲盤鏈接 發布:2025-03-14 00:25:23 瀏覽:346
電腦上哪個游戲可以移植到安卓上 發布:2025-03-14 00:10:32 瀏覽:472
tcl編譯器 發布:2025-03-13 23:52:59 瀏覽:322
linuxnamed 發布:2025-03-13 23:45:29 瀏覽:362
阿里雲30元伺服器 發布:2025-03-13 23:21:25 瀏覽:352
pythonstatvfs 發布:2025-03-13 23:14:55 瀏覽:955
火車上有密碼多少 發布:2025-03-13 23:14:10 瀏覽:867