Installing quagga in docker is described in detail

  • 2020-05-17 07:20:02
  • OfStack

The virtual router project in openstack takes up too much resources and needs to migrate the virtual router to Docker. I think I need to solve a few problems first.

1. How to integrate docker into openstack? openstack officially gives three solutions, based on nova, heat, and separate container projects

2. Container managed choreography integrated with docker, and decided to adopt K8S

3. Can you install quagga into docker and package it into quagga image for the development of automatic configuration program in the following two times?

Try today in docker quagga installation, and automatically open zebra ripd, ospfd, bgpdz process. docker installation and use, a lot of information on the Internet, please check by yourself.

The mirror builds automatically from the Dockerfile file, and then runs the container based on the built image.

Dockerfile


 FROM lijianfeng/ubuntu:v1.0

 MAINTAINER lijianfeng

 RUN apt-get install -y quagga

 RUN apt-get install -y telnet

 ADD zebra.conf /etc/quagga/zebra.conf

 ADD ospfd.conf /etc/quagga/ospfd.conf

 ADD ripd.conf /etc/quagga/ripd.conf

 ADD bgpd.conf /etc/quagga/bgpd.conf

 ADD init_conf.sh /etc/quagga/init_conf.sh

 CMD sh /etc/quagga/init_conf.sh ; /bin/bash

Note: the base image of lijianfeng/ubuntu: v1.0 was made by ourselves, only the usual packages were installed in the official Ubuntu: 14.04.

Dockerfile peer directory create zebra.conf ospfd.conf ripd.conf bgpd.conf

hostname router

password zebra

enable password zebra // only zebra.conf has enable password zebra, nothing else

log stdout

Dockerfile create init_conf.sh in the Dockerfile peer directory


 #!/bin/bash
 sed -ri "s/hostname .+/hostname $HOSTNAME/" /etc/quagga/zebra.conf

 sed -ri "s/hostname .+/hostname $HOSTNAME/" /etc/quagga/ripd.conf

 sed -ri "s/hostname .+/hostname $HOSTNAME/" /etc/quagga/ospfd.conf

 sed -ri "s/hostname .+/hostname $HOSTNAME/" /etc/quagga/bgpd.conf

 chown -R quagga.quagga /etc/quagga

 /usr/lib/quagga/zebra -d

 /usr/lib/quagga/ripd -d

 /usr/lib/quagga/ospfd -d

 /usr/lib/quagga/bgpd -d

Mirroring:

docker build -t lijianfeng/quagga .

Because you're building the image in the same directory, you end up with..., otherwise you need an absolute path

Once the build is completed, docker images will display the lijianfeng/quagga mirror

The container runs, where the pseudo-terminal interaction is used

docker run -it --name router --hostname router --privileged=true lijianfeng/quagga

After the command is executed, it enters the docker operation space, which is available via telnet localhost < port > Enter the corresponding daemon.

Thank you for reading, I hope to help you, thank you for your support of this site!


Related articles: