CPqD / ofsoftswitch13

OpenFlow 1.3 switch.
http://cpqd.github.com/ofsoftswitch13
302 stars 192 forks source link

Out of Mininet topology #130

Closed menossi closed 10 years ago

menossi commented 10 years ago

I'm trying to use the openflow switch without the Mininet. So i did:

ip link add veth0 type veth peer name veth1
ip link add veth2 type veth peer name veth3

Then i started the switch:

ofdatapath --datapath-id=000000000001 --interfaces=veth1,veth3 ptcp:6632

Start the libfluid controller:

./msg_controller l2

Created the switch<->controller connection:

ofprotocol tcp:127.0.0.1:6632 tcp:127.0.0.1:6653

For the test, i've done:

ifconfig veth0 10.0.0.1/8 up
ifconfig veth2 10.0.0.2/8 up

Then:

ping -I veth0 10.0.0.2

And didn't worked.

Using dpctl monitor i get: not_match

I've started without the controller and tryed to install flows manually:

dpctl tcp:127.0.0.1:6632 flow-mod table=0,cmd=add in_port=1 apply:output=2
dpctl tcp:127.0.0.1:6632 flow-mod table=0,cmd=add in_port=2 apply:output=1

But doesn't work also.

I tested with Mininet, the switch and the controller and worked well... I don't know i've done wrong...

Can someone help me, please?

ZoltanLajosKis commented 10 years ago

You need to move those interfaces to different network namespaces. Try this:

## create veth interfaces
sudo ip link add veth0 type veth peer name veth1
sudo ip link add veth2 type veth peer name veth3

## create n1 namespace for veth0 and configure
sudo ip netns add n1
sudo ip netns exec n1 ip link set lo up
sudo ip link set veth0 netns n1
sudo ip netns exec n1 ip addr add 10.0.0.1/8 dev veth0
sudo ip netns exec n1 ip link set veth0 up

## create n2 namespace for veth1 and configure
sudo ip netns add n2
sudo ip netns exec n2 ip link set lo up
sudo ip link set veth2 netns n2
sudo ip netns exec n2 ip addr add 10.0.0.2/8 dev veth2
sudo ip netns exec n2 ip link set veth2 up

## start switch
sudo ofdatapath --datapath-id=000000000001 --interfaces=veth1,veth3 ptcp:6632

## try ping // no luck :(
sudo ip netns exec n1 ping 10.0.0.2

## add flows
sudo dpctl tcp:127.0.0.1:6632 flow-mod table=0,cmd=add in_port=1 apply:output=2
sudo dpctl tcp:127.0.0.1:6632 flow-mod table=0,cmd=add in_port=2 apply:output=1

## try ping // it works! :)
sudo ip netns exec n1 ping 10.0.0.2
menossi commented 10 years ago

That works! Thanks @ZoltanLajosKis