电子类pg是什么意思
新闻动态

linux查看外网ip地址的命令

发布日期:2025-03-07 15:33    点击次数:51

图片

前言

在使用Linux系统的时候,我们需要查看自己的外网IP地址,也就是公网IP地址。

方法一、curl命令

1、先安装curl命令:

红帽RHEL、CentOS执行以下命令:

yum -y install curl

Ubuntu系统执行命令:

sudo apt install curl -y

2、使用curl命令查询本地公网出口IP地址:

curl ifconfig.co

访问ifconfig.me或者icanhazip.com查询Linux公网IP

curl ifconfig.me
curl icanhazip.com

方法二、wget命令

1、先安装wget命令:

RHEL、CentOS执行命令:

yum install wget -y

Ubuntu系统执行命令:

sudo apt install wget -y

2、接着执行以下命令看你的公网IP地址:

wget -qO- http://ipecho.net/plain | xargs echo
或者
wget -qO - icanhazip.com
本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报。

下一篇:没有了

Powered by 电子类pg是什么意思 @2013-2022 RSS地图 HTML地图