curl icanhazip.com
curl ifconfig.me
curl curlmyip.com
curl ip.appspot.com
curl ipinfo.io/ip
curl ipecho.net/plain
curl www.trackip.net/i
2.curl JSON格式输出:
curl ipinfo.io/jsoncurl ifconfig.me/all.jsoncurl www.trackip.net/ip?json (有点丑陋)
3.curl XML格式输出:
curl ifconfig.me/all.xml
4.curl 得到所有IP细节 (挖掘机)
curl ifconfig.me/all
5.使用 DYDNS (当你使用 DYDNS 服务时有用)
curl -s 'http://checkip.dyndns.org' | sed 's/.*Current IP Address: \([0-9\.]*\).*/\1/g'
curl -s http://checkip.dyndns.org/ | grep -o "[[:digit:].]\+"
6.使用 Wget 代替 Curl
wget http://ipecho.net/plain -O - -q echo
wget http://observebox.com/ip -O - -q echo
7.使用 host 和 dig 命令
如果有的话,你也可以直接使用 host 和 dig 命令。
host -t a dartsclink.com | sed 's/.*has address //'
dig +short myip.opendns.com @resolver1.opendns.com
8.bash 脚本示例:
#!/bin/bash
PUBLIC_IP=`wget http://ipecho.net/plain -O - -q echo`
echo $PUBLIC_IP
1、首先连接到Linux主机并进入命令行状态。
2、在命令行状态下,输入命令:netstat -ntu | awk'{print $ 5}'| cut -d:-f1 |排序| uniq -c | sort -n,按Enter键。
扩展资料
1、实现此的技术原理:在内网通过域名绑定服务器,外网SSH访问连接时,通过域名的访问,实现访问内网LINUX。
2、具体的实现过程如下:明确LINUX服务器内网访问地址端口,确保LINUX服务器正常开启SSH服务,在内网SSH可以正常访问连接。如图所示:
3、被访问端的Linux主机上使用nat123动态域名解析Linux版本。在被访问端的Linux服务器安装nat123客户端,并登录使用它。
4、登录网页,左侧用户中心,添加域名解析,选择动态域名解析并添加确认。选择动态域名解析记录,使用二级域名,或自己的域名。鼠标放在输入框有向导提示。如不理解负载均衡,不要勾选多点登录。
5、新添加动态解析后,等待几分钟生效。解析生效后,动态解析域名与本地公网IP是保持对应的。可以通过ping下域名核实,返回结果IP地址为本地公网IP地址时,表示动态解析生效正常。
6、路由器端口映射,路由映射SSH访问22端口。因为公网IP是在路由器上的,外网访问时,需要经过路由,需要在路由器上做端口映射,将内网LINUX服务器访问22端口打通。路由器端口映射位置:转发规则/虚拟服务器/添加允许外网访问端口和协议。我的LINUX服务器SSH服务端口是默认的22,我内网对应LINUX服务器主机的内网IP地址是192.168.1.29。
在linux服务器上ping一个外放的IP地址,查看是否能够ping通如果可以ping通,则linux具有访问外网的能力
使用ifconfig查看是否拥有公网IP,如果只有内网IP,则说明linux位于内网之中,没有专属的公网IP
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)