Help us improve your experience.

Let us know what you think.

Do you have time for a two-minute survey?

 
 

Managing cRPD

Building Topologies

You can use open-vswitch to setup topologies and to connect to docker containers. This controls the creation of the bridges, interface naming, and IP addressing.

To build a topology:

  1. Download and install openvswitch-switch utility.

    root@ubuntu-vm18:~# apt-get install openvswitch-switch

  2. Navigate to the following path:

    root@ubuntu-vm18:~# cd /usr/bin

  3. Download ovs-docker with wget:

    root@ubuntu-vm18:~# wget "https://raw.githubusercontent.com/openvswitch/ovs/master/utilities/ovs-docker"

  4. Change the mode:

    root@ubuntu-vm18:~# chmod a+rwx ovs-docker

  5. Create the container crpd01.

    root@ubuntu-vm18:~# docker run --rm --detach --name crpd01 -h crpd01 --net=bridge --privileged -v crpd01-config:/config -v crpd01-varlog:/var/log -it hub.juniper.net/routing/crpd:19.2R1.8

  6. Create the container crpd02.

    root@ubuntu-vm18:~# docker run --rm --detach --name crpd02 -h crpd02 --net=bridge --privileged -v crpd02-config:/config -v crpd02-varlog:/var/log -it hub.juniper.net/routing/crpd:19.2R1.8

Networking Docker Containers

Docker containers are connected using user defined bridges. For detailed documentation on docker bridge, see Use Bridge Networks.

To create the docker network:

  1. Create a bridge my-net.

    root@ubuntu-vm18:~# docker network create --internal my-net

    The --internal argument prevents the bridge being connected to the host network which is desirable in some cases. Once a bridge is created, it can be attached or detached to the containers.

  2. Connect the two containers using the bridge.

    root@ubuntu-vm18:~# docker network connect my-net crpd01

    root@ubuntu-vm18:~# docker network connect my-net crpd02

    This creates eth1 with a 172.18.0.0/16 subnet on crpd01 and crpd02.

Removing a Bridge

  1. Remove a bridge.
    root@ubuntu-vm18:~# docker network rm my-net
  2. Disconnect the bridge from the containers.
    root@ubuntu-vm18:~# docker network disconnect my-net crpd01
    root@ubuntu-vm18:~# docker network disconnect my-net crpd02

Creating an OVS Bridge

To create an OVS bridge and connect the docker to two containers crpd01 and crpd02:

  1. Create a bridge connecting crpd01 and crpd02.

    root@ubuntu-vm18:~# ovs-vsctl add-br crpd01-crpd02_1

  2. Add interfaces to the bridge.

    root@ubuntu-vm18:~# ovs-docker add-port crpd01-crpd02_1 eth1 crpd01

    root@ubuntu-vm18:~# ovs-docker add-port crpd01-crpd02_1 eth1 crpd02

  3. Configure an IP address to the interface.

    root@ubuntu-vm18:~# docker exec -d crpd01 ifconfig eth1 10.1.1.1/24

    root@ubuntu-vm18:~# docker exec -d crpd02 ifconfig eth1 10.1.1.2/24

  4. Configure an IP address to the loopback interface.

    root@ubuntu-vm18:~# docker exec -d crpd01 ifconfig lo 10.255.255.1 netmask 255.255.255.255

    root@ubuntu-vm18:~# docker exec -d crpd02 ifconfig lo 10.255.255.2 netmask 255.255.255.255

  5. Login to crpd01.

    root@ubuntu-vm18:~# docker exec -it crpd01 bash

  6. Verify the interface details.

    root@crpd01:/# ifconfig

  7. Verify the connection with crpd02

    root@crpd01:/# ping 10.1.1.2 -c 2

