1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Auto vs 全二重と半二重(Full duplex & Half duplex)とSpeed

Posted at

EthernetのAuto vs 全二重・半二重および速度を実感

所持するL2Switch「TL-SG105PE」とUbuntuのethtoolを用いて、 Auto設定と全二重・半二重および速度を実感(比較)する。

環境

スクリーンショット 2025-01-04 15.37.18.png

  • L2SwitchとUbuntuとの間が設定の対象となるEthernet部分
    • L2SwitchのPort5にUbuntuが接続
  • 末端のMacとUbuntuとでiperfを実行(両者ともClientおよびServerとして動作させる)
  • MacからL2SwitchおよびUbuntuにリモートアクセスして制御

設定

L2Switch

使用する「TL-SG105PE」はIPアドレスを持つことができ、DHCP Clientにもなっている。ここでは、Mac上のDHCPサーバーからIPアドレスを取得し、ブラウザにて設定する。ここでの設定対象はPort5。

Default(Auto).png

デフォルトでは、上記のようにAuto設定となっている。Speed/Duplexをクリックすると変更可能。

ConfChange.png

下記は、100Mbpsかつ全二重(Full duplex)に設定した時の様子。

100MF.png

Ubuntu

ethtoolにより、DuplexおよびSpeedの変更が可能。デフォルトではAutoとなっている。下記はデフォルトの状況(接続先もAuto)。

$ sudo ethtool enp3s0f0
Settings for enp3s0f0:
	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
	Supported FEC modes: Not reported
	Advertised link modes:  10baseT/Half 10baseT/Full
	                        100baseT/Half 100baseT/Full
	                        1000baseT/Half 1000baseT/Full
	Advertised pause frame use: No
	Advertised auto-negotiation: Yes
	Advertised FEC modes: Not reported
	Link partner advertised link modes:  10baseT/Half 10baseT/Full
	                                     100baseT/Half 100baseT/Full
	                                     1000baseT/Full
	Link partner advertised pause frame use: No
	Link partner advertised auto-negotiation: Yes
	Link partner advertised FEC modes: Not reported
	Speed: 1000Mb/s
	Duplex: Full
	Auto-negotiation: on
	Port: Twisted Pair
	PHYAD: 1
	Transceiver: internal
	MDI-X: off
	Supports Wake-on: g
	Wake-on: d
        Current message level: 0x000000ff (255)
                               drv probe link timer ifdown ifup rx_err tx_err
	Link detected: yes

自身がサポートするDuplexおよびSpeed、自身が宣言しているもの、相手が宣言しているもの、実際のDuplexおよびSpeedが表示されている。いくつか設定サンプルを下記する。

$ sudo ethtool -s enp3s0f0 speed 100

$ sudo ethtool enp3s0f0
	Advertised link modes:  100baseT/Half 100baseT/Full

速度だけを指定すると、Full/Half duplexの双方の設定となる。FullかHalfのいずれかのみを設定する場合は明確に指定すればよい(下記)。

$ sudo ethtool -s enp3s0f0 speed 100 duplex half

$ sudo ethtool enp3s0f0
	Advertised link modes:  100baseT/Half

下記は、Ubuntuにて上記設定をしたときのL2Switchでの設定状況である。

U-100H.png

検証

iperfを用いて検証する。UDPにより速度(帯域)を指定。

L2Switch:Auto - Ubuntu:Auto

まずはAutoどうし(1000Mbps Full duplex)の実力を確認。iperfにて1Gbps指定で送る。

$ iperf3 -c 192.168.2.2 -u -b 1G -t 20  
Connecting to host 192.168.2.2, port 5201
[  5] local 192.168.2.1 port 49591 connected to 192.168.2.2 port 5201

[  5]  19.00-20.00  sec   115 MBytes   966 Mbits/sec  83377  
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval           Transfer     Bitrate         Jitter    Lost/Total Datagrams
[  5]   0.00-20.00  sec  2.22 GBytes   952 Mbits/sec  0.000 ms  0/1644457 (0%)  sender
[  5]   0.00-20.00  sec  2.21 GBytes   948 Mbits/sec  0.009 ms  6231/1642537 (0.38%)  receiver

