Skip to content

Instantly share code, notes, and snippets.

@fredhsu
Last active March 7, 2016 23:41
Show Gist options
  • Save fredhsu/38d75e7651dae8506ba2 to your computer and use it in GitHub Desktop.
Save fredhsu/38d75e7651dae8506ba2 to your computer and use it in GitHub Desktop.
Docker ipvlan L2 mode with 802.1q trunk with Arista ToR
# Switch config
vlan 20,30
!
interface Ethernet48
switchport mode trunk
!
interface Vlan20
ip address 192.168.20.1/24
!
interface Vlan30
ip address 192.168.30.1/24
# Docker commands
$ docker network create -d ipvlan --subnet=192.168.20.0/24 --gateway=192.168.20.1 -o host_iface=enp5s0f1.20 ipnet20
6a1112000e898631116a0f3f125265ae37f9f9c6c1cc9cbd38abff2d05067bcb
$ docker network create -d ipvlan --subnet=192.168.30.0/24 --gateway=192.168.30.1 -o host_iface=enp5s0f1.30 ipnet30
d5b4b104325fd76beab92edeb083e11f3420b2226e00d6a9562394bc7e01febe
$ docker run --net=ipnet20 -it --rm alpine /bin/sh
$ docker run --net=ipnet30 -it --rm alpine /bin/sh
/ # ping 192.168.30.1
PING 192.168.30.1 (192.168.30.1): 56 data bytes
64 bytes from 192.168.30.1: seq=0 ttl=64 time=0.299 ms
64 bytes from 192.168.30.1: seq=1 ttl=64 time=0.238 ms
64 bytes from 192.168.30.1: seq=2 ttl=64 time=0.248 ms
^C
--- 192.168.30.1 ping statistics ---
3 packets transmitted, 3 packets received, 0% packet loss
round-trip min/avg/max = 0.238/0.261/0.299 ms
/ # ping 192.168.20.2
PING 192.168.20.2 (192.168.20.2): 56 data bytes
64 bytes from 192.168.20.2: seq=0 ttl=63 time=0.242 ms
64 bytes from 192.168.20.2: seq=1 ttl=63 time=0.218 ms
64 bytes from 192.168.20.2: seq=2 ttl=63 time=0.214 ms
^C
--- 192.168.20.2 ping statistics ---
3 packets transmitted, 3 packets received, 0% packet loss
round-trip min/avg/max = 0.214/0.224/0.242 ms
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment