|
| 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 | + |
| 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