当前位置:首页 » 云服务器 » 如何看服务器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了。

热点内容
单片机android 发布:2024-09-20 09:07:24 浏览:760
如何提高三星a7安卓版本 发布:2024-09-20 08:42:35 浏览:660
如何更换服务器网站 发布:2024-09-20 08:42:34 浏览:308
子弹算法 发布:2024-09-20 08:41:55 浏览:285
手机版网易我的世界服务器推荐 发布:2024-09-20 08:41:52 浏览:813
安卓x7怎么边打游戏边看视频 发布:2024-09-20 08:41:52 浏览:159
sql数据库安全 发布:2024-09-20 08:31:32 浏览:90
苹果连接id服务器出错是怎么回事 发布:2024-09-20 08:01:07 浏览:503
编程键是什么 发布:2024-09-20 07:52:47 浏览:655
学考密码重置要求的证件是什么 发布:2024-09-20 07:19:46 浏览:479