温馨提示×

debian ifconfig显示什么

小樊
48
2026-09-12 11:13:35
栏目: 智能运维

在 Debian(以及其他 Linux 发行版)中,ifconfig 命令用于显示和配置网络接口信息。不过需要注意:较新版本的 Debian 默认可能没有安装 ifconfig(它属于 net-tools 包,已被 ip 命令取代)。


一、ifconfig 显示什么内容

如果在 Debian 中执行:

ifconfig

典型输出示例:

eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
      inet 192.168.1.100  netmask 255.255.255.0  broadcast 192.168.1.255
      inet6 fe80::20c:29ff:fe12:3456  prefixlen 64  scopeid 0x20<link>
      ether 00:0c:29:12:34:56  txqueuelen 1000  (Ethernet)
      RX packets 12345  bytes 987654 (987.6 KB)
      RX errors 0  dropped 0  overruns 0  frame 0
      TX packets 7654  bytes 654321 (654.3 KB)
      TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
      inet 127.0.0.1  netmask 255.0.0.0
      inet6 ::1  prefixlen 128  scopeid 0x10<host>
      loop  txqueuelen 1000  (Local Loopback)
      RX packets 100  bytes 8000
      TX packets 100  bytes 8000

二、各字段含义说明

1. 网络接口名

  • eth0:有线网卡
  • wlan0:无线网卡
  • lo:回环接口(localhost)

2. flags(接口状态)

常见标志:

  • UP:接口已启用
  • BROADCAST:支持广播
  • RUNNING:正在运行
  • MULTICAST:支持多播

3. IP 地址信息

  • inet:IPv4 地址
  • netmask:子网掩码
  • broadcast:广播地址
  • inet6:IPv6 地址

4. MAC 地址

  • ether:网卡物理地址

5. 统计信息

  • RX:接收数据
  • TX:发送数据
  • errors / dropped / collisions:错误和丢包情况

三、只查看某个网卡

ifconfig eth0

四、Debian 新版本说明(重要)

在 Debian 9 及以后,ifconfig 可能不存在,需要安装:

sudo apt update
sudo apt install net-tools

或者使用推荐命令:

ip addr

或

ip a

五、总结一句话

ifconfig 用于显示 Debian 系统中网络接口的 IP 地址、MAC 地址、状态和流量统计信息。

如果你愿意,我可以帮你:

  • 解读你当前的 ifconfig 输出
  • 对比 ifconfig 和 ip 命令
  • 配置静态 IP 或网络故障排查

0 踩