温馨提示×

debian ifconfig如何查看ip

小樊
37
2026-09-30 16:41:38
栏目: 智能运维

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

1. 使用 ifconfig(传统方式)

如果系统已安装 net-tools:

ifconfig

查看某个网卡(如 eth0):

ifconfig eth0

IP 地址通常显示在 inet 一行(IPv4),inet6 是 IPv6。

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

sudo apt update
sudo apt install net-tools

2. 使用 ip 命令(推荐)

Debian 默认已支持:

ip addr

或简写:

ip a

查看某个网卡:

ip addr show eth0

3. 快速只查看 IP

hostname -I

示例输出说明

inet 192.168.1.100  netmask 255.255.255.0  broadcast 192.168.1.255

其中 192.168.1.100 就是本机 IP。

如果你是在 Debian 12+ 或最小化安装环境中,建议直接使用 ip a,ifconfig 已逐渐被淘汰。

0 踩