温馨提示×

debian ifconfig怎么查ip

小樊
44
2026-09-21 19:01:59
栏目: 智能运维

在 Debian 系统中,查看 IP 地址常用以下几种方式:

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

ifconfig

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

sudo apt update
sudo apt install net-tools

然后:

ifconfig

通常 inet 后面就是 IP 地址(如 192.168.1.100)。

只看某个网卡(如 eth0):

ifconfig eth0

2. 推荐方式:使用 ip 命令(Debian 默认自带)

ip addr

或简写:

ip a

找到你的网卡(如 eth0、ens33、wlan0),inet 后面就是 IP。

只看 IPv4:

ip -4 addr

3. 快速查看本机对外 IP(公网 IP)

curl ifconfig.me

或

curl icanhazip.com

如果你是刚装好的 Debian 最小化系统,ifconfig 一般是没有的,建议直接用 ip a。

0 踩