User Tools

Site Tools


containerlab

ContainerLab

JNCIA

jncia.clab.yaml
name: jncia
mgmt:
  network: clab-mgmt-net
  ipv4-subnet: 172.99.21.0/24
  ipv6-subnet: ""

topology:
  nodes:
    router1:
      kind: juniper_vsrx
      image: vrnetlab/juniper_vsrx:24.4R1-S2.9
      startup-config: vsrx-backups/clab-jncia-router1.conf

    router2:
      kind: juniper_vsrx
      image: vrnetlab/juniper_vsrx:24.4R1-S2.9
      startup-config: vsrx-backups/clab-jncia-router2.conf

    client1:
      kind: linux
      image: alpine:latest
      exec:
        - ip link set dev eth1 up
        - ip addr add 192.168.11.10/24 dev eth1
        - ip -4 route del default
        - ip -6 route del default
        - ip route add default via 192.168.11.1

    client2:
      kind: linux
      image: alpine:latest
      exec:
        - ip link set dev eth1 up
        - ip addr add 192.168.12.10/24 dev eth1
        - ip -4 route del default
        - ip -6 route del default
        - ip route add default via 192.168.12.1

    switch1:
      kind: juniper_vjunosswitch
      image: vrnetlab/juniper_vjunos-switch:24.4R1.9
      startup-config: vsrx-backups/clab-jncia-switch1.conf

    switch2:
      kind: juniper_vjunosswitch
      image: vrnetlab/juniper_vjunos-switch:24.4R1.9
      startup-config: vsrx-backups/clab-jncia-switch2.conf

    br0:
      kind: bridge

  links:
    - endpoints: ["router1:ge-0/0/0", "switch1:ge-0/0/1"]
    - endpoints: ["router2:ge-0/0/0", "switch2:ge-0/0/1"]
    - endpoints: ["switch1:ge-0/0/0", "switch2:ge-0/0/0"]
    - endpoints: ["router1:ge-0/0/1", "br0:vnet11"]
    - endpoints: ["router2:ge-0/0/1", "br0:vnet12"]
    - endpoints: ["router1:ge-0/0/2", "client1:eth1"]
    - endpoints: ["router2:ge-0/0/2", "client2:eth1"]
root@containerlab3:/home/jonathan/containerlab/jncia
backup_srx_configuration.sh
 
#!/bin/bash

VSRX_HOST="clab-jncia-router1 clab-jncia-router2 clab-jncia-switch1 clab-jncia-switch2"
USER=root
DEST_DIR=/home/user1/containerlab/jncia/vsrx-backups
CONFIG_NAME=juniper.conf.gz

mkdir -p "$DEST_DIR"

for x in $VSRX_HOST
do
    scp ${USER}@${x}:/config/${CONFIG_NAME} ${DEST_DIR}/${CONFIG_NAME}
    gunzip ${DEST_DIR}/juniper.conf.gz
    mv ${DEST_DIR}/juniper.conf ${DEST_DIR}/$x.conf
done
containerlab.txt · Last modified: by jonathan