950Mbps程度。こんなものであろう。Full duplexでの100Mbpsおよび10Mbps設定となっていた時の結果としても、95%程度の実力。

速度不一致

一方が100Mbps固定、もう一方が10Mbps固定のように速度が一致していないと、Link Downし、全く通信ができない(当たり前)。

Duplex不一致

一方がFull duplex、もう一方がHalf Duplexのような状況。非常に不安定であった。最大でもHalf duplexのパフォーマンスしか出ないようだ。下記は100MbpsのFull duplexとHalf duplexの組み合わせの結果。両末端(Mac、Ubuntu)にて、iperfのClientとServerとの双方をほぼ同時に実行(以降、ほぼ同様)。ここでは、110Mbpsの負荷をかけている。

Mac:Client --> Ubuntu:Server

$ iperf3 -c 192.168.2.2 -u -b 110m -t 20

[ ID] Interval           Transfer     Bitrate         Jitter    Lost/Total Datagrams
[  5]   0.00-20.00  sec   262 MBytes   110 Mbits/sec  0.000 ms  0/189910 (0%)  sender
[  5]   0.00-20.01  sec   228 MBytes  95.6 Mbits/sec  0.196 ms  24753/189908 (13%)  receiver

Ubuntu:Client --> Mac:Server

$ iperf3 -c 192.168.2.1 -u -b 110m -t 20

[ ID] Interval           Transfer     Bitrate         Jitter    Lost/Total Datagrams
[  5]   0.00-20.00  sec  23.3 MBytes  9.76 Mbits/sec  0.000 ms  0/16856 (0%)  sender
[  5]   0.00-21.67  sec  16.0 MBytes  6.19 Mbits/sec  0.328 ms  123/11698 (1.1%)  receiver

上記はたまたまデータが取得できたケース。送信側にて、指定速度で送れていない(半二重のため送信できないタイミングがある)。iperfが実行できないケースも多々あり。さらには、リモートアクセス切断も多々あり。

固定設定にて速度およびDuplex一致

お互いが固定で一致していれば、ほぼその速度が出る。面白みがないので省略。

L2Switch:Auto - Ubuntu:100Mbps Full-Duplex

L2Switch側はAuto、Ubuntu側にて速度およびDuplexを変化させる。110Mbpsの負荷。

Mac:Client --> Ubuntu:Server

$ iperf3 -c 192.168.2.2 -u -b 110m -t 20

[ ID] Interval           Transfer     Bitrate         Jitter    Lost/Total Datagrams
[  5]   0.00-20.00  sec   262 MBytes   110 Mbits/sec  0.000 ms  0/189910 (0%)  sender
[  5]   0.00-20.01  sec   228 MBytes  95.6 Mbits/sec  0.191 ms  24770/189909 (13%)  receiver

Ubuntu:Client --> Mac:Server

$ iperf3 -c 192.168.2.1 -u -b 110m -t 20

[ ID] Interval           Transfer     Bitrate         Jitter    Lost/Total Datagrams
[  5]   0.00-20.00  sec   228 MBytes  95.6 Mbits/sec  0.000 ms  0/165087 (0%)  sender
[  5]   0.00-20.01  sec   228 MBytes  95.6 Mbits/sec  0.129 ms  0/165031 (0%)  receiver

同時に実行しても、全二重のため、100Mbps弱の速度が出る。

L2Switch:Auto - Ubuntu:10Mbps Full-Duplex

同様に10Mbpsで実施。11Mbpsの負荷。

Mac:Client --> Ubuntu:Server

$ iperf3 -c 192.168.2.2 -u -b 11m -t 20

[ ID] Interval           Transfer     Bitrate         Jitter    Lost/Total Datagrams
[  5]   0.00-20.00  sec  26.2 MBytes  11.0 Mbits/sec  0.000 ms  0/18991 (0%)  sender
[  5]   0.00-20.08  sec  22.8 MBytes  9.54 Mbits/sec  0.399 ms  2461/18991 (13%)  receiver

