在较新的 Debian 版本中,ifconfig
命令已被弃用,取而代之的是 ip
命令。因此,建议使用 ip
命令来进行网络故障排查。不过,如果你仍在使用较旧的 Debian 版本,ifconfig
仍然可以使用。以下是使用 ifconfig
和 ip
命令进行网络故障排查的一些基本步骤:
ifconfig
进行网络故障排查查看所有网络接口:
ifconfig -a
检查特定网络接口的信息:
ifconfig eth0
检查IP地址和子网掩码:
ifconfig eth0 | grep 'inet '
检查网络连接状态:
ifconfig eth0 | grep 'UP'
重启网络接口:
sudo ifconfig eth0 down
sudo ifconfig eth0 up
ip
命令进行网络故障排查查看所有网络接口:
ip addr show all
检查特定网络接口的信息:
ip addr show eth0
检查IP地址和子网掩码:
ip addr show eth0 | grep 'inet '
检查网络连接状态:
ip link show eth0 | grep 'state UP'
重启网络接口:
sudo ip link set eth0 down
sudo ip link set eth0 up
添加或删除IP地址:
sudo ip addr add 192.168.1.100/24 dev eth0
sudo ip addr del 192.168.1.100/24 dev eth0
。