0

I am trying to create the following configuration. Two (Docker) containers, let's call them by their hostnames (s1 and s2) as described below, each includes Open vSwitch. I want to connect both OVSes each to the other, and to a (POX) controller.

This is what I do (all commands are run with root priveledges if needed):

  1. Run first container as

docker run -itd -P --hostname=s1 --cap-add NET_ADMIN %DOCKER_IMAGE%

Run the second container as

docker run -itd -P --hostname=s2 --cap-add NET_ADMIN %DOCKER_IMAGE%

2.

docker exec CID_s1 ovs-vsctl add-br s1

(where CID_s1 is the CID of container s1)

docker exec CID_s2 ovs-vsctl add-br s2

3.

On the host machine:

ip link add s1-eth1 type veth peer name s2-eth1

ip link set s1-eth1 netns PID_s1 (where PID_s1 is the PID of container s1)

ip link set s2-eth1 netns PID_s2

4.

Open a terminal on s1 and write:

ovs-vsctl add-port s1 s1-eth1

ip link set s1-eth1 up

ifconfig s1-eth1 10.0.0.1

ovs-vsctl set-controller s1 tcp:172.17.0.1:6633

Open a terminal on s2 and write:

ovs-vsctl add-port s2 s2-eth1

ip link set s2-eth1 up

ifconfig s2-eth1 10.0.0.2

ovs-vsctl set-controller s2 tcp:172.17.0.1:6633

At this moment, the controller shows that the switches have been connected and I can see that the controller has installed flows (the controller acts as a hub, so all actions are actually to flood).

However, I cannot ping from s1 to s2 or the other way (of course using their IP addresses).

Daniel
  • 440
  • 4
  • 13
  • Are their IP addresses revolved correctly (`arp`)? Does each switch detect its `sx-eth1` port as UP? – pchaigno May 12 '18 at 07:14
  • I use socketplane/openvswitch image and it does not have arp and nor apt to install it. How can I verify that the switch detects the port as 'up' ? Also, if I configure the interfaces as of type 'patch' with a peer name of the second one, then I can ping even without the controller connected. – Daniel May 12 '18 at 20:02
  • Maybe you can run `arp` inside the container from the host? `ip a` should tell you if the port is UP or DOWN. – pchaigno May 12 '18 at 20:20
  • is it possible to run commands in such way? it does ping in a certain case (as I commented above) so I believe the IF is UP and addresses are resolved correctly. – Daniel May 14 '18 at 10:49
  • Yes, see the following SO answer: https://stackoverflow.com/a/32249814/6884590. From what I understand pings succeed when you change the type of the interface; that's not the same thing at all. – pchaigno May 14 '18 at 11:02

2 Answers2

0

you have to install flows to each switch using the controller using the openflow protocol or manually with ovs commands in order to establish their connection using forwarding rules , or in case of a controller such as onos you can install and activate the connectability components such as Learning Switch which automatically generate these forwarding rules for you

Amir Rasti
  • 706
  • 7
  • 19
0

Perhaps the interface isn't connected to the containers. Try this:

ovs-vsctl set Interface s1-eth0 external-ids:iface-id='"${UUID}"',vm-id='"${s1-VM-ID}"'
Himanshu Tanwar
  • 198
  • 1
  • 11