1. はじめに
前回の記事でContainerlabの構築を行いました。今回は、コンテナNOSではなくVM Routeをどうやって組み込むのか解説していきたいと思います。
前回の記事:
https://qiita.com/tsugu_i/items/1841eef2efb6e5187fa6
今回の作業範囲:
今回はJUNOSをコンテナとして展開し起動するまでを行います。
2. 環境
以下の環境にインストールをしています。
| 項目 | 値 |
|---|---|
| OS | Ubuntu 24.04.4 |
| Docker Version | version 29.2.1, build a5c7197 |
| CPU | Intel(R) Core(TM) i5-8400 |
| 仮想化支援 | intel-VTx |
| Memory | 32GB |
3.JUNOSコンテナを作成する
手順1:JUNOS(KVM)をダウンロードする(会員登録は不要)
vJUNOS Download Page:
https://support.juniper.net/support/downloads/?p=vJunos-router
手順2:ダウンロードしたKVMのファイルをコンテナ化する
vrnetlabをダウンロード※本家からfokされたもの
https://github.com/srl-labs/vrnetlab
git clone https://github.com/srl-labs/vrnetlab
#ルータの場合は、"vrnetlab/juniper/vjunosrouter"にimgeファイルを移動
#以下は一例
cp vJunos-router-25.4R1.12.qcow2 vrnetlab/juniper/vjunosrouter/
cd vrnetlab/juniper/vjunosrouter/
make
(時間がかかる)
#docker imageが登録されているか確認
nanashi@tsuguhiro-PC-MRM28LZ6ACS4:~$ docker image ls
i Info → U In Use
IMAGE ID DISK USAGE CONTENT SIZE EXTRA
ceos:4.32.0F 313dc022c94e 2.04GB 0B U
vrnetlab/juniper_vjunos-router:25.4R1.12 20ec12952f0f 4.83GB 0B U
JUNOSの起動
では、さっそく起動してみましょう。
手順1:yamlファイルの作成
以下サンプルです。
なお、JUNOSは最低4Core/6GB必要です。ご注意ください。
※うちは6コアしかありませんがみんなで共用しています。
name: srl-vjunos-test
topology:
nodes:
srl:
kind: srl
image: ghcr.io/nokia/srlinux:24.10.2
type: ixr-d2
cpu: 1
memory: "2GB"
ports:
- "3222:22"
vjunos:
kind: juniper_vjunosrouter
image: vrnetlab/juniper_vjunos-router:25.4R1.12
cpu: 4
memory: "8GB"
ports:
- "3224:22"
links:
- endpoints: ["srl:ethernet-1/1", "vjunos:eth1"]
手順2:containerlabの起動
sudo containerlab deploy -t junos.yaml
起動中例:
user@~/nw-lab/02_Junos-TEST$ sudo containerlab deploy -t junos.yml
13:46:39 INFO Containerlab started version=0.76.0
13:46:39 INFO Parsing & checking topology file=junos.yml
13:46:39 INFO Creating lab directory path=/home/tsuguhiro/nw-lab/02_Junos-TEST/clab-srl-vjunos-test
13:46:39 INFO Creating container name=vjunos
13:46:39 INFO Creating container name=srl
13:46:40 INFO Running postdeploy actions kind=srl node=srl
13:46:40 INFO Created link: srl:e1-1 (ethernet-1/1) ▪┄┄▪ vjunos:eth1
13:47:39 INFO Adding host entries path=/etc/hosts
13:47:39 INFO Adding SSH config for nodes path=/etc/ssh/ssh_config.d/clab-srl-vjunos-test.conf
13:47:39 INFO containerlab version
🎉=
│ A newer containerlab version (0.76.1) is available!
│ Release notes: https://containerlab.dev/rn/0.76/#0761
│ Run 'clab version upgrade' or see https://containerlab.dev/install/ for other installation options.
╭─────────────────────────────┬──────────────────────────────────────────┬────────────────────┬───────────────────╮
│ Name │ Kind/Image │ State │ IPv4/6 Address │
├─────────────────────────────┼──────────────────────────────────────────┼────────────────────┼───────────────────┤
│ clab-srl-vjunos-test-srl │ srl │ running │ 172.20.20.10 │
│ │ ghcr.io/nokia/srlinux:24.10.2 │ │ 3fff:172:20:20::a │
├─────────────────────────────┼──────────────────────────────────────────┼────────────────────┼───────────────────┤
│ clab-srl-vjunos-test-vjunos │ juniper_vjunosrouter │ running │ 172.20.20.11 │
│ │ vrnetlab/juniper_vjunos-router:25.4R1.12 │ (health: starting) │ 3fff:172:20:20::b │
╰─────────────────────────────┴──────────────────────────────────────────┴────────────────────┴───────────────────╯
user@~~/nw-lab/02_Junos-TEST$
手順3:JUNOSへのログイン
実施にログインします。UseriD/Passはroot/admin@123になります。
user@~/nw-lab/02_Junos-TEST$ ssh -p 3224 root@localhost
(root@localhost) Password:
Last login: Wed Jun 24 04:51:40 2026 from 172.20.20.1
--- JUNOS 25.4R1.12 Kernel 64-bit JNPR-15.0-20251024.861cae5_buil
root@vjunos:~ #
root@vjunos:~ # cli <---cliモードに移行
root@vjunos> exit
root@vjunos:~ # exit
logout
Connection to localhost closed.
user@~/nw-lab/02_Junos-TEST$
これで起動することが確認できました。
注意点として、JUNOSの起動には時間がかかります。
ログインできてもインターフェースが見えていないことはよくあります。
10分くらい待ったら出てきますので焦らずにお待ちください。
終わり
この記事では、JUNOSをコンテナ化しContainerlabで起動するところまでを行いました。
本当に良い時代になったなと思います。
余談
JUNOS結構なハードウェア要件を求めてきていましたが、私のコンピュータスペックでも以下のような構成においても問題なく起動しました。
以下は、ホストブリッジ接続(br-uplink/bridge)が存在しており、これはインターネットに抜けるためのものになります。
yamlファイル
name: ubuntu-junos-chain
topology:
nodes:
br-uplink: # ← ノード名 = Linuxブリッジ名
kind: bridge
linux1:
kind: linux
image: ubuntu-ssh:latest
cpu: 1
memory: "1GB"
ports:
- "2221:22"
r1a:
kind: arista_ceos
image: ceos:4.32.0F
ports:
- "2227:22"
env:
EOS_DEFAULT_USERNAME: admin
EOS_DEFAULT_PASSWORD: admin
SKIP_ZEROTOUCH_BARRIER_IN_SYSDBINIT: "1"
r11:
kind: juniper_vjunosrouter
image: vrnetlab/juniper_vjunos-router:25.4R1.12
cpu: 4
memory: "6GB"
ports:
- "2222:22"
r12:
kind: juniper_vjunosrouter
image: vrnetlab/juniper_vjunos-router:25.4R1.12
cpu: 4
memory: "6GB"
ports:
- "2223:22"
r21:
kind: juniper_vjunosrouter
image: vrnetlab/juniper_vjunos-router:25.4R1.12
cpu: 4
memory: "6GB"
ports:
- "2224:22"
r22:
kind: juniper_vjunosrouter
image: vrnetlab/juniper_vjunos-router:25.4R1.12
cpu: 4
memory: "6GB"
ports:
- "2225:22"
r2a:
kind: arista_ceos
image: ceos:4.32.0F
ports:
- "2228:22"
env:
EOS_DEFAULT_USERNAME: admin
EOS_DEFAULT_PASSWORD: admin
SKIP_ZEROTOUCH_BARRIER_IN_SYSDBINIT: "1"
linux2:
kind: linux
image: ubuntu-ssh:latest
cpu: 1
memory: "1GB"
ports:
- "2226:22"
links:
- endpoints: ["linux1:eth1", "r1a:eth1"]
- endpoints: ["r1a:eth2", "r11:eth1"]
- endpoints: ["r1a:eth3", "r21:eth1"]
- endpoints: ["r11:eth2", "r12:eth2"]
- endpoints: ["r21:eth2", "r22:eth2"]
- endpoints: ["r11:eth3", "r21:eth3"]
- endpoints: ["r12:eth3", "r22:eth3"]
- endpoints: ["r2a:eth2", "r12:eth1"]
- endpoints: ["r2a:eth3", "r22:eth1"]
- endpoints: ["r2a:eth1", "linux2:eth1"]
# インターネット接続
- endpoints: ["r11:eth4", "br-uplink:eth11"]
- endpoints: ["r12:eth4", "br-uplink:eth12"]
- endpoints: ["r21:eth4", "br-uplink:eth21"]
- endpoints: ["r22:eth4", "br-uplink:eth22"]
トポロジー図:
以下コマンドでトポロジーを表示させることが可能です。
sudo containerlab graph -t <トポロジー定義ファイル名.yaml>
user@~/nw-lab/05_JunOS_Learning$ ip a
(省略)
42: br-uplink: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
link/ether 1e:73:58:bc:f4:af brd ff:ff:ff:ff:ff:ff
inet 192.168.1.79/24 brd 192.168.1.255 scope global dynamic noprefixroute br-uplink
valid_lft 172742sec preferred_lft 172742sec
inet6 fe80::1c73:58ff:febc:f4af/64 scope link
valid_lft forever preferred_lft forever
参考サイト
containerlabドキュメント
https://zenn.dev/moatdrive/books/containerlab-manual/viewer/vrnetlab
