Skip to content

Commit 568c81d

Browse files
committed
Merge pull request #14 from contiv/demo
Add a demo write-up for a two host cluster with multiple vlans
2 parents 421cab7 + d30783f commit 568c81d

File tree

3 files changed

+104
-10
lines changed

3 files changed

+104
-10
lines changed

README.md

+5-7
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ Note:
5656

5757
3. Launch a desired configuration for the two containers
5858

59-
`netdcli -cfg json_examples/one_host_vlan.json`
59+
`netdcli -cfg examples/one_host_vlan.json`
6060

6161
4. According to the desired network state `myContainer1` and `myContainer2` now belongs to `orange` network
6262

@@ -94,18 +94,16 @@ Note:
9494
There are many variations to the above configuration, like creating multiple
9595
networks, across multiple hosts, use of VLANs, use of VXLAN, custom overrides
9696
for IP/subnet/VLAN/VXLAN allocation on per network/endpoint basis. Please look
97-
at [examples](examples/) directory to explore more details
97+
at [examples](examples/) directory to explore more sample configurations.
9898

99-
####Trying it out on a multi-host VLAN/VXLAN network
100-
101-
Look at [examples/two_host_vlan.json](examples/two_host_vlan.json) that depicts the following network
99+
####Trying it out in a multi-host VLAN/VXLAN network
102100

101+
The [docs/TwoHostMultiVlanDemo.md](docs/TwoHostMultiVlanDemo.md) walks through setting up a multi host demo network and deploy the following Vlan based network:
103102
![VlanNetwork](./docs/VlanNetwork.jpg)
104103

105-
[examples/two_host_vxlan.json](examples/two_host_vxlan.json) attempts to achieve following connectivity
104+
One can deploy the following Vxlan network by following the steps in the above demo and using [two_hosts_multiple_vxlan_nets.json](two_hosts_multiple_vxlan_nets.json) configuration file instead. Trying out the configuration is left as an exercise to the reader.
106105
![VxlanNetwork](./docs/VxlanNetwork.jpg)
107106

108-
109107
####Multi-tenant network
110108

111109
In the examples directory [two_hosts_multiple_tenants.json](examples/two_hosts_multiple_tenants.json) and

Vagrantfile

