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

如何看伺服器ip

發布時間: 2022-01-10 01:32:48

1. 如何查伺服器ip地址

在伺服器上的cmd窗口中輸入ipconfig,便可以查詢ip地址。希望可以幫到你~

2. 怎麼查看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了。

熱點內容
sql資料庫安全 發布:2024-09-20 08:31:32 瀏覽:87
蘋果連接id伺服器出錯是怎麼回事 發布:2024-09-20 08:01:07 瀏覽:502
編程鍵是什麼 發布:2024-09-20 07:52:47 瀏覽:651
學考密碼重置要求的證件是什麼 發布:2024-09-20 07:19:46 瀏覽:477
電腦主伺服器怎麼開機 發布:2024-09-20 07:19:07 瀏覽:728
2022款瑞虎升級哪些配置 發布:2024-09-20 06:59:07 瀏覽:264
資料庫與asp 發布:2024-09-20 06:55:25 瀏覽:727
python解釋編譯 發布:2024-09-20 06:52:57 瀏覽:648
舞蹈豐收腳本 發布:2024-09-20 06:36:26 瀏覽:595
linux進程埠號 發布:2024-09-20 06:36:11 瀏覽:80