kakkotetsu

Juniper vJunos-switchをKVM + GNS3で動かす

先日2023/04にJuniperがvJunos-switchというEX9214ベースの仮想(VM)版を公開したので、それをKVM + GNS3で動かします。
EXという名前の割にかなり機能が揃っているようですし、更に2023/05時点ではJuniperサイトのアカウントさえ持っていなくても誰でもダウンロードして使えるので、labや教育用途にピッタリでしょう。

最初に

本項でやること

  • Juniper EX9214の仮想版であるJuniper vJunos-switchをKVM + GNS3で動かして、ルーティングプロトコル(IS-IS)が動くのを簡易に確認するところまで
  • KVM や GNS3 の導入手順、Junos 操作の基礎は省略 (ある程度知っている人向け)

参考リンク集

環境情報

vJunos-switch自体がnested VMで動く(vJunos-switch Architecture 参照)ので、bare metalサーバにUbuntuとGNS3を入れてます。

なお、GNS3は以下を参考にWebインターフェース版を使っている(gns3-gui gns3-serverに加えてgns3-webclient-packもaptで入れただけ)ので、画面キャプチャなどはWeb Client版のものです。

vJunos-switchは2023/05時点で最新の23.1R1です。

# cat /etc/os-release
PRETTY_NAME="Ubuntu 22.04.2 LTS"
NAME="Ubuntu"
VERSION_ID="22.04"
VERSION="22.04.2 LTS (Jammy Jellyfish)"
VERSION_CODENAME=jammy
ID=ubuntu
ID_LIKE=debian
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
UBUNTU_CODENAME=jammy


# gns3 --version
2.2.39


# grep -Eoc '(vmx|svm)' /proc/cpuinfo
96


# kvm-ok
INFO: /dev/kvm exists
KVM acceleration can be used

デプロイ手順

qcow2イメージ入手

公式のダウンロードページで"vJunos-switch KVM image"をダウンロードするだけです。
なんと!ログイン不要で!!!入手できます!!!!!

$ sha256sum vjunos-switch-23.1R1.8.qcow2
d70eefa519f51d7d4cf2929862ed82b78a88512beb7da2ecade2bb19bf9ce505  vjunos-switch-23.1R1.8.qcow2

GNS3でQEMU VMテンプレート作成

ここがキモです。
"Preference"から"QEMU VM"のvjunos-switch用テンプレートを作ります。

以下に実際に正常に動作いるモノの設定を載せます。

  • General settings
    • RAMとvCPUは公式のRequirementsに沿っているだけ
      • 5GB, 4vCPU 以上
    • On closeはSend the Shutdown Signal(ACPI)
      • デフォルトのPower off the VMだと一旦停止して起動すると正常起動しなくなりました(エラー吐いてrebootを繰り返していた)

  • HDD
    • 先に公式サイトからダウンロードしたqcow2を1つ目のディスクとしてつけておく
    • 2つ目のディスクに初期設定ファイルをつけたりもできるらしいが未確認(ここでは何もつけておらず)

  • Network
    • 1つ目がマネージメント用のいわゆるfxp0
      • デフォルトでは起動時にここからDHCPリクエストを吐くので、適宜GNS3サーバの外界に繋げてDHCPサーバと通信させたり
    • 2つ目以降が"ge-0/0/[0-]"のデータポート
      • 公式によると96インターフェースまで可能?みたい

  • Advanced
    • "Additional settings"の"options"にqemu-system-x86_64の引数をベタ追記する
      • -smbios type=1,product="VM-VEX" は公式ドキュメントでも入れろとなっているのでそのまま入れておく
      • -cpu hostはvJunos-switch自体がnested VMで動くため

上記QEMU VMテンプレートを使って起動

GNS3のプロジェクトで先に作ったテンプレートを使ってデプロイ。
インターフェース1つ目がfxp0で、2つ目以降が"ge-0/0/[0-]"なので、それに合わせて適宜結線。
で、起動。

実際に起動しているものの引数など。

