-
Notifications
You must be signed in to change notification settings - Fork 32
/
dockercon-eu.txt
178 lines (137 loc) · 4.64 KB
/
dockercon-eu.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
# Manual overlay
## BOTH
sudo ./setup_vxlan 42 overns proxy dstport 4789
# Move interfaces to containers
# Create containers
## BOTH
docker run -d --net=none --name=demo debian sleep infinity
## DOCKER0
docker exec demo ip link show
sudo ./plumb br42@overns demo 192.168.0.10/24 02:42:c0:a8:00:10
## DOCKER1
sudo ./plumb br42@overns demo 192.168.0.20/24 02:42:c0:a8:00:20
## DOCKER0
docker exec demo ip addr show
## Test ping?
docker exec -it demo ping 192.168.0.20
sudo ip netns exec overns ip neighbor show
## DOCKER0
sudo ip netns exec overns ip neighbor add 192.168.0.20 lladdr 02:42:c0:a8:00:20 dev vxlan42
sudo ip netns exec overns bridge fdb add 02:42:c0:a8:00:20 dev vxlan42 self dst 10.0.1.10 vni 42 port 4789
## DOCKER1
sudo ip netns exec overns ip neighbor add 192.168.0.10 lladdr 02:42:c0:a8:00:10 dev vxlan42
sudo ip netns exec overns bridge fdb add 02:42:c0:a8:00:10 dev vxlan42 self dst 10.0.0.10 vni 42 port 4789
## DOCKER0
docker exec -it demo ping 192.168.0.20
## BGP
##CLEAN UP
sudo ip netns delete overns
docker rm -f demo
sudo rm /var/run/netns/demo
## Start BGP
## BOTH (CLEAN UP BEFORE!!)
docker run -t -d --privileged --name quagga -p 179:179 --hostname docker -v $(pwd)/quagga:/etc/quagga cumulusnetworks/quagga:CL3.2.1_evpn
## DOCKER0
docker exec -it quagga vtysh
show run
show bgp neighbors
show bgp evpn summary
show bgp evpn route
show bgp evpn vni
## BOTH
sudo ./setup_vxlan 42 container:quagga dstport 4789 nolearning
## DOCKER0
docker exec -it quagga vtysh
show bgp evpn route
show evpn vni
show evpn mac vni all
# Create container and attach it
## DOCKER0
docker run -d --net=none --name=demo debian sleep infinity
sudo ./plumb br42@quagga demo 192.168.0.10/24@192.168.0.1 02:42:c0:a8:00:10
## DOCKER1
docker run -d --net=none --name=demo debian sleep infinity
sudo ./plumb br42@quagga demo 192.168.0.20/24@192.168.0.1 02:42:c0:a8:00:20
# Ping
docker exec -it demo ping 192.168.0.20
## DOCKER0
docker exec -it quagga vtysh
show evpn vni
show bgp evpn route
show evpn mac vni all
docker exec quagga bridge fdb show br br42
## Second overlay?
## BOTH
sudo ./setup_vxlan 66 container:quagga dstport 4789 nolearning
## DOCKER0
docker run -d --net=none --name=demo66 debian sleep infinity
sudo ./plumb br66@quagga demo66 192.168.66.10/24 02:42:c0:a8:66:10
## DOCKER1
docker run -d --net=none --name=demo66 debian sleep infinity
sudo ./plumb br66@quagga demo66 192.168.66.20/24 02:42:c0:a8:66:20
## DOCKER0
docker exec -it demo66 ping 192.168.66.20
docker exec -it demo66 ping 192.168.0.20
docker exec -it quagga vtysh
show evpn vni
show evpn mac vni all
# dhcp
## DOCKER0
docker run -d --net=none --name dhcp -v "$(pwd)/dhcp":/data networkboot/dhcpd eth0
sudo ./plumb br42@quagga dhcp 192.168.0.254/24
docker logs -f dhcp
## DOCKER1
docker run -d --net=none --name=demodhcp debian sleep infinity
sudo ./plumb br42@quagga demodhcp dhcp
docker exec -it demodhcp ip addr
docker exec -it demodhcp ping 192.168.0.10
# non docker
## GATEWAY0
sudo ./setup_vxlan 42 host dstport 4789 nolearning
## Create interface and get IP from dhcp
sudo ip link add dev vethbr type veth peer name vethgw
sudo ip link set vethbr master br42
sudo ip link set vethbr up
sudo ip addr add 192.168.0.1/24 dev vethgw
sudo ip link set vethgw up
arping -c 1 -A -I vethgw 192.168.0.1
ping 192.168.0.10
echo 1 | sudo tee /proc/sys/net/ipv4/ip_forward
sudo iptables -t nat -A POSTROUTING ! -d 10.0.0.0/16 -s 192.168.0.0/24 -o eth0 -j MASQUERADE
## DOCKER 1
docker exec -it demodhcp ping 192.168.0.1
docker exec -it demodhcp ping 10.0.0.30
docker exec -it demodhcp ping 8.8.8.8
## SIMPLE
ping 10.0.0.20
ping 192.168.0.1
ping 192.168.0.100
## VM
####
sudo ip tuntap add dev tap0 mode tap
sudo ip link set tap0 master br42
sudo ip link set tap0 up
linuxkit run qemu -mem 512M -networking tap,tap0 linuxkit/linuxkit
ctr pull docker.io/library/alpine:latest
ctr run -t docker.io/library/alpine:latest alpine sh
########################
ADDITIONNAL
########################
# Gateway
## DOCKER0
docker run -d --name=gateway debian sleep infinity
sudo ./plumb -i eth1 br42@quagga gateway 192.168.0.1/24
sudo ip netns exec gateway iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
## DOCKER1
docker exec -it demo ping 8.8.8.8
sudo ip netns exec demo ip route add default via 192.168.0.1
docker exec -it demo ping 8.8.8.8
## GATEWAY
sudo ip netns add vmns
sudo ip link add dev vethvmbr type veth peer name vethvm
sudo ip link set vethvmbr master br42
sudo ip link set vethvmbr up
sudo ip link set vethvm netns vmns
sudo ip netns exec vmns ip link set vethvm up
sudo ip netns exec vmns dhclient vethvm
qemu-system-i386 -hda wheezy.qcow2 -curses -serial mon:stdio -m 256M -net nic -net tap,ifname=tap0,script=no,downscript=no