---
title: "linux 下获取 互联网ip"
author: "wushexin"
date: "2011-04-21T09:55:23Z"
tags: []
categories: ["操作系统"]
slug: "linux-ip"
draft: false
lastmod: "2011-04-21T10:01:06Z"
id: 1010754
url: "https://wushexin.iteye.com/blog/1010754"
---

方式一：

 \[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
```