What flow rules to add to the table for L2 Forwarding in open vSwitch

openflowopenvswitch

I am performing an experiment on 2 Xeon based servers. Both the servers have two dual port NIC, total 4 NICs. OVS is running on one server and DPDK pktgen on the other server.

I tried to add flow rules to the table to run OVS as L2 forwarding switch. I ran the following commands to create the bridge and add the flow rules.

./ovs-vsctl del-br br0
./ovs-vsctl add-br br0 -- set bridge br0 datapath_type=netdev
./ovs-vsctl add-port br0 dpdk0 -- set Interface dpdk0 type=dpdk options:dpdk-devargs=0000:04:00.0 options:flow-ctrl-autoneg=true
./ovs-vsctl add-port br0 dpdk1 -- set Interface dpdk1 type=dpdk options:dpdk-devargs=0000:04:00.1 options:flow-ctrl-autoneg=true
./ovs-vsctl add-port br0 dpdk2 -- set Interface dpdk2 type=dpdk options:dpdk-devargs=0000:05:00.0 options:flow-ctrl-autoneg=true
./ovs-vsctl add-port br0 dpdk3 -- set Interface dpdk3 type=dpdk options:dpdk-devargs=0000:05:00.1 options:flow-ctrl-autoneg=true

./ovs-ofctl del-flows br0
./ovs-ofctl add-flow br0 "table=0, eth_dst=a0:36:9f:0e:36:48,actions=output=1"
./ovs-ofctl add-flow br0 "table=0, eth_dst=a0:36:9f:0e:36:4a,actions=output=2"
./ovs-ofctl add-flow br0 "table=0, eth_dst=a0:36:9f:3e:eb:a4,actions=output=3"
./ovs-ofctl add-flow br0 "table=0, eth_dst=a0:36:9f:3e:eb:a2,actions=output=4"

Everything is working fine in this case. And then I changed the pktgen to generate packets with the fake mac addresses. I also changed the flow rules in the table by executing the following commands.

./ovs-ofctl add-flow br0 "table=0, eth_dst=00:00:00:00:00:00,actions=output=1"
./ovs-ofctl add-flow br0 "table=0, eth_dst=00:00:00:00:00:01,actions=output=2"
./ovs-ofctl add-flow br0 "table=0, eth_dst=00:00:00:00:00:02,actions=output=3"
./ovs-ofctl add-flow br0 "table=0, eth_dst=00:00:00:00:00:03,actions=output=4"

I verified that the pktgen is generating the packets with these mac addresses, but the OVS doesn't forward the packets in this case. Am I missing something here?

I tried to find out the solution but all the tutorials have mentioned the same thing to add flows to the tables for l2 forwarding. Why is the OVS not forwarding packets in case of fake mac addresses? I have used all the ports in promiscuous mode.

I want to measure the performance for large number of tables entries and that is why I need to generate packets with fake mac address.

Best Answer

Can you print the network namespace configuration.

route -n
ip netns ls
ovs-vsctl show

make sure you have configured the kernel to allow forwarding:

sudo vi /etc/sysctl.conf

uncomment net.ipv4.ip_forward = 1

you can watch the traffic

sudo tcpdump -i br0

Please see this answer regarding iptables forwarding: https://unix.stackexchange.com/questions/313180/iptables-forward-chain-traffic-not-seen-by-tcpdump

Related Topic