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

热点内容
真我手机如何修改登录密码 发布:2025-09-17 05:20:26 浏览:313
电脑配置怎么说 发布:2025-09-17 04:37:45 浏览:1001
三质数编程 发布:2025-09-17 04:04:41 浏览:559
ftp服务器密码如何修改 发布:2025-09-17 03:48:07 浏览:302
python爬虫豆瓣 发布:2025-09-17 03:41:59 浏览:210
我的世界国际版加入服务器电脑版 发布:2025-09-17 03:41:14 浏览:940
附件上传相片 发布:2025-09-17 03:39:53 浏览:442
微信账号密码组合是什么 发布:2025-09-17 03:30:05 浏览:400
windows如何查看ftp安装环境 发布:2025-09-17 03:30:02 浏览:918
java培训机构推荐 发布:2025-09-17 03:20:58 浏览:93