Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Docker Networking Tip - Macvlan driver

10,427 views

Published on

This covers basics of Docker Macvlan driver, use-cases and demo of 2 use-cases. Associated Youtube video(https://youtu.be/AH2eSNCB-tc)

Published in: Technology
  • Be the first to comment

Docker Networking Tip - Macvlan driver

  1. 1. DOCKER NETWORKING TIPS Macvlan Usage Presenter’s Name: Sreenivas Makam Associated Youtube video: https://youtu.be/3vI2DVb8qWk
  2. 2. About me  Senior Engineering Manager at Cisco Systems Data Center group  Author of “Mastering CoreOS” https://www.packtpub.com/networking- and-servers/mastering-coreos/ )  Docker Captain(https://www.docker.com/community/docker-captains )  Blog: https://sreeninet.wordpress.com/  Projects: https://github.com/smakam  LinkedIn: https://in.linkedin.com/in/sreenivasmakam  Twitter: @srmakam
  3. 3. Bridge Macvlan C1 Underlay(ethx) C2 C1 C2 Underlay(ethx) C1 C2 Underlay(ethx.1) Macvlan C3 C4 Underlay(ethx.2) Bridge vs Macvlan • Single physical interface can have multiple mac and ip addresses using macvlan driver. • Macvlan bridge is simplified bridge implementation with no mac learning, NAT and STP. 172.17.x.x 192.168.x.x 192.168.1.x 192.168.1.x 192.168.1.x 192.168.1.x 192.168.2.x 192.168.2.x
  4. 4. Need for Macvlan network driver  Need Container IP directly in underlay network managed by enterprise IT  Explicit control over Container IP assignment  Connect Containers to legacy applications  Connect Containers to external network without overlay network overhead  Have a need to preserve source IP of container
  5. 5. Macvlan Use-case 1 Container Mysql database Host 1 Host 2 192.168.99.x network Eth0 192.168.99.100 Eth0 192.168.99.102 Macvlan 192.168.99.192 docker network create -d macvlan --subnet=192.168.99.0/24 --ip-range=192.168.99.192/26 --gateway=192.168.99.1 -o macvlan_mode=bridge -o parent=eth1 macvlantest docker run --net=macvlantest -ti smakam/myubuntu:v6 bash Connecting to Legacy non-containerized application
  6. 6. Macvlan Use-case 2 client Host 1 Host 2 192.168.99.x network Eth0 192.168.99.100 Eth0 192.168.99.101 Macvlan 192.168.99.65 Host 1: docker network create --config-only --subnet 192.168.99.0/24 --gateway 192.168.99.1 -o parent=eth0 --ip-range 192.168.99.64/26 macvlan1c Host 2: docker network create --config-only --subnet 192.168.99.0/24 --gateway 192.168.99.1 -o parent=eth1 --ip-range 192.168.99.128/26 macvlan1c Host 1: docker network create -d macvlan --scope swarm --config-from macvlan1c macvlanswarm docker service create --replicas 1 --name client --network macvlanswarm --detach=false smakam/myubuntu:v4 sleep infinity docker service create --name vote --network macvlanswarm --mode replicated --replicas 2 --publish mode=ingress,target=80,published=8080 instavote/vote Vote.1 Vote.2 Swarm Macvlan 192.168.99.64 Macvlan 192.168.99.128 Multi-service application using Macvlan driver in Swarm cluster
  7. 7. References  Blog on Macvlan and Ipvlan basics  Blog on Docker Macvlan and Ipvlan networking plugin  Docker Networking – common issues and troubleshooting techniques

×