在 较新版本的 Debian(大约从 Debian 9 / 10 开始)中,ifconfig 命令“消失”,并不是真的被删除了,而是因为:
ifconfig 属于 net-tools,默认不再安装ifconfig 来自 net-tools 包iproute2iproute2 提供了更现代、更强大的命令:ip所以:
which ifconfig
# 没有任何输出
ip 替代 ifconfigifconfig 被认为:
对应替代关系:
| ifconfig | ip 命令 |
|---|---|
ifconfig |
ip addr |
ifconfig eth0 up |
ip link set eth0 up |
ifconfig eth0 192.168.1.10 |
ip addr add 192.168.1.10/24 dev eth0 |
ifconfig如果你确实想用:
sudo apt update
sudo apt install net-tools
安装后:
ifconfig
就可以正常使用了。
Debian 没“删” ifconfig,只是默认不再装 net-tools,推荐你用
ip命令。
如果你愿意,我可以给你一份 ifconfig → ip 命令对照速查表。