# ps aux | grep [J]unos
root       36635 94.8  1.8 7177172 3619800 pts/2 Sl+  15:19   0:48 /usr/bin/qemu-system-x86_64 -name vJunos-switch-23.1R1-1 -m 6144M -smp cpus=4,sockets=1 -enable-kvm -machine smm=off -boot order=c -drive file=/root/GNS3/projects/1710614b-c055-4427-8e15-abd4a9f2e9fe/project-files/qemu/3796adf7-8dbe-4dd1-acfa-586e78b9c1b9/hda_disk.qcow2,if=ide,index=0,media=disk,id=drive0 -uuid 3796adf7-8dbe-4dd1-acfa-586e78b9c1b9 -serial telnet:127.0.0.1:5002,server,nowait -monitor tcp:127.0.0.1:45513,server,nowait -net none -device virtio-net-pci,mac=0c:96:ad:f7:00:00,netdev=gns3-0 -netdev socket,id=gns3-0,udp=127.0.0.1:20005,localaddr=127.0.0.1:20004 -device virtio-net-pci,mac=0c:96:ad:f7:00:01,netdev=gns3-1 -netdev socket,id=gns3-1,udp=127.0.0.1:20007,localaddr=127.0.0.1:20006 -device virtio-net-pci,mac=0c:96:ad:f7:00:02,netdev=gns3-2 -netdev socket,id=gns3-2,udp=127.0.0.1:20009,localaddr=127.0.0.1:20008 -device virtio-net-pci,mac=0c:96:ad:f7:00:03,netdev=gns3-3 -netdev socket,id=gns3-3,udp=127.0.0.1:20011,localaddr=127.0.0.1:20010 -device virtio-net-pci,mac=0c:96:ad:f7:00:04,netdev=gns3-4 -netdev socket,id=gns3-4,udp=127.0.0.1:20013,localaddr=127.0.0.1:20012 -device virtio-net-pci,mac=0c:96:ad:f7:00:05,netdev=gns3-5 -netdev socket,id=gns3-5,udp=127.0.0.1:20015,localaddr=127.0.0.1:20014 -device virtio-net-pci,mac=0c:96:ad:f7:00:06,netdev=gns3-6 -netdev socket,id=gns3-6,udp=127.0.0.1:20017,localaddr=127.0.0.1:20016 -device virtio-net-pci,mac=0c:96:ad:f7:00:07,netdev=gns3-7 -netdev socket,id=gns3-7,udp=127.0.0.1:20019,localaddr=127.0.0.1:20018 -nographic -smbios type=1,product=VM-VEX -cpu host

で、コンソールを見守っていてFreeBSDのログインプロンプトが表示され、rootパスワードなしでログインできればOKです。

FreeBSD/amd64 (Amnesiac) (ttyu0)

login: root
Last login: Sun Mar 19 08:08:06 on ttyu0

--- JUNOS 23.1R1.8 Kernel 64-bit  JNPR-12.1-20230307.3e7c4b6_buil
root@:~ #


root@:~ # uname -a
FreeBSD  JNPR-12.1-20230307.3e7c4b6_buil FreeBSD JNPR-12.1-20230307.3e7c4b6_builder_stable_12_231 #0 r356482+3e7c4b6f6d3(stable/12_231): Wed Mar  8 11:06:07 PST 2023     builder@feyrith.juniper.net:/volume/build/junos/occam/llvm-10.0/sandbox-231-20230307-3e7c4b6/freebsd/stable_12_231/20230307.173653_builder_stable_12_231.3e7c4b6/obj/amd64/juniper/kernels/JNPR-AMD64-PRD/kernel  amd64

root@:~ # cli
root>

ZTP的なやつが動こうとしているっぽいので、適宜無効化するなり。

root>
Auto Image Upgrade: DHCP client(s) with NO VALID CONFIG, reset all enabled DHCP
 clients

Auto Image Upgrade: DHCP INET6 Client State Reset : fxp0.0

Auto Image Upgrade: DHCP INET6 Client State Reset : fxp0.0

Auto Image Upgrade: DHCP OFFER Client fxp0.0: Invalid config.
No File Server Information. OFFER REJECTED.

デフォルト設定とかバージョン情報とか。

root> show version brief
Model: ex9214
Junos: 23.1R1.8
JUNOS OS Kernel 64-bit  [20230307.3e7c4b6_builder_stable_12_231]
JUNOS OS libs [20230307.3e7c4b6_builder_stable_12_231]
JUNOS OS runtime [20230307.3e7c4b6_builder_stable_12_231]
JUNOS OS time zone information [20230307.3e7c4b6_builder_stable_12_231]
JUNOS network stack and utilities [20230319.041703_builder_junos_231_r1]
JUNOS libs [20230319.041703_builder_junos_231_r1]
JUNOS OS libs compat32 [20230307.3e7c4b6_builder_stable_12_231]
JUNOS OS 32-bit compatibility [20230307.3e7c4b6_builder_stable_12_231]
JUNOS libs compat32 [20230319.041703_builder_junos_231_r1]
JUNOS runtime [20230319.041703_builder_junos_231_r1]
JUNOS Packet Forwarding Engine Simulation Package [20230319.041703_builder_junos_231_r1]
JUNOS sflow mx [20230319.041703_builder_junos_231_r1]
JUNOS py extensions [20230319.041703_builder_junos_231_r1]
JUNOS py base [20230319.041703_builder_junos_231_r1]
JUNOS OS vmguest [20230307.3e7c4b6_builder_stable_12_231]
JUNOS OS package [20230301.012437_builder_stable_12]
JUNOS OS network modules [20230307.3e7c4b6_builder_stable_12_231]
JUNOS OS crypto [20230307.3e7c4b6_builder_stable_12_231]
JUNOS OS boot-ve files [20230307.3e7c4b6_builder_stable_12_231]
JUNOS na telemetry [23.1R1.8]
...


