xdp-project / BNG-router

BNG - Linux router project
GNU General Public License v2.0
20 stars 8 forks source link

Testbed setup for DHCP relay #7

Closed bhaskar792 closed 2 years ago

bhaskar792 commented 2 years ago

We have setup a testbed with topology dhcp_client <---> BNG router <--->DHCP server

Here dhcp_client attaches 2 VLAN tags to the outgoing packet. We can see the tags in Wireshark as well as in xdpdump (provided PCAP file).

But at the XDP program attached to the dhcp_client side interface of the BNG router, we can only see the inner tag and packet size calculated from data_end - data is also exactly 4 bytes (size of VLAN header) less than the size of the packet in Wireshark.

Testbed code is available at https://github.com/shashank68/bng-testbed/blob/main/testbed.py

xdp-dhcp.zip

tohojo commented 2 years ago

My immediate guess is that you need to turn off VLAN offloads on the interface running XDP. You can do this with ethtool :)

yoelcaspersen commented 2 years ago

More specifically,

ethtool -K <interface name> rxvlan off

bhaskar792 commented 2 years ago

Thanks for the quick reply @tohojo. @yoelcaspersen We tried exactly the same command and turned VLAN offloads off but still the same issue, it doesn't seem to make any difference. For now we are looking into other offloads also, if they might be causing any issue.

yoelcaspersen commented 2 years ago

In another XDP project, we use the following:

ethtool -K <interface name> gso off tso off gro off

Does that make any difference for you?

bhaskar792 commented 2 years ago

Unfortunately no, it doesn't make any difference.

shashank68 commented 2 years ago

We turned off txvlan in the client side interface (veth connnecting to bng-router). We can see the two tags in the xdp program.

Here is the testbed code.

Thanks for the insights @tohojo @yoelcaspersen

bhaskar792 commented 2 years ago

Hi @tohojo @yoelcaspersen @netoptimizer

We are using the QEMU/KVM virtualization with virt-manager to create the testbed. We created 2 isolated networks with virt-manager namely net1 and net2. Then for the ubuntu-20.04 VM we attached 4 interfaces say int1_0 and int1_1 in net1 and int2_0 and int2_1 in net2. Now our VM has 4 interfaces named same as mentioned previously. To create the topology we used namespaces inside ubuntu VM. We created 3 namespace namely client, router and server. Assigned int1_0 in client namespace, and int1_1 and int2_1 in router namespace, and int2_0 in server namespace. Our router has IP forwarding enabled. Our client and server have the appropriate routes. We assigned IP address keeping int1_0 and int1_1 in same subnet (10.0.0.0/24) and int2_0 and int2_1 in same subnet (10.0.1.0/24).

We are even able to ping server side interface on the router from client as well as the client side interface on the router from the server. But we cant ping the server from the client or vice versa. Here is the namespace testbed setup script. We are not using VLAN tags for this testbed. Any suggestions? Thanks in advance

tohojo commented 2 years ago

Bhaskar Kataria @.***> writes:

Hi @tohojo @yoelcaspersen @netoptimizer

We are using the QEMU/KVM virtualization with virt-manager to create the testbed. We created 2 isolated networks with virt-manager namely net1 and net2. Then for the ubuntu-20.04 VM we attached 4 interfaces say int1_0 and int1_1 in net1 and int2_0 and int2_1 in net2. Now our VM has 4 interfaces named same as mentioned previously. To create the topology we used namespaces inside ubuntu VM. We created 3 namespace namely client, router and server. Assigned int1_0 in client namespace, and int1_1 and int2_1 in router namespace, and int2_0 in server namespace. Our router has IP forwarding enabled. Our client and server have the appropriate routes. We assigned IP address keeping int1_0 and int1_1 in same subnet (10.0.0.0/24) and int2_0 and int2_1 in same subnet (10.0.1.0/24).

We are even able to ping server side interface on the router from client as well as the client side interface on the router from the server. But we cant ping the server from the client or vice versa. Here is the namespace testbed setup script. We are not using VLAN tags for this testbed. Any suggestions?

From your script:

$netex n0 ip route add 10.0.1.0/24 via 10.0.0.1

10.0.0.1 is the IP address assigned to the interface inside n0, so it's trying to route packets via itself... That should be 10.0.0.2 in the 'via'