温馨提示×

Debian ifconfig显示什么内容

小樊
55
2026-09-03 11:50:59
栏目: 智能运维

在 Debian(以及其他 Linux 发行版)中,ifconfig 用于显示或配置网络接口信息。不过需要注意:

现代 Debian 默认可能未安装 ifconfig,它属于 net-tools 包;新系统更推荐使用 ip 命令(ip addr)。


一、ifconfig 显示的主要内容

执行:

ifconfig

或查看某个接口:

ifconfig eth0

典型输出示例:

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 123456  bytes 98765432 (94.1 MiB)
      RX errors 0  dropped 0  overruns 0  frame 0
      TX packets 654321  bytes 123456789 (117.7 MiB)
      TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

二、各字段含义说明

1. 接口名称

eth0
  • 有线网卡(传统命名)
  • 新系统可能是 ens33、enp0s3 等

2. flags(接口状态)

flags=4163<UP,BROADCAST,RUNNING,MULTICAST>

常见标志:

  • UP:接口已启用
  • BROADCAST:支持广播
  • RUNNING:已连接(网线已插)
  • MULTICAST:支持多播
  • LOOPBACK:回环接口(lo)

3. MTU

mtu 1500
  • 最大传输单元(字节)

4. IPv4 地址信息

inet 192.168.1.100  netmask 255.255.255.0  broadcast 192.168.1.255
  • inet:IPv4 地址
  • netmask:子网掩码
  • broadcast:广播地址

5. IPv6 地址

inet6 fe80::20c:29ff:fe12:3456  prefixlen 64
  • fe80::/10 为链路本地地址

6. MAC 地址

ether 00:0c:29:12:34:56
  • 网卡物理地址

7. 收发包统计

RX packets / bytes   # 接收
TX packets / bytes   # 发送
  • errors / dropped / overruns:错误与丢包情况

三、查看所有接口(包括未启用)

ifconfig -a

四、Debian 没有 ifconfig 怎么办?

安装:

sudo apt update
sudo apt install net-tools

或使用推荐命令:

ip addr
ip link

如果你愿意,我可以:

  • 帮你解读你当前的 ifconfig 输出
  • 对比 ifconfig 和 ip 命令
  • 说明 Debian 网络配置(/etc/network/interfaces 或 NetworkManager)

0 踩