root> show chassis hardware
Hardware inventory:
Item             Version  Part number  Serial number     Description
Chassis                                VM646DAD0156      EX9214
Midplane
Routing Engine 0                                         RE-VMX
CB 0                                                     VMX SCB
FPC 0                     BUILTIN      BUILTIN           Virtual FPC
  CPU            Rev. 1.0 RIOT-LITE    BUILTIN
  MIC 0                                                  Virtual
    PIC 0                 BUILTIN      BUILTIN           Virtual



root> show interfaces terse
Interface               Admin Link Proto    Local                 Remote
ge-0/0/0                up    down
ge-0/0/0.16386          up    down
lc-0/0/0                up    up
lc-0/0/0.32769          up    up   vpls
pfe-0/0/0               up    up
pfe-0/0/0.16383         up    up   inet
                                   inet6
pfh-0/0/0               up    up
pfh-0/0/0.16383         up    up   inet
pfh-0/0/0.16384         up    up   inet
ge-0/0/1                up    down
ge-0/0/1.16386          up    down
ge-0/0/2                up    down
ge-0/0/2.16386          up    down
ge-0/0/3                up    down
ge-0/0/3.16386          up    down
ge-0/0/4                up    down
ge-0/0/4.16386          up    down
ge-0/0/5                up    down
ge-0/0/5.16386          up    down
ge-0/0/6                up    down
ge-0/0/6.16386          up    down
ge-0/0/7                up    down
ge-0/0/7.16386          up    down
ge-0/0/8                up    down
ge-0/0/8.16386          up    down
ge-0/0/9                up    down
ge-0/0/9.16386          up    down
cbp0                    up    up
demux0                  up    up
dsc                     up    up
em1                     up    up
em1.0                   up    up   inet     10.0.0.4/8
                                            128.0.0.1/2
                                            128.0.0.4/2
                                   inet6    fe80::5254:ff:fe12:bdfe/64
                                            fec0::a:0:0:4/64
                                   tnp      0x4
esi                     up    up
fxp0                    up    up
fxp0.0                  up    up   inet     10.138.126.103/25
                                   inet6    fe80::e96:adff:fef7:0/64
gre                     up    up
ipip                    up    up
irb                     up    up
jsrv                    up    up
jsrv.1                  up    up   inet     128.0.0.127/2
lo0                     up    up
lo0.16384               up    up   inet     127.0.0.1           --> 0/0
lo0.16385               up    up   inet
lsi                     up    up
mif                     up    up
mtun                    up    up
pimd                    up    up
pime                    up    up
pip0                    up    up
pp0                     up    up
rbeb                    up    up
tap                     up    up
vtep                    up    up



root> show configuration | display set
set version 23.1R1.8
set system commit factory-settings
set system arp aging-timer 5
set system syslog file interactive-commands interactive-commands any
set system syslog file messages any notice
set system syslog file messages authorization info
set system processes dhcp-service traceoptions file dhcp_logfile
set system processes dhcp-service traceoptions file size 10m
set system processes dhcp-service traceoptions level all
set system processes dhcp-service traceoptions flag packet
set chassis auto-image-upgrade
set interfaces fxp0 unit 0 family inet dhcp vendor-id Juniper-ex9214-VM646DAD0156
set interfaces fxp0 unit 0 family inet6 dhcpv6-client client-type stateful
set interfaces fxp0 unit 0 family inet6 dhcpv6-client client-ia-type ia-na
set interfaces fxp0 unit 0 family inet6 dhcpv6-client client-identifier duid-type duid-ll
set interfaces fxp0 unit 0 family inet6 dhcpv6-client vendor-id Juniper:ex9214:VM646DAD0156
set multi-chassis mc-lag consistency-check
set protocols router-advertisement interface fxp0.0 managed-configuration
set protocols lldp interface all
set protocols lldp-med interface all

ルーティングプロトコル(IS-IS)簡易動作確認

適当にIS-ISを四角形トポロジで動かしました。
1台分の設定でいうとこんなので。

set interfaces ge-0/0/0 description "R2 ge-0/0/0"
set interfaces ge-0/0/0 mtu 9192
set interfaces ge-0/0/0 unit 0 family inet address 192.168.0.0/31
set interfaces ge-0/0/0 unit 0 family iso
set interfaces ge-0/0/0 unit 0 family inet6 address fd00::192:168:0:0/127

