How to Configure a Docker Network in 5 Minutes: Docker IPVLAN Networking

preview_player
Показать описание
What's up foo?!?! In this video, I show you how to configure two docker network types in 5 minutes. I walk you through creating a Docker IPVLAN layer 2 and Layer 3 network. This beginner/intro Docker video will get you started with creating your own Docker networks in no time. Make sure you check out my previous video, where I explain all the different Docker network types. Also, let me know what Docker setup you have in the comments below. Be sure to subscribe. Once I hit 500 subs, I will be giving away a Raspberry Pi 5 to one lucky winner!

Video Timeline:
00:55 TLDR
1:05 Configuring an IPVLAN Layer 2 Network
5:49 Configuring an IPVLAN Layer 3 Network

Docker Network Commands:

To view your docker host network interfaces:
ip addr show

To manually create a new sub-interface tied to vlan 40:
ip link add link eth0 name eth0.40 type vlan id 40

To enable the new sub-interface you manually created:
ip link set eth0.40 up

To create a docker IPVLAN layer 2 network:
docker network create -d ipvlan \
--subnet=10.1.0.0/24 \
--ip-range=10.1.0.0/25 \ [!! This flag will only assign the first 128 IPs in the subnet 10.1.0.0/24 !!]
--gateway=10.0.0.1 \
-o parent=eth0.40 -o ipvlan_mode=l2 my_ipvlan_l2

To create a docker IPVLAN layer 3 network:
docker network create -d ipvlan \
--subnet=192.168.3.0/24 \
-o parent=eth0 -o ipvlan_mode=l3 my_ipvlan_l3

To run a test Apline Linux Container that exits and stops once you leave the container session:
docker run \
-it --net my_ipvlan_l2 \
--ip 10.1.0.2 \
--name test1 \
-v alpine:/data alpine /bin/sh

To create an Alpine Linux container and detach it so that it continues to run as you leave the session which will allow you to hop in and out of it as needed:
docker run \
-it -d --net my_ipvlan_l3 \
--ip 192.168.3.3 \
--name test2 \
-v alpine:/data alpine /bin/sh

To establish a shell session with the container you deployed and detached with the -d flag above:
docker exec -it test2 /bin/sh

Resources:

#IPVLAN #Networking #NetworkConfiguration #TechTutorial #NetworkEngineering #SystemAdministration #LinuxNetworking #Layer2Networking #Layer3Networking
Рекомендации по теме
Комментарии
Автор

woo hoo, sub'ed and liked

I like your video and channel, most excelent

JonBrookes
Автор

Do you have any ideas as to why I can't ping the gateway?

MsWaterdude
Автор

Hi, Can I route the docker network setup in any router ? I have a netgear hightwawk RAX70 router.
I have the L3 setup but I can't ping the IPaddress across the network. TIA

roystervi