ifconfig
命令在 Debian 中用于配置、激活和查詢網絡接口。以下是一些常用的 ifconfig
參數:
up
:
sudo ifconfig eth0 up
down
:
sudo ifconfig eth0 down
mtu
:
sudo ifconfig eth0 mtu 1500
broadcast
:
sudo ifconfig eth0 broadcast 192.168.1.255
pointopoint
:
sudo ifconfig eth0 pointopoint 192.168.1.2
all
:
ifconfig -a
inet
:
ifconfig eth0 inet
inet6
:
ifconfig eth0 inet6
netmask
:
ifconfig eth0 netmask
broadcast
:
ifconfig eth0 broadcast
mtu
:
ifconfig eth0 mtu
metric
:
sudo ifconfig eth0 metric 100
hw ether
:
sudo ifconfig eth0 hw ether 00:11:22:33:44:55
txqueuelen
:
sudo ifconfig eth0 txqueuelen 1000
激活 eth0
接口并設置IP地址:
sudo ifconfig eth0 up 192.168.1.100 netmask 255.255.255.0
顯示所有接口的詳細信息:
ifconfig -a
請注意,ifconfig
命令在較新的 Debian 版本中可能已被 ip
命令取代,因為 ip
命令提供了更強大和靈活的網絡管理功能。如果你使用的是較新的 Debian 版本,建議使用 ip
命令來替代 ifconfig
。