MTU is wrong for Pod's eth0 interface when using Wireguard #5868
Labels
area/transit/encapsulation
Issues or PRs related to encapsulation.
area/transit/encryption
Issues or PRs related to transit encryption (IPSec, SSL).
kind/bug
Categorizes issue or PR as related to a bug.
priority/critical-urgent
Highest priority. Must be actively worked on as someone's top priority right now.
Milestone
Describe the bug
When using Wireguard, the MTU configured for each Pod's eth0 interface does not look correct.
It should be set to the same value as for the
antrea-wg0
interface:transportMTU - 80
.This is a Kind cluster, which is why the MTU for the transport interface (eth0) is
65535
.For antrea-wg0, the MTU is set to
65535 - 80 = 65455
, but for Pod veths, it is set to65535 - 50 = 65485
.The MTU for Pod interfaces is computed by
antrea/pkg/agent/config/node_config.go
Lines 267 to 285 in 792e244
which ignores the fact that we are using Wireguard, and deducts Geneve overhead (even though we are not actually using Geneve here, it is just the default value of
tunnelType
in the config).The function should be updated, and the MTU should be reduced by 80B instead of 50B when using Wireguard.
To Reproduce
Create a Kind cluster and install Antrea with
helm install -n kube-system antrea antrea/antrea --set trafficEncryptionMode="wireGuard"
.Deploy an iperf client Pod and an iperf server Pod on 2 different Nodes.
On the server Pod, run
iperf3 -s
.On the client Pod, run
iperf3 -c <server IP> -u -b 0 -l 65457
.65457
is computed by taking the MTU of the eth0 interface (of the Pod) and subtracting 28B (UDP & IPv4 headers).You should get one of the following:
If you reduce the datagram length by 30B (to compensate for the MTU misconfiguration described above), iperf works fine and you can maximize throughput:
Versions:
Antrea 1.14.x, but also probably earlier minor versions
Additional context
Note that we can either use 80B unconditionally for Wireguard overhead, or we can use 60B when only IPv4 is in use.
We may want to adjust the MTU for
antrea-gw0
as well, assuming it is possible for traffic that will eventually be encapsulated to be output through this interface. Currently we set it to the same value as for Pod's veth interfaces.Credit goes to @AlexisDucastel for reporting this.
The text was updated successfully, but these errors were encountered: