
據我所知,以下指令將設定自動協商通告的速度和雙工。
ethtool -s eth0 advertise 0x020
其中根據以下指南0x020
進行指示:1000baseT Full
advertise N
Sets the speed and duplex advertised by autonegotiation. The
argument is a hexadecimal value using one or a combination of
the following values:
0x001 10baseT Half
0x002 10baseT Full
0x004 100baseT Half
0x008 100baseT Full
0x010 1000baseT Half (not supported by IEEE standards)
0x020 1000baseT Full
我應用的命令1000baseT Full
僅用於廣告。我想知道如何設定伺服器來1000baseT Full 100baseT Full 100baseT Half
同時通告多種連結模式。
我嘗試過對所需的連結模式一一應用相同的命令,但每次新的連結模式都會替換當前模式並且不會添加到其中。
我還連續提到了連結模式十六進位代碼,如下所示,但它會傳回錯誤。
ethtool -s eth0 advertise 0x020 0x008 0x004
ethtool: bad command line argument(s)
For more information run ethtool -h
當所有內容都被公佈後,它們將顯示在ethtool
輸出中,如下所示:
ethtool eth0
Settings for eth0:
Supported ports: [ TP ]
Supported link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
1000baseT/Half 1000baseT/Full
Supported pause frame use: No
Supports auto-negotiation: Yes
Advertised link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
1000baseT/Half 1000baseT/Full
有什麼想法嗎?
答案1
把數字加起來。觀察到:
0x001
是0b000000000001
,0x002
是0b000000000010
,0x004
是0b000000000100
,
依此類推,它們中的每一個都代表某個暫存器中的一位(標誌),該暫存器儲存啟用的模式。您只需啟用所有需要的位元即可。
在你的情況下,1000baseT Full
,100baseT Full
和100baseT Half
將是0x020 + 0x008 + 0x004 = 0x02c
:
ethtool -s eth0 advertise 0x02c