ifconfig
是一个用于配置和显示网络接口的命令行工具。在 Debian 系统中,它同样适用。以下是一些常用的 ifconfig
命令参数及其详解:
ifconfig
:不带任何参数运行此命令将显示所有活动网络接口的详细信息。
ifconfig <interface>
:用指定的网络接口替换 <interface>
,例如 ifconfig eth0
。这将显示指定接口的详细信息。如果接口不存在或未启动,将显示错误消息。
ifconfig <interface> up
:将指定的网络接口启动。例如,ifconfig eth0 up
。
ifconfig <interface> down
:将指定的网络接口关闭。例如,ifconfig eth0 down
。
ifconfig <interface> hw ether <mac_address>
:更改指定网络接口的硬件(MAC)地址。例如,ifconfig eth0 hw ether 00:11:22:33:44:55
。
ifconfig <interface> mtu <size>
:设置指定网络接口的最大传输单元(MTU)。例如,ifconfig eth0 mtu 1400
。
ifconfig <interface> netmask <netmask>
:设置指定网络接口的子网掩码。例如,ifconfig eth0 netmask 255.255.255.0
。
ifconfig <interface> broadcast <broadcast_address>
:设置指定网络接口的广播地址。例如,ifconfig eth0 broadcast 192.168.1.255
。
ifconfig <interface> pointopoint <address>
:为点对点连接设置指定网络接口的地址。例如,ifconfig eth0 pointopoint 192.168.1.2
。
ifconfig <interface> multicast
:启用指定网络接口的多播功能。
请注意,ifconfig
已被标记为已弃用,建议使用 ip
命令替代。ip
命令提供了更强大、灵活的网络配置选项。