在 Debian(以及其他 Linux 发行版)中,ifconfig 是一个用于配置和查看网络接口信息的命令行工具,属于传统的 net-tools 工具集。
查看网络接口信息
ifconfig
eth0、wlan0、lo)启用 / 禁用网络接口
sudo ifconfig eth0 up
sudo ifconfig eth0 down
配置 IP 地址
sudo ifconfig eth0 192.168.1.100 netmask 255.255.255.0
配置广播地址
sudo ifconfig eth0 broadcast 192.168.1.255
修改 MAC 地址(临时)
sudo ifconfig eth0 hw ether 00:11:22:33:44:55
查看所有接口(包括未激活的)
ifconfig -a
ifconfig 已被逐步废弃
ip 命令(iproute2)ip addr
ip link
ip route
ifconfig 的修改重启后失效(除非写入配置文件)sudo apt update
sudo apt install net-tools
ifconfig 用于查看和临时配置网络接口,适合快速排查网络问题,但在现代 Debian 中更推荐使用 ip 命令。
如果你是 服务器运维 / 桌面用户 / 学习用途,我可以给你对应场景的示例。