How to create Docker Container of VyOs Router/Firewall
Pr-requisites:
- Docker must be installed and running
- Must have docker image for VyOs
Docker Installation on CentOs/Amazon Linux: http://aseem-netexpert.blogspot.com/2018/02/docker-on-amazon-ec2-linuxcentos.html
Docker Installation on Windows: http://aseem-netexpert.blogspot.com/2018/12/docker-installation-on-windows-platform.html
So
far so good, you have done installation successfully and now time to
run docker on your machine, so download docker image of VyOs by
following below steps.
Docker repository for Vyos Image: https://hub.docker.com/r/aseemkhan/vyos
1. Get the latest VyOs image from docker created by me: by running below command you will get a docker image of VyOs
#docker pull aseemkhan/vyos
2. Spine up docker container: Now you got the image, so run below command to spin-up VyOs container from this image
For Linux: docker create --name vyosfw --privileged -v /lib/modules:/lib/modules aseemkhan/vyos /sbin/init
For Windows: docker create --name vyosfw --privileged aseemkhan/vyos /sbin/init
3. Power up the created container
docker start vyosfw
4. See if the container is running
docker ps
The output should be like this:
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
6f2fb4c638cb aseemkhan/vyos "/sbin/init" 4 minutes ago Up 2 minutes vyosfw
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
6f2fb4c638cb aseemkhan/vyos "/sbin/init" 4 minutes ago Up 2 minutes vyosfw
5. Now login to container
docker exec -it vyosfw /bin/vbash
you would get vbash prompt here and running the show version command should reveal like this:
vbash-4.1# show version
Version: VyOS 1.1.8
Description: VyOS 1.1.8 (helium)
Copyright: 2017 VyOS maintainers and contributors
Built by: maintainers@vyos.net
Built on: Sat Nov 11 13:44:36 UTC 2017
Build ID: 1711111344-b483efc
System type: x86 64-bit
Boot via: disk
HW model: Vostro 1550
HW S/N: 878JMP1
HW UUID: 44454C4C-3700-1038-804A-B8C04F4D5031
Uptime: 11:13:15 up 19:35, 0 users, load average: 0.34, 0.34, 0.36
Version: VyOS 1.1.8
Description: VyOS 1.1.8 (helium)
Copyright: 2017 VyOS maintainers and contributors
Built by: maintainers@vyos.net
Built on: Sat Nov 11 13:44:36 UTC 2017
Build ID: 1711111344-b483efc
System type: x86 64-bit
Boot via: disk
HW model: Vostro 1550
HW S/N: 878JMP1
HW UUID: 44454C4C-3700-1038-804A-B8C04F4D5031
Uptime: 11:13:15 up 19:35, 0 users, load average: 0.34, 0.34, 0.36
6. Go to router prompt by running below command and would get prompt like vyos@6f2fb4c638cb:~$
su - vyos
vyos@6f2fb4c638cb:~$ show interfaces
Codes: S - State, L - Link, u - Up, D - Down, A - Admin Down
Interface IP Address S/L Description
--------- ---------- --- -----------
eth0 172.17.0.2/16 u/u WAN
lo 127.0.0.1/8
Codes: S - State, L - Link, u - Up, D - Down, A - Admin Down
Interface IP Address S/L Description
--------- ---------- --- -----------
eth0 172.17.0.2/16 u/u WAN
lo 127.0.0.1/8
This
docker container spin up with one interface so to add more interface,
create the interface first and then attached those to container.
Create interface:
docker network create inside
docker network create dmz
Note:
these same interface can be attached to more one container, this way
each container will obtain same range IP on the named interface.
Stop docker container and attach to container
docker network connect inside vyosfw
docker network connect dmz vyosfw
To disconnect from network:
docker network disconnect inside-1 vyosfw-1
I have read this post. collection of post is a nice one..!!
ReplyDeleteDocker and Kubernetes Training
Docker Training
Docker Online Training
Docker Training in Hyderabad
Kubernetes Online Training
Thanks
DeleteGood post!Thank you so much for sharing this post..
ReplyDeleteDocker and Kubernetes Online Training