ifconfig
是一个用于配置和显示 Linux 内核中网络接口的命令行实用程序。以下是一些常用的 ifconfig
命令参数及其解释:
ifconfig
:不带任何参数运行 ifconfig
将显示所有活动网络接口的详细信息。
ifconfig <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 <peer_address>
:设置指定网络接口的点对点地址。例如,ifconfig eth0 pointopoint 192.168.1.2
。
ifconfig <interface> multicast
:启用指定网络接口的多播功能。
请注意,ifconfig
命令在某些 Linux 发行版中可能已被弃用,建议使用 ip
命令替代。