+3-3
Original file line numberDiff line numberDiff line change
@@ -101,14 +101,14 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
101101
end
102102
provision_node = <<SCRIPT
103103
## start etcd with generated config
104-
(echo etcd -name #{node_name} -initial-advertise-peer-urls http://#{node_addr}:7001 \
104+
(echo etcd -vv -name #{node_name} -initial-advertise-peer-urls http://#{node_addr}:7001 \
105105
-listen-peer-urls http://#{node_addr}:7001 \
106106
-initial-cluster #{node_peers} \
107107
-initial-cluster-state new)
108-
(nohup etcd -name #{node_name} -initial-advertise-peer-urls http://#{node_addr}:7001 \
108+
(nohup etcd -vv -name #{node_name} -initial-advertise-peer-urls http://#{node_addr}:7001 \
109109
-listen-peer-urls http://#{node_addr}:7001 \
110110
-initial-cluster #{node_peers} \
111-
-initial-cluster-state new 0<&- &>/dev/null &) || exit 1
111+
-initial-cluster-state new 0<&- &>/tmp/etcd.log &) || exit 1
112112
SCRIPT
113113
node.vm.provision "shell" do |s|
114114
s.inline = provision_node

docs/TwoHostMultiVlanDemo.md

+96
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
In this example we will simulate a two host cluster (with the two hosts being simulated by two vagrant vms) and deploy a multi vlan configuration on them. The logical topology looks similar to one shown below:
2+
3+
![VlanNetwork](./VlanNetwork.jpg)
4+
5+
1. Launch the two node setup:
6+
7+
```
8+
cd $GOPATH/src/github.com/contiv/netplugin
9+
CONTINV_NODES=2 make demo
10+
```
11+
12+
Note: User may simulate more hosts by setting the CONTINV_NODES variable to a desired number. Each host corresponds to a vagrant-vm, which are connected through their 'eth2' interface to a virtualbox bridge network for the container data traffic.
13+
14+
2. Once the make is done, start a separate ssh session to each node and run the netplugin:
15+
16+
```
17+
CONTINV_NODES=2 vagrant ssh netplugin-node1
18+
sudo $GOPATH/bin/netplugin -host-label host1
19+
```
20+
```
21+
CONTINV_NODES=2 vagrant ssh netplugin-node2
22+
sudo $GOPATH/bin/netplugin -host-label host2
23+
```
24+
3. Let's create 4 containers two on each vagrant node that we will add to the two networks viz. orange and purple later.
25+
26+
On netplugin-node1:
27+
```
28+
sudo docker run -it --name=myContainer1 --hostname=myContainer1 ubuntu /bin/bash
29+
sudo docker run -it --name=myContainer2 --hostname=myContainer2 ubuntu /bin/bash
30+
```
31+
On netplugin-node2:
32+
```
33+
sudo docker run -it --name=myContainer3 --hostname=myContainer1 ubuntu /bin/bash
34+
sudo docker run -it --name=myContainer4 --hostname=myContainer2 ubuntu /bin/bash
35+
```
36+
4. Now let's load the multi-host multi vlan configuration from the [../examples/two_hosts_multiple_vlans_nets.json](../examples/two_hosts_multiple_vlans_nets.json) file by issuing the following commands from one of the vagrant vms.
37+
38+
```
39+
CONTINV_NODES=2 vagrant ssh netplugin-node1
40+
cd $GOPATH/src/github.com/contiv/netplugin
41+
netdcli -cfg examples/two_hosts_multiple_vlans_nets.json
42+
```
43+
5. Now everything should be setup as per the diagram and we are good to test the connectivity.
44+
45+
Determine the IP addresses assigned to the container `myContainer3` and `myContainer4` by running command like `ifconfig` or `ip address show` from the container shells (opened in step 3).
46+
Note: the current implementation with ovs names the netdevices as 'port<number>'
47+
48+
```
49+
root@myContainer3:/# ip address show
50+
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default
51+
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
52+
inet 127.0.0.1/8 scope host lo
53+
valid_lft forever preferred_lft forever
54+
inet6 ::1/128 scope host
55+
valid_lft forever preferred_lft forever
56+
7: eth0: <BROADCAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default
57+
link/ether 02:42:ac:11:00:02 brd ff:ff:ff:ff:ff:ff
58+
inet 172.17.0.2/16 scope global eth0
59+
valid_lft forever preferred_lft forever
60+
inet6 fe80::42:acff:fe11:2/64 scope link
61+
valid_lft forever preferred_lft forever
62+
11: port2: <BROADCAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UNKNOWN group default
63+
link/ether 16:bd:b0:78:aa:26 brd ff:ff:ff:ff:ff:ff
64+
inet 11.1.2.2/24 scope global port2
65+
valid_lft forever preferred_lft forever
66+
inet6 fe80::14bd:b0ff:fe78:aa26/64 scope link
67+
valid_lft forever preferred_lft forever
68+
root@myContainer3:/#
69+
```
70+
71+
Go to the terminal for the container `myContainer1` and ping the ip for the container `myContainer3`. The ping succeeds as the containers belong to same vlan network.
72+
73+
```
74+
root@myContainer1:/# ping -c3 11.1.2.2
75+
PING 11.1.2.2 (11.1.2.2) 56(84) bytes of data.
76+
64 bytes from 11.1.2.2: icmp_seq=1 ttl=64 time=3.15 ms
77+
64 bytes from 11.1.2.2: icmp_seq=2 ttl=64 time=1.36 ms
78+
64 bytes from 11.1.2.2: icmp_seq=3 ttl=64 time=9.54 ms
79+
80+
--- 11.1.2.2 ping statistics ---
81+
3 packets transmitted, 3 received, 0% packet loss, time 2003ms
82+
rtt min/avg/max/mdev = 1.365/4.688/9.541/3.509 ms
83+
root@myContainer1:/#
84+
```
85+
86+
Now from `myContainer1`, ping the ip for `myContainer4`. The ping fails as the containers belong to different vlan networks.
87+
88+
```
89+
root@myContainer1:/# ping -c3 11.1.3.2
90+
PING 11.1.3.2 (11.1.3.2) 56(84) bytes of data.
91+
92+
--- 11.1.3.2 ping statistics ---
93+
3 packets transmitted, 0 received, 100% packet loss, time 2016ms
94+
95+
root@myContainer1:/#
96+
```

0 commit comments

Comments
 (0)