当前位置:首页 » 云服务器 » 服务器如何查看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返回this 发布:2025-10-20 08:28:16 浏览:539
制作脚本网站 发布:2025-10-20 08:17:34 浏览:826
python中的init方法 发布:2025-10-20 08:17:33 浏览:529
图案密码什么意思 发布:2025-10-20 08:16:56 浏览:712
怎么清理微信视频缓存 发布:2025-10-20 08:12:37 浏览:632
c语言编译器怎么看执行过程 发布:2025-10-20 08:00:32 浏览:944
邮箱如何填写发信服务器 发布:2025-10-20 07:45:27 浏览:201
shell脚本入门案例 发布:2025-10-20 07:44:45 浏览:61
怎么上传照片浏览上传 发布:2025-10-20 07:44:03 浏览:754
python股票数据获取 发布:2025-10-20 07:39:44 浏览:657