linux 下获取 互联网ip

方式一:

 [root@centos200 monitor_adsl_connect]# ifconfig

 

方式二:

[oracle@localhost ~]$ curl http://www.ip138.com/ip2city.asp | grep body | awk -F "[" '{print $2}'| awk -F "]' '{print $1}'
114.249.210.26

 方式三:

[wusx@centos245 CycleTaskManager]$ curl -s 'http://checkip.dyndns.org' | sed 's/.*Current IP Address: \([0-9\.]*\).*/\1/g'
114.249.221.61

猜你喜欢

转载自wushexin.iteye.com/blog/1010754