play with docker multi-host networking
2017-12-29 09:52
239 查看
使用ovs tunnel组建docker multi-host netwrork记录
分别在两台机器上安装docker,分别为node1, node2
在node1 上创建两个container
docker run --net=mybr --name=c1 -d -ti busybox sh
docker run --net=mybr --name=c2 -d -ti busybox sh
在node2上创建一个container:
docker run --net=mybr --name=c1 -d -ti busybox sh
因为默认情况下docker分配的地址都是从172.17.0.2开始,需要将node1上的c1关闭,
这样避免了地址冲突
docker stop c1
在node1,node2上创建ovs-switch以及gre接口:
参考
http://docker-k8s-lab.readthedocs.io/en/latest/index.html http://chunqi.li/
分别在两台机器上安装docker,分别为node1, node2
在node1 上创建两个container
docker run --net=mybr --name=c1 -d -ti busybox sh
docker run --net=mybr --name=c2 -d -ti busybox sh
在node2上创建一个container:
docker run --net=mybr --name=c1 -d -ti busybox sh
因为默认情况下docker分配的地址都是从172.17.0.2开始,需要将node1上的c1关闭,
这样避免了地址冲突
docker stop c1
在node1,node2上创建ovs-switch以及gre接口:
ubuntu@docker-node2:~$ ovs-vsctl add-br br-int ubuntu@docker-node2:~$ sudo ip link add veth0 type veth peer name veth1 ubuntu@docker-node2:~$ sudo ovs-vsctl add-port br-int veth1 ubuntu@docker-node2:~$ sudo brctl addif docker0 veth0 ubuntu@docker-node2:~$ sudo ip link set veth1 up ubuntu@docker-node2:~$ sudo ip link set veth0 up
在node1上添加gre接口,node1, node2 ip分别为192.168.8.81, 192.168.8.82
ovs-vsctl add-port br-int gre0 -- \ set interface gre0 type=gre options:remote_ip=192.168.8.82
在node2上配置gre:
ovs-vsctl add-port br-int gre0 -- \ set interface gre0 type=gre options:remote_ip=192.168.8.81
验证联通性:
docker exec -ti sh
/ # ping 172.17.0.3 PING 172.17.0.3 (172.17.0.3): 56 data bytes 64 bytes from 172.17.0.3: seq=0 ttl=64 time=1.009 ms ^C --- 172.17.0.3 ping statistics --- 1 packets transmitted, 1 packets received, 0% packet loss round-trip min/avg/max = 1.009/1.009/1.009 ms
在node1上抓包:
root@docker-node1:~# tcpdump -n -i eth0 proto gre tcpdump: verbose output suppressed, use -v or -vv for full protocol decode listening on eth0, link-type EN10MB (Ethernet), capture size 262144 bytes 14:34:21.514041 IP 192.168.8.82 > 192.168.8.81: GREv0, length 102: IP 172.17.0.2 > 172.17.0.3: ICMP echo request, id 3072, seq 0, length 64 14:34:21.515404 IP 192.168.8.81 > 192.168.8.82: GREv0, length 102: IP 172.17.0.3 > 172.17.0.2: ICMP echo reply, id 3072, seq 0, length 64 14:34:22.513888 IP 192.168.8.82 > 192.168.8.81: GREv0, length 102: IP 172.17.0.2 > 172.17.0.3: ICMP echo request, id 3072, seq 1, length 64 14:34:22.514560 IP 192.168.8.81 > 192.168.8.82: GREv0, length 102: IP 172.17.0.3 > 172.17.0.2: ICMP echo reply, id 3072, seq 1, length 64 14:34:23.513956 IP 192.168.8.82 > 192.168.8.81: GREv0, length 102: IP 172.17.0.2 > 172.17.0.3: ICMP echo request, id 3072, seq 2, length 64 14:34:23.514577 IP 192.168.8.81 > 192.168.8.82: GREv0, length 102: IP 172.17.0.3 > 172.17.0.2: ICMP echo reply, id 3072, seq 2, length 64
参考
http://docker-k8s-lab.readthedocs.io/en/latest/index.html http://chunqi.li/
相关文章推荐
- 在本地搭建play-with-docker
- Play-With-Docker在chrome上的插件
- Multi-tenant Docker with OpenStack Heat
- Hibernate与Spring 实现多租户 (Hibernate Multi Tenancy With Spring)
- 2017 Multi-University Training Contest - Team 5 1008 Rikka with Subset
- Sysbench with support of multi-tables workload
- HDU 3478 Play with Chain (Splay树)
- uva 10673 - Play with Floor and Ceil(欧几里得算法)
- Play with Chain hdu 3487(伸展树翻转+删子树添子树)
- UVA 10673 Play with Floor and Ceil
- HDU 3487 Play with Chain (Splay tree)区间切割和反转操作。
- 【摘录】Cooperative Multithreading in BREW with IThread
- remove multi package with one command
- linux下基于SMP架构的多队列网卡的调优(Multi-queue network interfaces with SMP on Linux)
- JQuery Multi Select With Two ListBox
- Multi-Class Classification Tutorial with the Keras Deep Learning Library
- Teaching Mario to play with himself: AI, machine learning, and Super Mario Bros.
- "Scalable Multithreaded Programming with Thread Pools" 阅读笔记
- FunDA(5)- Reactive Streams:Play with Iteratees
- Docker 启动报错 symbol dm_task_get_info_with_deferred_