LoginSignup
1
1

More than 3 years have passed since last update.

Slack製VPNのNebulaをOpenVPNと速度比較をしてみた

Last updated at Posted at 2021-01-08

Nebulaとは

Slackが公開したパフォーマンス重視のスケーラブルなオーバーレイネットワークツールです.

Nebula is a scalable overlay networking tool with a focus on performance, simplicity and security. It lets you seamlessly connect computers anywhere in the world. Nebula is portable, and runs on Linux, OSX, and Windows. (Also: keep this quiet, but we have an early prototype running on iOS). It can be used to connect a small number of computers, but is also able to connect tens of thousands of computers.
引用: https://slack.engineering/introducing-nebula-the-open-source-global-overlay-network-from-slack-884110a5579

参考:Slackの「Nebula」--オープンソースのオーバーレイネットワークツール - TechRepublic Japan

動作検証

環境

Google Compute Engineでf1-micro(vCPU x 1, メモリ 0.6 GB, HDD 30GB)を使って検証しました.

image.png

クライアントとサーバーともにUbuntu 18.04です.

構築

ダウンロード

以下のURLからプラットフォームごとに適したパッケージをダウンロードします.
https://github.com/slackhq/nebula/releases

$ wget https://github.com/slackhq/nebula/releases/download/v1.1.0/nebula-linux-amd64.tar.gz

マシンの準備

ルーティング可能な固定IPアドレスをもつ1台のディスカバリノードを用意します.このノードはlighthouse(灯台)とよぶそうです.

今回はGCEのインスタンスを使用します.nebulaで使用するデフォルトポートudp/4242をVPCネットワークのファイアウォール ルールを作成して開放します.
image.png

マシンで作業

ダウンロードしたパッケージを展開します.

$ tar -xvf nebula-linux-amd64.tar.gz

$ ls -F
nebula*  nebula-cert*  nebula-linux-amd64.tar.gz

Nebula認証局を作成します.カレントディレクトリに ca.keyca.cert が作成されます.ca.key は個々のノード,ホストの証明書へ署名するために使われるので厳重に取り扱います.安全な強固な暗号化されたストレージへの保管がオススメだそうです.

$ ./nebula-cert ca -name "Cloud and Distributed Systems Laboratory"

$ ls -F
ca.crt  ca.key  nebula*  nebula-cert*  nebula-linux-amd64.tar.gz

Nebulaのホスト鍵と証明書を前述の認証局から生成します.ノードに名前付けができます.IPアドレスと所属するサブネットの指定ができます.今回はサンプルとして 192.168.30.x/24 をNabulaのネットワーク範囲として指定します.

$ ./nebula-cert sign -name "lighthouse1" -ip "192.168.30.1/24"
$ ./nebula-cert sign -name "mylaptop" -ip "192.168.30.3/24"

$ ls -F
ca.crt  ca.key  mylaptop.crt  mylaptop.key  nebula*  nebula-cert*  nebula-linux-amd64.tar.gz

ホスト毎の設定ファイルを作成します.以下のリンクから設定例をダウンロードします.lighthouseノードは am_lighthouse: true を設定します.それ以外のノードはstatic_host_maplighthouse を追加します.また,個々のノードをlighthouseノードの hosts セクションに記述します.

nebula/config.yml at master · slackhq/nebula

$ wget https://raw.githubusercontent.com/slackhq/nebula/master/examples/config.yml

Nebulaのクレデンシャルと設定,バイナリを各ホストにコピーします.ただし,ca.key は絶対にコピーしないでください.

  • config.yaml
  • ca.crt
  • {ホスト名}.crt
  • {ホスト名}.key

設定ファイルをlighthouseノードとクライアント(mylaptop)のそれぞれで編集します.pki:certkeyは個別に編集してください.lighthouse:hostsをlighthouseノード側には記述しないでください.

設定例(mylaptop)
pki:
  ca: ./ca.crt
  cert: ./mylaptop.crt
  key: ./mylaptop.key
static_host_map:
  "192.168.30.1": ["35.199.175.192:4242"]
lighthouse:
  am_lighthouse: false
  interval: 60
  hosts:
    - "192.168.30.1"
punchy: true
tun:
  dev: nebula1
  drop_local_broadcast: false
  drop_multicast: false
  tx_queue: 500
  mtu: 1300
  routes:
  unsafe_routes:
logging:
  level: info
  format: text
firewall:
  conntrack:
    tcp_timeout: 120h
    udp_timeout: 3m
    default_timeout: 10m
    max_connections: 100000
  outbound:
    - port: any
      proto: any
      host: any
設定例(lighthouse)
pki:
  ca: /opt/nebula/ca.crt
  cert: /opt/nebula/lighthouse1.crt
  key: /opt/nebula/lighthouse1.key
static_host_map:
  "192.168.30.1": ["35.199.175.192:4242"]
lighthouse:
  am_lighthouse: true
  interval: 60
listen:
  host: 0.0.0.0
  port: 4242
punchy: true
tun:
  dev: nebula1
  drop_local_broadcast: false
  drop_multicast: false
  tx_queue: 500
  mtu: 1300
  routes:
  unsafe_routes:
logging:
  level: info
  format: text
firewall:
  conntrack:
    tcp_timeout: 120h
    udp_timeout: 3m
    default_timeout: 10m
    max_connections: 100000
  outbound:
    - port: any
      proto: any
      host: any
  inbound:
    - port: any
      proto: icmp
      host: any
    - port: 443
      proto: tcp
      host:
        - mylaptop
    - port: any
      proto: udp
      host: any

Nebulaを各ホストで実行します.

$ ./nebula -config /path/to/config.yaml

接続する様子:
youtube

速度測定

環境・方法

laptop→インターネット
_IFgG1Sa.png

ツールにはiperfを使用しました.

$ iperf  -v
iperf version 2.0.10 (2 June 2018) pthreads

lighthouse側(GCP)は以下の記事をもとにiperfコマンドを実行しました.
ネットワーク測定ツールiperfの使い方 - Qiita

iperf -s -u -i 1

クライアント側(mylaptop)は以下のiperfコマンドを実行しました.以下は192.168.30.1宛に30秒間,2秒おきに500Mbを送信する場合のコマンドです.

iperf -c 192.168.30.1 -u -b 500M -t 30 -i 2

測定する様子:
youtube

結果

nebula openvpn
400M 417 Mbps 418 Mbps
500M 509 Mbps 523 Mbps
600M 561 Mbps
700M 516 Mbps

付録

サーバ側

$ iperf -s -u -i 1
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