Debian ifconfig 高级配置技巧
一 常用高级操作速查
二 进阶用法与实用脚本
#!/usr/bin/env bash
for i in {1..3}; do
sudo ifconfig eth0:${i} 192.168.1.$((100+i)) netmask 255.255.255.0 up
done
#!/usr/bin/env bash
IFACE=eth0
sudo ifconfig "$IFACE" promisc up
echo "Started promiscuous mode on $IFACE. Use 'sudo ifconfig $IFACE -promisc' to turn off."
三 持久化配置与 ip 命令替代
auto eth0
iface eth0 inet static
address 192.168.1.100
netmask 255.255.255.0
gateway 192.168.1.1
dns-nameservers 8.8.8.8 8.8.4.4
mtu 1500
auto eth0:1
iface eth0:1 inet static
address 192.168.1.101
netmask 255.255.255.0
四 故障排查与最佳实践