set interfaces ge-0/0/1 description "R3 ge-0/0/0"
set interfaces ge-0/0/1 mtu 9192
set interfaces ge-0/0/1 unit 0 family inet address 192.168.0.7/31
set interfaces ge-0/0/1 unit 0 family iso
set interfaces ge-0/0/1 unit 0 family inet6 address fd00::192:168:0:7/127

set interfaces lo0 unit 0 family inet address 192.168.255.1/32
set interfaces lo0 unit 0 family iso address 49.0000.0000.0000.0001.00
set interfaces lo0 unit 0 family inet6 address fd00::192:168:255:1/128

set protocols isis interface ge-0/0/0.0
set protocols isis interface ge-0/0/1.0
set protocols isis interface lo0.0 passive

licenseのwarningは出るけどcommitはできます。
syslogにも1分おきとかにlicense warningが出続けますが。

[edit]
root@R1# commit
[edit protocols]
  'isis'
    warning: requires 'isis' license
commit complete

adjacency確立して経路学習しており、pingで他の3台のlo addressにも到達可能。

root@R1> show isis adjacency

Warning: License key missing; requires 'isis' license

Interface             System         L State         Hold (secs) SNPA
ge-0/0/0.0            R2             1  Up                    22  c:29:76:2a:0:1
ge-0/0/0.0            R2             2  Up                    23  c:29:76:2a:0:1
ge-0/0/1.0            R3             1  Up                    26  c:8a:58:1a:0:1
ge-0/0/1.0            R3             2  Up                    19  c:8a:58:1a:0:1


root@R1> show route protocol isis

Warning: License key missing; requires 'isis' license


inet.0: 13 destinations, 13 routes (13 active, 0 holddown, 0 hidden)
Limit/Threshold: 1048576/1048576 destinations
+ = Active Route, - = Last Active, * = Both

192.168.0.2/31     *[IS-IS/15] 00:01:23, metric 20
                    >  to 192.168.0.1 via ge-0/0/0.0
192.168.0.4/31     *[IS-IS/15] 00:00:55, metric 20
                    >  to 192.168.0.6 via ge-0/0/1.0
192.168.255.2/32   *[IS-IS/15] 00:01:23, metric 10
                    >  to 192.168.0.1 via ge-0/0/0.0
192.168.255.3/32   *[IS-IS/15] 00:00:55, metric 10
                    >  to 192.168.0.6 via ge-0/0/1.0
192.168.255.4/32   *[IS-IS/15] 00:00:55, metric 20
                    >  to 192.168.0.1 via ge-0/0/0.0
                       to 192.168.0.6 via ge-0/0/1.0

iso.0: 1 destinations, 1 routes (1 active, 0 holddown, 0 hidden)

inet6.0: 14 destinations, 14 routes (14 active, 0 holddown, 0 hidden)
Limit/Threshold: 1048576/1048576 destinations
+ = Active Route, - = Last Active, * = Both

fd00::192:168:0:2/127
                   *[IS-IS/15] 00:01:23, metric 20
                    >  to fe80::e29:76ff:fe2a:1 via ge-0/0/0.0
fd00::192:168:0:4/127
                   *[IS-IS/15] 00:00:55, metric 20
                    >  to fe80::e8a:58ff:fe1a:1 via ge-0/0/1.0
fd00::192:168:255:2/128
                   *[IS-IS/15] 00:01:23, metric 10
                    >  to fe80::e29:76ff:fe2a:1 via ge-0/0/0.0
fd00::192:168:255:3/128
                   *[IS-IS/15] 00:00:55, metric 10
                    >  to fe80::e8a:58ff:fe1a:1 via ge-0/0/1.0
fd00::192:168:255:4/128
                   *[IS-IS/15] 00:00:55, metric 20
                    >  to fe80::e29:76ff:fe2a:1 via ge-0/0/0.0
                       to fe80::e8a:58ff:fe1a:1 via ge-0/0/1.0

何となくルーティングプロトコルも動きそうだと分かりました。

所感

  • EX9214のFeatureをみているとEXという名前の割にかなりMX寄りな良いモノのようで、vJunos-switchもかなり使い出がありそうな予感です。
  • いつの間にか(自分は)vMX Evaluationがダウンロードできなくなっているのもあり、vQFXも重いし...というところで期待の新星登場!という思いです。
  • nested VMを使っているとはいえ、VCP/VFPがシングルVMで動くのもノードを配置する際にはありがたいです。
  • それにしてもこれがアカウント不要で誰でもダウンロード可能なのは、大変にありがたいことでございます。Juniper様様。