Virtual network device's MAC address changes after it's created with systemd v242 and later #4426
Labels
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.
reported-by/end-user
Issues reported by end users.
Milestone
Describe the bug
@wyike reported an issue that a Node sometimes can't talk to Pods running on itself when running Antrea with Ubuntu jammy (22.04.1) version. After some troubleshooting, we found it's because antrea-gw0's MAC address was different from the one used in OpenFlow rules. For example, it was
be:4d:3d:c8:de:94
according toip addr
:But the agent log said it was
4a:d4:c3:c7:5b:68
after the device was created.The inconsistency caused the packets were dropped by spoofguard flows.
@wenyingd and I investigated the reason why the MAC address changes and found that systemd-udevd always generated a new MAC address after a virtual device was created, on Ubuntu 22.04.1 and later version. This is the default behavior defined by
/usr/lib/systemd/network/99-default.link
:The policy asked udevd to create a persistent MAC address for all devices, and it happened asynchronously. So if the MAC address was updated before antrea-agent read the device's MAC, everything would be fine, otherwise the issue would be encountered.
The reason why it only happened on Ubuntu jammy version and later is:
Although the issue was observed with antrea-gw0 only, it could happen to all virtual devices, including the container network devices. As it affects Ubuntu jammy and other OSes with systemd v242+, we need to fix it ASAP and backport the fix.
Expected
antrea-agent should populate a MAC address and set it when creating antrea-gw0 and veth devices to avoid udev regenerating another persistent MAC address.
Actual behavior
On Ubuntu jammy or other OS with systemd v242+, udevd will regenerated a persistent MAC address and cause connection issue.
Versions:
OS: Ubuntu jammy or systemd v242+
The text was updated successfully, but these errors were encountered: