Closed xd121614 closed 7 months ago
When I use AF XDP program forward traffic between client/server, It works only in nic l2 mode.
network topology:
ubuntu18.04<->ubuntu22.04<->centos7
ubuntu22.04 as forward device: AF XDP program run here
uname -r 5.15.0-89-generic
vmware network config:
... ens34: dhcp4: false ens35: dhcp4: false bridges: br0: interfaces: [ens34, ens35] dhcp4: no addresses: [1.1.1.1/24] ...
ubuntu18.04 as client : ipaddr: 1.1.1.100 centos7 as server ipaddr: 1.1.1.200
When I change l3 mode, network traffic will be interrupt, then I quit the ebpf program, it recovered nomal.
l3 network config:
ubuntu22.04 ens34: addresses: [1.1.1.1/24] dhcp4: false optional: true ens35: addresses: [2.2.2.1/24] dhcp4: false optional: true
ubuntu18.04: ipaddr: 1.1.1.100 gateway: 1.1.1.1 centos7: ipaddr: 2.2.2.100 gateway: 2.2.2.1
program source: https://github.com/xdp-project/bpf-examples/blob/master/AF_XDP-forwarding/xsk_fwd.c
I know why, because when network mode switch layer3, pkt mac need to modify if you want to use af xdp forward.
When I use AF XDP program forward traffic between client/server, It works only in nic l2 mode.
network topology:
ubuntu18.04<->ubuntu22.04<->centos7
ubuntu22.04 as forward device: AF XDP program run here
uname -r 5.15.0-89-generic
vmware network config:
... ens34: dhcp4: false ens35: dhcp4: false bridges: br0: interfaces: [ens34, ens35] dhcp4: no addresses: [1.1.1.1/24] ...
ubuntu18.04 as client : ipaddr: 1.1.1.100 centos7 as server ipaddr: 1.1.1.200
When I change l3 mode, network traffic will be interrupt, then I quit the ebpf program, it recovered nomal.
l3 network config:
ubuntu22.04 ens34: addresses: [1.1.1.1/24] dhcp4: false optional: true ens35: addresses: [2.2.2.1/24] dhcp4: false optional: true
ubuntu18.04: ipaddr: 1.1.1.100 gateway: 1.1.1.1 centos7: ipaddr: 2.2.2.100 gateway: 2.2.2.1
program source: https://github.com/xdp-project/bpf-examples/blob/master/AF_XDP-forwarding/xsk_fwd.c