一般网卡可以和交换机自动协商使用100Mb全双工,如果协商失败,可能看到诸如"late collision"一类的消息,出现丢包甚至完全不能工作的现象。为了强行指定使用某一确定的工作模式,比如100Mb FD,可以用ndd做如下操作:
# 指定操作hme0接口
ndd -set /dev/hme instance 0
# 关闭自动协商
ndd -set /dev/hme adv_autoneg_cap 0
# 打开100Mb FD支持
ndd -set /dev/hme adv_100fdx_cap 1
# 关闭100Mb HD支持
ndd -set /dev/hme adv_100hdx_cap 0
# 关闭10Mb FD支持
ndd -set /dev/hme adv_10fdx_cap 0
# 关闭10Mb HD支持
ndd -set /dev/hme adv_10hdx_cap 0
同样需要在对端(比如交换机)强行指定使用100Mb FD模式。
注意:Fast ethernet hubs 总是使用100Mb HD模式
ethernet hubs 总是使用10Mb HD模式
如果你想强行指定系统中所有hme网卡在启动时进入同一确定模式,可以在/etc/system文件中设置,下例表示进入100Mbit FD模式:
set hme:hme_adv_autoneg_cap=0
set hme:hme_adv_100fdx_cap=1
set hme:hme_adv_100hdx_cap=0
set hme:hme_adv_10hdx_cap=0
set hme:hme_adv_10fdx_cap=0
可以用如下命令获取当前设置
# ndd -get /dev/hme link_mode
0 半双工
1 全双工
# ndd -get /dev/hme link_status
0 Link Down
1 Link up
# ndd -get /dev/hme link_speed
0 10Mbps
1 100Mbps
附:
/etc/system文件的写法
set hme:hme_adv_autoneg_cap=0
set hme:hme_adv_100T4_cap=0
set hme:hme_adv_100fdx_cap=1
set hme:hme_adv_100hdx_cap=0
set hme:hme_adv_10fdx_cap=0
set hme:hme_adv_10hdx_cap=0
set eri:adv_autoneg_cap=0
set eri:adv_100T4_cap=0
set eri:adv_100fdx_cap=1
set eri:adv_100hdx_cap=0
set eri:adv_10fdx_cap=0
set eri:adv_10hdx_cap=0
set qfe:qfe_adv_autoneg_cap=0
set qfe:qfe_adv_100T4_cap=0
set qfe:qfe_adv_100fdx_cap=1
set qfe:qfe_adv_100hdx_cap=0
set qfe:qfe_adv_10fdx_cap=0
set qfe:qfe_adv_10hdx_cap=0
set ce:adv_autoneg_cap=0
set ce:adv_100T4_cap=0
set ce:adv_100fdx_cap=1
set ce:adv_100hdx_cap=0
set ce:adv_1000fdx_cap=0
set ce:adv_1000hdx_cap=0
set ce:adv_10fdx_cap=0
set ce:adv_10hdx_cap=0
命令行(重启后消失,可以添加到/etc/rc2.d的启动脚本中)
ndd -set /dev/hme instance 0
ndd -set /dev/hme adv_100fdx_cap 1
ndd -set /dev/hme adv_100hdx_cap 0
ndd -set /dev/hme adv_10fdx_cap 0
ndd -set /dev/hme adv_10hdx_cap 0
ndd -set /dev/hme adv_autoneg_cap 0
ndd -set /dev/eri instance 0
ndd -set /dev/eri adv_100fdx_cap 1
ndd -set /dev/eri adv_100hdx_cap 0
ndd -set /dev/eri adv_10fdx_cap 0
ndd -set /dev/eri adv_10hdx_cap 0
ndd -set /dev/eri adv_autoneg_cap 0