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
。