LoginSignup
0
0

More than 3 years have passed since last update.

docker-composeを使ってAristaNetworksのcEOS-labを複数動かす

Last updated at Posted at 2020-11-03

はじめに

AristaNetworksのcEOS-labについて以前ここに記載していたのだが、docker-composeを使って複数のcEOS-labを起動する記事を記載してなかったのでここに記載する。

前の記事を見てることを前提に記載します。
また、今回の内容はArista社のEOS Central内(要ユーザ登録)のNetwork CI/CD Part1 – Building network topologies with Docker and cEOS-labに記載されているので、
そちらを見ても同じことができると思います。

手順

docker-compose.ymlの作成

起動したいcEOSの構成情報を docker-compose.yml ファイル内に定義する。
※cEOS1とcEOS2を起動させてお互いのeth1とeth2を接続しているネットワーク構成。

version: '3'
services:
  ceos1:
    hostname: ceos1
    container_name: ceos1
    image: "ceos:4.24.2.2F"
    command: /sbin/init  systemd.setenv=INTFTYPE=eth systemd.setenv=ETBA=1 systemd.setenv=SKIP_ZEROTOUCH_BARRIER_IN_SYSDBINIT=1 systemd.setenv=CEOS=1 systemd.setenv=EOS_PLATFORM=ceoslab syste
md.setenv=container=docker
    privileged: true
    environment:
      INTFTYPE: eth
      ETBA: 1
      SKIP_ZEROTOUCH_BARRIER_IN_SYSDBINIT: 1
      CEOS: 1
      EOS_PLATFORM: ceoslab
      container: docker
    networks:
      default:
      net1:
      net2:
  ceos2:
    hostname: ceos2
    container_name: ceos2
    image: "ceos:4.24.2.2F"
    command: /sbin/init  systemd.setenv=INTFTYPE=eth systemd.setenv=ETBA=1 systemd.setenv=SKIP_ZEROTOUCH_BARRIER_IN_SYSDBINIT=1 systemd.setenv=CEOS=1 systemd.setenv=EOS_PLATFORM=ceoslab syste
md.setenv=container=docker
    privileged: true
    environment:
      INTFTYPE: eth
      ETBA: 1
      SKIP_ZEROTOUCH_BARRIER_IN_SYSDBINIT: 1
      CEOS: 1
      EOS_PLATFORM: ceoslab
      container: docker
    networks:
      default:
      net1:
      net2:
networks:
  net1:
  net2:


起動と確認

コンテナを起動、そして確認。

docker-compose up -d
Creating network "docker-compose-test_default" with the default driver
Creating network "docker-compose-test_net1" with the default driver
Creating network "docker-compose-test_net2" with the default driver
Creating ceos1 ... done
Creating ceos2 ... done

docker-compose ps
Name               Command               State   Ports
------------------------------------------------------
ceos1   /sbin/init systemd.setenv= ...   Up
ceos2   /sbin/init systemd.setenv= ...   Up

docker container ls
CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS               NAMES
11fb4380119d        ceos:4.24.2.2F      "/sbin/init systemd.…"   12 minutes ago      Up 12 minutes                           ceos2
d578a8077d37        ceos:4.24.2.2F      "/sbin/init systemd.…"   12 minutes ago      Up 12 minutes                           ceos1

docker network ls
NETWORK ID          NAME                          DRIVER              SCOPE
b61604aed6bf        bridge                        bridge              local
f2cb0b079080        docker-compose-test_default   bridge              local
dab572f8e996        docker-compose-test_net1      bridge              local
9e5f6c73dafc        docker-compose-test_net2      bridge              local
ec472d1f98ef        host                          host                local
ad77eaaccb62        none                          null                local

停止

コンテナの削除は以下のコマンドを使う。

docker-compose down
Stopping ceos2 ... done
Stopping ceos1 ... done
Removing ceos2 ... done
Removing ceos1 ... done
Removing network docker-compose-test_default
Removing network docker-compose-test_net1
Removing network docker-compose-test_net2

cEOS-labの設定

設定はdocker-composeで起動させてから以下のコマンドを使う。

docker-compose exec ceos1 Cli
docker-compose exec ceos2 Cli

上記コマンドで入った後は物理のAristaスイッチを触っていくのと同じ感覚で設定できると思います。

ceos1>enable
※ログインのタイミングでホスト名がceos1とすでに設定されているケースとlocalhostと初期設定のままのケースがあってenableコマンドを
 投入するとlocalhostにホスト名が戻る事象が発生。原因が良くわかっていない・・・。
localhost#


localhost#
localhost#
localhost#show running-config
! Command: show running-config
! device: localhost (cEOSLab, EOS-4.24.2.2F-18884008.42422F (engineering build))
!
transceiver qsfp default-mode 4x10G
!
service routing protocols model ribd
!
agent Bfd shutdown
agent PowerManager shutdown
agent LedPolicy shutdown
agent Thermostat shutdown
agent PowerFuse shutdown
agent StandbyCpld shutdown
agent LicenseManager shutdown
!
spanning-tree mode mstp
!
no aaa root
!
interface Ethernet1
!
interface Ethernet2
!
no ip routing
!
end

まとめ

試験構成パターンがあらかじめ決まっているようであればcEOS-labを単体で起動させるのではなく、
docker-composeを使うのが便利だと感じた。業務でも応用できればと考えている。
また、辛い部分としてはトラブル発生時はcEOS-labの切り分けは自力でなんとかしないといけないため、
ケースバイケースでうまく利用していくのとdocker自体の習熟等の地力をつけていかなくてはならないなあと思った。

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