温馨提示×

debian ifconfig如何查ip

小樊
34
2026-09-24 20:51:26
栏目: 智能运维

在 Debian 中查看 IP 地址,常用方法如下:

1. 使用 ifconfig(需安装 net-tools)

ifconfig

如果提示 command not found,先安装:

sudo apt update
sudo apt install net-tools

查看某个网卡(如 eth0):

ifconfig eth0

IP 地址在 inet 后面。

2. 推荐:使用 ip 命令(默认已安装)

ip addr

或简写:

ip a

要只看 IPv4:

ip -4 addr

3. 快速查看本机出口 IP(公网)

curl ifconfig.me

curl icanhazip.com

如果你是最小化 Debian 系统,建议直接用 ip a,比 ifconfig 更现代也更常用。

0