ytooyamaのブログ

サーバ構築とか、仕事で発見したこととか、趣味のこととかを書いています。

Ubuntu 20.04でNIC Bondingする

今回Ubuntu Desktop 20.04.2をインストールしてBondingを試すことにしました。リクエストがあったので。

使ったマシンはDellのInspiron 3881です。仕事用に会社で買ってもらいました。 ...ちょっとDPDKをコンテナーで動かすお仕事のためにですね(その辺りは別の機会にでも)。

www.dell.com

今回買ってもらったのは、第10世代 インテル® Core™ i5-10400 プロセッサー、256GB M.2 PCIe NVMe SSD + 1TB 7200 rpm 3.5インチ SATA ハードドライブを実装したモデルです。標準メモリーは8GBなので、メモリーを32GB(PC4-21300 16GBX2)に増設しています。 CPUはCore i7とかにしたかったのですが、このシリーズはCore i3かi5しか選べないようなので、Core i5にしています。

さてこのモデルはWi-FIチップのほか1GbEのNICが載っているのですが、買って届くまでオンボードNICがIntelのE1000EのNICであることに気が付きませんでした(書いていなかった)。 DPDK検証のために別途購入した「インテル PRO/1000 PT デュアルポート サーバ・アダプタ EXPI9402PT」を接続することにしました。

f:id:ytooyama:20210130170030j:plain:w360

スイッチは用意できなかったので、Aterm WG1900HP2のLANポートを使いました。

www.aterm.jp

リンクスピードも1000Mb/sで認識していますし、OKですね。

$ lspci|grep Ethernet
00:1f.6 Ethernet controller: Intel Corporation Ethernet Connection (11) I219-V
01:00.0 Ethernet controller: Intel Corporation 82571EB/82571GB Gigabit Ethernet Controller D0/D1 (copper applications) (rev 06)
01:00.1 Ethernet controller: Intel Corporation 82571EB/82571GB Gigabit Ethernet Controller D0/D1 (copper applications) (rev 06)
$ sudo ethtool eno1|egrep "Speed|Duplex"
    Speed: 1000Mb/s
    Duplex: Full
$ sudo ethtool enp1s0f0|egrep "Speed|Duplex"
    Speed: 1000Mb/s
    Duplex: Full
$ sudo ethtool enp1s0f1|egrep "Speed|Duplex"
    Speed: 1000Mb/s
    Duplex: Full

ではせっかく同じE1000EのNICが複数ポート実装された環境ができたわけですし、Bondingでもすることにしましょう。

Ubuntuの「アレ」の話

このブログで何度も言及しているように、Ubuntu 17.10以降のバージョンではNetplan.ioがネットワーク設定に使われていて、 DesktopとServerではバックエンドで使っているレンダラーが異なります。

  • Ubuntu Desktop: Network Manager
  • Ubuntu Server: networkd

(Ubuntu 20.04.2時点)

なので、「Ubuntu 20.04 bonding」とかで検索すると、深みにハマることになります。もちろんレンダラーをnetworkdに切り替えれば、同じように設定できますけど。

askubuntu.com

ちなみに私はNetplan.ioが嫌いで嫌いで嫌いでしょうがないです。

Ubuntu Desktopの場合、20.04時点ではNetwork Managerが使われています。 このため、Network Managerの各ツールを使えばbondingを作成できます(ちなみにGUIの設定は、現時点ではBondingを作ることはできないようです)。 例えばNetworkManager TUI(nmtui)を使うと、設定がやりやすいようです。今回はbalance-tlbでBondingしてみます。

f:id:ytooyama:20210207182755p:plain

bondingが終わったら、一旦再起動。 再起動後は次のように認識されました。

$ sudo ethtool bond0
Settings for bond0:
    Supported ports: [ ]
    Supported link modes:   Not reported
    Supported pause frame use: No
    Supports auto-negotiation: No
    Supported FEC modes: Not reported
    Advertised link modes:  Not reported
    Advertised pause frame use: No
    Advertised auto-negotiation: No
    Advertised FEC modes: Not reported
    Speed: 3000Mb/s
    Duplex: Full
    Port: Other
    PHYAD: 0
    Transceiver: internal
    Auto-negotiation: off
    Link detected: yes

