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
命令替代。