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
命令提供了更強大、靈活的網絡配置選項。