---
title: "Linux查看公网IP"
author: "nicegege"
date: "2019-06-21T14:38:43Z"
tags: []
categories: ["操作系统"]
slug: "linux-ip"
draft: false
lastmod: "2019-06-21T14:38:43Z"
id: 2442045
url: "https://nicegege.iteye.com/blog/2442045"
---

1.linux服务器查看公网IP信息的方法

最近，经常碰到第三方对接接口。给第三方提供公网IP地址，添加到IP白名单中。

最好的办法是，自己掌握了怎么查看公网IP信息。而不是每次咨询运维同事获取公网IP。

(1) curl ifconfig.me

```
在linux系统中输入上述的命令，可以查看到本机连接的公网信息；
如果该命令无效，可以使用下面一个命令，也同样可以获得对应的信息
```

 (2) curl cip.cc