Ubuntu:Client --> Mac:Server

$ iperf3 -c 192.168.2.1 -u -b 11m -t 20

[ ID] Interval           Transfer     Bitrate         Jitter    Lost/Total Datagrams
[  5]   0.00-20.00  sec  26.2 MBytes  11.0 Mbits/sec  0.000 ms  0/18991 (0%)  sender
[  5]   0.00-20.02  sec  22.8 MBytes  9.55 Mbits/sec  0.341 ms  2423/18938 (13%)  receiver

こちらも同様。双方向とも10Mbps弱の値。

L2Switch:Auto - Ubuntu:100Mbps Half-Duplex

今度は半二重設定。

Mac:Client --> Ubuntu:Server

$ iperf3 -c 192.168.2.2 -u -b 110m -t 20

[ ID] Interval           Transfer     Bitrate         Jitter    Lost/Total Datagrams
[  5]   0.00-20.00  sec   262 MBytes   110 Mbits/sec  0.000 ms  0/189910 (0%)  sender
[  5]   0.00-20.01  sec  74.4 MBytes  31.2 Mbits/sec  0.194 ms  136020/189908 (72%)  receiver

Ubuntu:Client --> Mac:Server

$ iperf3 -c 192.168.2.1 -u -b 110m -t 20

[ ID] Interval           Transfer     Bitrate         Jitter    Lost/Total Datagrams
[  5]   0.00-20.00  sec   168 MBytes  70.5 Mbits/sec  0.000 ms  0/121805 (0%)  sender
[  5]   0.00-20.01  sec   168 MBytes  70.4 Mbits/sec  0.309 ms  240/121767 (0.2%)  receiver

半二重のため、速度が低下(31.2Mbpsおよび70.4Mbps)している。Ubuntu-->Mac方向では、指定した速度を出せていない(110Mbps指定に対して70.5Mbps)。

L2Switch:Auto - Ubuntu:10Mbps Half-Duplex

Mac:Client --> Ubuntu:Server

$ iperf3 -c 192.168.2.2 -u -b 11m -t 20

[ ID] Interval           Transfer     Bitrate         Jitter    Lost/Total Datagrams
[  5]   0.00-20.00  sec  26.2 MBytes  11.0 Mbits/sec  0.000 ms  0/18991 (0%)  sender
[  5]   0.00-20.07  sec  9.44 MBytes  3.94 Mbits/sec  0.419 ms  12156/18990 (64%)  receiver

Ubuntu:Client --> Mac:Server

$ iperf3 -c 192.168.2.1 -u -b 11m -t 20

[ ID] Interval           Transfer     Bitrate         Jitter    Lost/Total Datagrams
[  5]   0.00-20.00  sec  26.2 MBytes  11.0 Mbits/sec  0.000 ms  0/18991 (0%)  sender
[  5]   0.00-20.03  sec  21.5 MBytes  9.00 Mbits/sec  0.358 ms  3369/18920 (18%)  receiver

こちらも速度低下していることがわかる。

L2Switch:100Mbps Full-Duplex - Ubuntu:Auto

L2Switch:10Mbps Full-Duplex - Ubuntu:Auto

この2つの設定、Ubuntu側でHalf-Duplexと判定(検出)してしまい、Duplex不一致が発生。先述の通り、通信できることもあるが、非常に不安定な状況。L2Switch側の不具合か、Ubuntu(またはチップ)の不具合であろう。

L2Switch:100Mbps Half-Duplex - Ubuntu:Auto

L2Switch:10Mbps Half-Duplex - Ubuntu:Auto

先述した、AutoとHalf Duplexと傾向は同じで、双方向同時に100Mbpsや10Mbpsは出ず、速度低下あり。

終わりに

過去にAuto-Autoでリンクアップダウンを繰り返す事象に遭遇したこともあり。上述した通り、速度and/orDuplexを固定しても正しく検出しない可能性もある。

通信できない・遅いなどの要因の一つとして、頭に入れておくとベター。

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?