温馨提示×

debian ifconfig支持ipv6吗

小樊
41
2026-09-12 11:18:34
栏目: 智能运维

Debian 中,ifconfig 是支持显示 IPv6 地址的,但有一些前提和限制:

1. 是否显示 IPv6

  • 如果网卡已经配置了 IPv6 地址(包括链路本地 fe80::/10),ifconfig 默认就会显示
  • 例如:
    ifconfig eth0
    
    输出中通常会看到:
    inet6 addr: fe80::20c:29ff:feXX:XXXX/64 Scope:Link
    

2. 是否能“配置” IPv6

  • 传统 net-tools 的 ifconfig 可以配置 IPv6,例如:
    ifconfig eth0 inet6 add 2001:db8::1/64
    
  • 但功能不如 ip 命令完整,例如:
    • 不支持某些高级路由
    • 对 IPv6 的状态管理较弱

3. Debian 的现状(重要)

  • Debian 新版本(如 Debian 10+)默认不再安装 net-tools
  • ifconfig 属于 net-tools,需要手动安装:
    sudo apt install net-tools
    
  • 官方推荐使用的是 ip 命令(iproute2)
    ip -6 addr show
    ip -6 route show
    

4. 总结

ifconfig 支持 IPv6(显示和简单配置)
⚠️ 功能有限,不建议作为主力工具
推荐在 Debian 中使用 ip 命令管理 IPv6

如果你愿意,我可以给你一份 ifconfig vs ip 的 IPv6 对照命令表

0