preload
七月 09


或許您會覺得很奇怪, 為何會想要降速. 當然啦, 我不會閒閒沒事幹, 做這種無聊的事.
最近剛把家裡的其中一台Server換電腦主機, 改用Shuttle 的X27D. 目的是為了省電.
本來使用後一切還算正常, 前一陣子, 想要copy 一些檔案到這台server中, 我是用FTP來傳檔.
同時傳輸約5個檔案, 但是每傳一下子, 這台server就沒回應了, 連ping都沒反應.
本以為他當機了, 跑到server前看, 機器還活著, 只有ethernet死了….
連續試了幾次, 都一樣的結果.
最後查了/var/log/message 來看, 似乎是這裡的問題:
hns2 kernel: NETDEV WATCHDOG: eth0: transmit timed out
我懷疑是ethernet driver設計不良所造成的(或許是我的直覺吧!!, 我對於realtek的ethernet controller都沒信心耶!!)
這台機器的ethernet controller是Realtek 的RTL8168c/8111c (我不是很確定), 應該是PCI Express的1Gb ethernet網卡.
所以我想將他降速試試看.
查了realtek driver中的readme檔. 其中一段描述如下:


Force Link Status

        1. Force the link status when insert the driver.

           If the user is in the path ~/r8168, the link status can be forced
           to one of the 5 modes as following command.

                # insmod ./src/r8168.ko speed=SPEED_MODE duplex=DUPLEX_MODE autoneg=NWAY_OPTION

                ,where
                        SPEED_MODE      = 1000  for 1000Mbps
                                        = 100   for 100Mbps
                                        = 10    for 10Mbps
                        DUPLEX_MODE     = 0     for half-duplex
                                        = 1     for full-duplex
                        NWAY_OPTION     = 0     for auto-negotiation off (true force)
                                        = 1     for auto-negotiation on (nway force)
                For example:

                        # insmod ./src/r8168.ko speed=100 duplex=0 autoneg=1

                will force PHY to operate in 100Mpbs Half-duplex(nway force).

        2. Force the link status by using ethtool.
                a. Insert the driver first.
                b. Make sure that ethtool exists in /sbin.
                c. Force the link status as the following command.

                        # ethtool -s ethX speed SPEED_MODE duplex DUPLEX_MODE autoneg NWAY_OPTION

                        ,where
                                SPEED_MODE      = 1000  for 1000Mbps
                                                = 100   for 100Mbps
                                                = 10    for 10Mbps
                                DUPLEX_MODE     = half  for half-duplex
                                                = full  for full-duplex
                                NWAY_OPTION     = off   for auto-negotiation off (true force)
                                                = on    for auto-negotiation on (nway force)

                For example:

                        # ethtool -s eth0 speed 100 duplex full autoneg on

                will force PHY to operate in 100Mpbs Full-duplex(nway force).

所以我使用如下指令將其降速成100Mbps


ethtool -s eth0 speed 100 duplex full autoneg off

目前使用狀況還算穩定, 並且持續觀察中….

Comments are closed.