Configuring OSPF

  1. Configure crpd01 to setup OSPF protocol.

    root@ubuntu-vm18:~# set policy-options policy-statement adv term 1 from route-filter 10.10.10.0/24 exact

    root@ubuntu-vm18:~# set policy-options policy-statement adv term 1 then accept

    root@ubuntu-vm18:~# set routing-options router-id 10.255.255.1

    root@ubuntu-vm18:~# set routing-options static route 10.10.10.0/24 reject

    root@ubuntu-vm18:~# set protocols ospf export adv

    root@ubuntu-vm18:~# set protocols ospf area 0.0.0.0 interface eth1

    root@ubuntu-vm18:~# set protocols ospf area 0.0.0.0 interface lo.0

  2. Configure crpd02 to setup OSPF protocol.

    root@ubuntu-vm18:~# set policy-options policy-statement adv term 1 from route-filter 10.20.20.0/24 exact

    root@ubuntu-vm18:~# set policy-options policy-statement adv term 1 then accept

    root@ubuntu-vm18:~# set routing-options router-id 10.255.255.2

    root@ubuntu-vm18:~# set routing-options static route 10.20.20.0/24 reject

    root@ubuntu-vm18:~# set protocols ospf export adv

    root@ubuntu-vm18:~# set protocols ospf area 0.0.0.0 interface eth1

    root@ubuntu-vm18:~# set protocols ospf area 0.0.0.0 interface lo.0

  3. Login to crpd01.
    docker exec -it crpd01 bash
  4. Verify OSPF route details.

    root@crpd01:/# cli

    root@crpd01> show ospf neighbor

    root@crpd01> show ospf route

    root@crpd01> show route

  5. Verify the routes.

    root@crpd01> exit

    root@crpd01:/# ip route

    root@crpd01:/# ping 10.255.255.2 -c 2

Removing Interfaces and Bridges

To remove interfaces and bridges:

  1. Remove the interfaces:

    root@ubuntu-vm18:~# ovs-docker del-port crpd01-crpd02_1 eth1 R1

  2. Remove the bridges:

    root@ubuntu-vm18:~# ovs-vsctl del-br crpd01-crpd02_1

Viewing Container Processes in a Running cRPD

To view container processes:

Run the docker exec command to view the details about the processes (applications, services, and status) running on a container.

root@ubuntu-vm18:~# docker exec crpd01 ps aux

Accessing cRPD CLI and Bash Shell

To access the cRPD using CLI and bash shell:

  1. Run the docker exec -it crpd1 cli to launch the Junos CLI.

    root@ubuntu-vm18:~# docker exec -it crpd01 cli

  2. Run the docker exec -it crpd1 bash to launch the Junos shell.

    root@ubuntu-vm18:~# docker exec -it crpd01 bash

Pausing and Resuming Processes within a cRPD Container

You can pause or resume all processes within one or more containers.

To pause and restart a cRPD:

  1. Run the docker pause command to suspend all the processes in a cRPD container.

    root@ubuntu-vm18:~# docker pause crpd-container-name

  2. Run the docker unpause command to resume all the processes in the cRPD container.

    root@ubuntu-vm18:~# docker unpause crpd-container-name

Removing a cRPD Instance

To remove a cRPD instance or image:

Note:

You must first stop and remove a cRPD instance before you remove a cRPD image.

  1. Run the docker stop command to stop the cRPD.

    root@ubuntu-vm18:~# docker stop crpd-container-name

  2. Run the docker rm command to remove the cRPD.

    root@ubuntu-vm18:~# docker rm crpd-container-name

    Note:

    Include --force to force the removal of the running cRPD.

  3. Run the docker rmi command to remove one or more cRPD images from the Docker Engine.
    Note:

    Include --force to force the removal a cRPD image.

    root@ubuntu-vm18:~# docker rmi crd-Image-name

Viewing Docker Statistics and Logs

To view the statistics and logs:

  1. Run the docker stats command to monitor the resource utilization.
  2. Run the docker logs crpd-container-name command for extracting the container logs.

Viewing Active Containers

To view the current active containers and their status:

Run the docker ps or the docker container ls command to list the active containers.

root@ubuntu-vm18:~# docker container ls

root@ubuntu-vm18:~# docker ps

Stopping the Container

To stop the container:

You can stop the container using the following command:

root@ubuntu-vm18:~# docker stop crpd-container-name