1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Github CodespacesでContainerlabを動かすまで

Last updated at Posted at 2025-09-11

この記事は

Containerlab(以下clab)を使ってみたかったメモです。

1.リポジトリ作成

image.png

2.Codespace作成

image.png

3.Codespace起動

さっきのCreate Codespaceを押せば、しばらくするとそのブラウザで起動する。Github Desktopをインストールしていればそれでで開く場合も。
image.png

4.Containerlabインストール

clab公式Quickstartに従って以下のコマンドにより、clabをインストールする。数分かかるかも。

curl -sL https://containerlab.dev/setup | sudo -E bash -s "all"

5.clab設定ファイルの作成

ここではmy-tutorial.clab.yamlとしてみた。
image.png

my-tutorial.clab.yamlに以下の内容を書いて保存する。公式Quickstartではarista_ceosを使っているが、ここではインストールが面倒なので両方ともnokia_srlinuxで。

my-tutorial.clab.yaml
name: my-tutorial

topology:
  nodes:
    srl1:
      kind: nokia_srlinux
      image: ghcr.io/nokia/srlinux:24.10
    srl2:
      kind: nokia_srlinux
      image: ghcr.io/nokia/srlinux:24.10

  links:
    - endpoints: ["srl1:ethernet-1/1", "srl2:ethernet-1/1"]

6.clab起動

満を持して実行する。最初はsrlinuxのダウンロードに時間がかかるかも。

sudo containerlab deploy

7.起動完了

さらにしばらくすれば以下の表が出てくる。これが出てくれば成功。

╭───────────────────────┬─────────────────────────────┬─────────┬───────────────────╮
│          Name         │          Kind/Image         │  State  │   IPv4/6 Address  │
├───────────────────────┼─────────────────────────────┼─────────┼───────────────────┤
│ clab-my-tutorial-srl1 │ nokia_srlinux               │ running │ 172.20.20.2       │
│                       │ ghcr.io/nokia/srlinux:24.10 │         │ 3fff:172:20:20::2 │
├───────────────────────┼─────────────────────────────┼─────────┼───────────────────┤
│ clab-my-tutorial-srl2 │ nokia_srlinux               │ running │ 172.20.20.3       │
│                       │ ghcr.io/nokia/srlinux:24.10 │         │ 3fff:172:20:20::3 │
╰───────────────────────┴─────────────────────────────┴─────────┴───────────────────╯

8.linuxにログイン

ssh admin@clab-my-tutorial-srl1でlinuxに入れる。初期パスワードはググってください。ログインに成功すると以下の表示になる。

Using configuration file(s): []
Welcome to the srlinux CLI.
Type 'help' (and press <ENTER>) if you need any help using this.
--{ running }--[  ]--
A:srl1#

9.遊んでみる

せっかくなのでpingくらい飛ばしてみる。

A:srl1# ping 172.20.20.3
Using network instance mgmt
PING 172.20.20.3 (172.20.20.3) 56(84) bytes of data.
64 bytes from 172.20.20.3: icmp_seq=1 ttl=64 time=82.3 ms
64 bytes from 172.20.20.3: icmp_seq=2 ttl=64 time=2.01 ms
64 bytes from 172.20.20.3: icmp_seq=3 ttl=64 time=1.93 ms
64 bytes from 172.20.20.3: icmp_seq=4 ttl=64 time=2.07 ms
^CCommand execution aborted : 'ping 172.20.20.3'

動いたね、やったぜ

Memo
GitリポジトリのファイルはCodespacesの仮想マシンの/workspaces/<Repository Name>にある

(以下備考)
Janog 56のセッション Containerlabで叶えるNWエンジニアの“あるある願望” の講演ではGithub Codespaceを用いることでOSを超えてclabを使えるとの利点の説明があり、せっかくなのでその方法で動かしてみました(筆者は本講演で初めてclabを知りました)。
使い方が合ってるかは分かりませんがとにかく動いたのでヨシ!とします。

(追記)
Codespaceに再接続した際にDocker関連でエラーが出るっぽい?
直すの面倒なのでCodespaceを作り直して解決しました。

1
0
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
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?