ifconfig
是一个用于配置和显示 Linux 内核中网络接口的命令行实用程序。在 Debian 系统中,你可以使用 ifconfig
来执行以下操作:
ifconfig
这将显示系统上所有活动网络接口的详细信息,包括 IP 地址、子网掩码、广播地址等。
ifconfig 接口名
将 “接口名” 替换为你想要查看的网络接口名称,例如 eth0
或 wlan0
。
sudo ifconfig 接口名 IP地址 netmask 子网掩码
例如,要将 eth0
接口的 IP 地址设置为 192.168.1.10
,子网掩码为 255.255.255.0
,请执行以下命令:
sudo ifconfig eth0 192.168.1.10 netmask 255.255.255.0
sudo ifconfig 接口名 up
将 “接口名” 替换为你想要启用的网络接口名称。
sudo ifconfig 接口名 down
将 “接口名” 替换为你想要禁用的网络接口名称。
请注意,ifconfig
命令在某些 Debian 版本中可能已被弃用,建议使用 ip
命令替代。要使用 ip
命令执行上述操作,请参阅 ip
命令的手册页(通过运行 man ip
查看)。