在 较新版本的 Debian(以及大多数现代 Linux 发行版)中,ifconfig 默认不再安装,主要原因如下:
ifconfig 属于 net-tools,已被弃用ifconfig 来自 net-tools 软件包net-tools 项目 早已停止维护(最后一次重大更新在 2001 年左右)iproute2 替代Debian 官方从 Debian 9(Stretch) 开始:
默认 不再安装
net-tools
ip 命令现代 Debian 使用 iproute2 提供的 ip 命令:
| 旧命令 (ifconfig) | 新命令 (ip) |
|---|---|
ifconfig |
ip addr / ip a |
ifconfig eth0 up |
ip link set eth0 up |
ifconfig eth0 192.168.1.10 |
ip addr add 192.168.1.10/24 dev eth0 |
route |
ip route |
arp |
ip neigh |
net-tools可以手动安装:
sudo apt update
sudo apt install net-tools
安装后即可使用:
ifconfig
⚠️ 但不推荐用于新系统或新脚本
✅ 使用:
ip a
ip route
ip link
✅ 网络配置:
/etc/network/interfacessystemd-networkdNetworkManagerDebian 没有 ifconfig,不是“少了”,而是“故意不用了”
因为它已被ip命令全面取代,更安全、更强大、更现代。
如果你愿意,我可以帮你把常用 ifconfig 命令翻译成 ip 命令对照表。