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?

More than 1 year has passed since last update.

Container Labに入門する

Posted at

目的

さくっとネットワークの検証を行いたいときに使うと良い「container lab」なるものを知った。早速使ってみよう

インストール

下記のサイトに沿って行ってみる

wget https://github.com/srl-labs/containerlab/releases/download/v0.44.3/containerlab_0.44.3_Linux_arm64.tar.gz
tar -zxvf containerlab_0.44.3_Linux_arm64.tar.gz
install containerlab /usr/local/sbin/

確認

root@shoma:/home/shoma # containerlab
deploy container based lab environments with a user-defined interconnections

Usage:
  containerlab [command]

Available Commands:
  completion  generate completion script
  config      configure a lab
  deploy      deploy a lab
  destroy     destroy a lab
  exec        execute a command on one or multiple containers
  generate    generate a Clos topology file, based on provided flags
  graph       generate a topology graph
  help        Help about any command
  inspect     inspect lab details
  save        save containers configuration
  tools       various tools your lab might need
  version     show containerlab version or upgrade

Flags:
  -d, --debug count        enable debug mode
  -h, --help               help for containerlab
      --log-level string   logging level; one of [trace, debug, info, warning, error, fatal] (default "info")
      --name string        lab name
  -r, --runtime string     container runtime
      --timeout duration   timeout for external API requests (e.g. container runtimes), e.g: 30s, 1m, 2m30s (default 2m0s)
  -t, --topo string        path to the topology file
      --vars string        path to the topology template variables file

Use "containerlab [command] --help" for more information about a command.

構成

以下のドキュメントを読む

name: demo1

topology:
  nodes:

    srl:
      kind: nokia_srlinux
      image: ghrc.io/nokia/srlinux:22.6.2

    sros:
      kind: vr-nokia_sros
      image: sros:21.10.R2
      license: license-sros21.txt


links:
  - endpoints: ["srl:e1-1", "sros:eth1"]

FRRで三角形を作る

name: ilumi

mgmt:
  network: custom_mgmt                # management network name
  ipv4-subnet: 172.100.100.0/24       # ipv4 range
  ipv6-subnet: 2001:172:100:100::/80  

topology:
  nodes:
    router1:
      kind: linux
      image: frrouting/frr:v7.5.1
    router2:
      kind: linux
      image: frrouting/frr:v7.5.1
    router3:
      kind: linux
      image: frrouting/frr:v7.5.1
  links:
    - endpoints: ["router1:eth1", "router2:eth1"]
    - endpoints: ["router1:eth2", "router3:eth1"]
    - endpoints: ["router2:eth2", "router3:eth2"]

起動

root@shoma:/home/shoma # containerlab deploy -t con.yml
INFO[0000] Containerlab v0.44.3 started
INFO[0000] Parsing & checking topology file: con.yml
INFO[0000] Creating docker network: Name="custom_mgmt", IPv4Subnet="172.100.100.0/24", IPv6Subnet="2001:172:100:100::/80", MTU="1500"
INFO[0001] Pulling docker.io/frrouting/frr:v7.5.1 Docker image
INFO[0024] Done pulling docker.io/frrouting/frr:v7.5.1
WARN[0024] Unable to load kernel module "ip6_tables" automatically "load ip6_tables failed: exec format error"
INFO[0024] Creating lab directory: /home/shoma/clab-ilumi
WARN[0025] SSH_AUTH_SOCK not set, skipping pubkey fetching
INFO[0025] Creating container: "router1"
INFO[0025] Creating container: "router3"
INFO[0025] Creating container: "router2"
INFO[0037] Creating link: router1:eth2 <--> router3:eth1
INFO[0037] Creating link: router1:eth1 <--> router2:eth1
INFO[0037] Creating link: router2:eth2 <--> router3:eth2
WARN[0038] Cannot parse export template /etc/containerlab/templates/export/auto.tmpl: open /etc/containerlab/templates/export/auto.tmpl: no such file or directory
INFO[0038] Adding containerlab host entries to /etc/hosts file
+---+--------------------+--------------+----------------------+-------+---------+------------------+------------------------+
| # |        Name        | Container ID |        Image         | Kind  |  State  |   IPv4 Address   |      IPv6 Address      |
+---+--------------------+--------------+----------------------+-------+---------+------------------+------------------------+
| 1 | clab-ilumi-router1 | 23614304c5e1 | frrouting/frr:v7.5.1 | linux | running | 172.100.100.3/24 | 2001:172:100:100::3/80 |
| 2 | clab-ilumi-router2 | 8bbf52d5e74d | frrouting/frr:v7.5.1 | linux | running | 172.100.100.2/24 | 2001:172:100:100::2/80 |
| 3 | clab-ilumi-router3 | 54985ae98335 | frrouting/frr:v7.5.1 | linux | running | 172.100.100.4/24 | 2001:172:100:100::4/80 |
+---+--------------------+--------------+----------------------+-------+---------+------------------+------------------------+
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?