Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Macvlan using systemd

Before

yum install -y systemd-networkd
modprobe macvlan # make sure this returns no errors

Put config files in place

eth0.network and mac0.{netdev,network} go in /etc/systemd/network/ macvlan.service goes in /etc/systemd/system/

...

After

systemctl daemon-reload
systemctl enable systemd-networkd
systemctl enable macvlan

Notes

[Match]
Name=eth0
[Network]
MACVLAN=mac0
[NetDev]
Name=mac0
Kind=macvlan
[MACVLAN]
Mode=bridge
[Match]
Name=mac0
[Network]
IPForward=yes
Address=10.11.12.51/24
[Unit]
After=network.target
Before=network-online.target
[Service]
Type=oneshot
ExecStart=/sbin/ip link set eth0 promisc on
RemainAfterExit=yes
[Install]
WantedBy=network-online.target
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.