iperf 3を使ったベンチマーク(NIC 1本)

DellのPCでiperf3サーバーを起動してみます。iperf3サーバーをDellのInspiron 3881で動かし、クライアントはmacOSにHomebrewなどを使って入れたiperf3から実行することにします。 1つのポートでサーバーが動いていた時はこんな結果でした。思ったほど速くはないですね。

$ iperf3 -c 192.168.0.129                 
Connecting to host 192.168.0.129, port 5201
[  5] local 192.168.0.131 port 49941 connected to 192.168.0.129 port 5201
[ ID] Interval           Transfer     Bitrate
[  5]   0.00-1.00   sec  20.8 MBytes   175 Mbits/sec                  
[  5]   1.00-2.01   sec  21.8 MBytes   182 Mbits/sec                  
[  5]   2.01-3.00   sec  19.4 MBytes   163 Mbits/sec                  
[  5]   3.00-4.00   sec  18.8 MBytes   158 Mbits/sec                  
[  5]   4.00-5.00   sec  18.3 MBytes   154 Mbits/sec                  
[  5]   5.00-6.00   sec  20.7 MBytes   174 Mbits/sec                  
[  5]   6.00-7.00   sec  21.6 MBytes   180 Mbits/sec                  
[  5]   7.00-8.00   sec  15.3 MBytes   129 Mbits/sec                  
[  5]   8.00-9.00   sec  18.4 MBytes   155 Mbits/sec                  
[  5]   9.00-10.00  sec  22.5 MBytes   188 Mbits/sec                  
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval           Transfer     Bitrate
[  5]   0.00-10.00  sec   198 MBytes   166 Mbits/sec                  sender
[  5]   0.00-10.04  sec   196 MBytes   164 Mbits/sec                  receiver

iperf Done.

iperf 3を使ったベンチマーク(NIC 3本)

3つのポートをbondingした時はこんな結果になりました。単体ポートで動いていた時よりビットレートは高くなりましたが、もう少し速度が出ると嬉しいですね。

$ iperf3 -c 192.168.0.145   
(DHCPでIPアドレスを取得したため、IPアドレスが変わっています)

-----------------------------------------------------------
Server listening on 5201
-----------------------------------------------------------
Accepted connection from 192.168.0.131, port 51350
[  5] local 192.168.0.145 port 5201 connected to 192.168.0.131 port 51351
[ ID] Interval           Transfer     Bitrate
[  5]   0.00-1.00   sec  58.1 MBytes   487 Mbits/sec                  
[  5]   1.00-2.00   sec  44.6 MBytes   374 Mbits/sec                  
[  5]   2.00-3.00   sec  61.6 MBytes   517 Mbits/sec                  
[  5]   3.00-4.00   sec  67.9 MBytes   570 Mbits/sec                  
[  5]   4.00-5.00   sec  61.8 MBytes   519 Mbits/sec                  
[  5]   5.00-6.00   sec  62.0 MBytes   520 Mbits/sec                  
[  5]   6.00-7.00   sec  59.7 MBytes   501 Mbits/sec                  
[  5]   7.00-8.00   sec  66.2 MBytes   555 Mbits/sec                  
[  5]   8.00-9.00   sec  58.5 MBytes   491 Mbits/sec                  
[  5]   9.00-10.00  sec  48.3 MBytes   405 Mbits/sec                  
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval           Transfer     Bitrate
[  5]   0.00-10.02  sec   589 MBytes   493 Mbits/sec                  receiver

そのうちBondingモードを802.3adにして試そうと思います。

このブログサイトはJavaScriptを使っていますが、読み込んでいるJavaScriptは全てはてなが提供しているものであり、筆者が設置しているものではありません。