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

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.

1
задан 19 December 2017 в 13:31
2 ответа

Можете ли вы распечатать конфигурацию сетевого пространства имен.

route -n
ip netns ls
ovs-vsctl show

убедитесь, что вы настроили ядро, чтобы разрешить пересылку:

sudo vi /etc/sysctl.conf

uncomment net.ipv4.ip_forward = 1

вы можете наблюдать за трафиком

sudo tcpdump -i br0

См. Этот ответ относительно пересылки iptables: https://unix.stackexchange.com/questions/313180/iptables-forward-chain-traffic-not-seen-by-tcpdump

0
ответ дан 4 December 2019 в 04:20

По умолчанию ваш хост не знает MAC-адрес другого хоста. Они будут знать MAC-адрес соседа с протоколом ARP. Итак, убедитесь, что установленный вами поток таблицы обрабатывает процесс ARP для каждого хоста. На контроллере ryu вы можете использовать simple_switch_13.py или для имитации контроллера с графическим интерфейсом вы можете использовать https://github.com/dektiram/SDNColdBrew

0
ответ дан 4 December 2019 в 04:20