4 ms·
Yes, it’s Hetzner. The magic ingredient is ipvlan, a special interface type loosely related to macvlan. An ipvlan interface is tied to a physical interface. Whe
by fuzzy2 4y ago
Yes, it’s Hetzner. The magic ingredient is ipvlan, a special interface type loosely related to macvlan. An ipvlan interface is tied to a physical interface. Whether traffic goes to the virtual interface is decided based on the IP address alone. The ipvlan virtual interface can be moved to a different network namespace and will still work.
Note that Hetzner added support for multiple MAC addresses in the meantime. So at least for IPv4, you don’t need this.
There’s good info in the Linux kernel docs: https://www.kernel.org/doc/html/latest/networking/ipvlan.html https://www.kernel.org/doc/html/latest/networking/ipvlan.htm...
I have a Debian host. In my interfaces file, I have the following code for the Jitsi ipvlan link:
auto ipvl-meet
iface ipvl-meet inet manual
pre-up ip link add link eth0 name ipvl-meet type ipvlan mode l2
post-down ip link delete ipvl-meet
Then, in my LXC guest config, I have this:
lxc.net.0.type = phys
lxc.net.0.link = ipvl-meet
lxc.net.0.ipv4.address = 192.0.2.46/26
lxc.net.0.ipv4.gateway = 192.0.2.1
lxc.net.0.ipv6.address = 2001:0DB8::4/128
lxc.net.0.ipv6.gateway = fe80::1
A word of advice though: LXC likes to eat network interfaces when it fails to start a container. If you experiment, keep in mind that you may have to recreate the ipvlan interface after errors.
- fariszr 4y ago> Note that Hetzner added support for multiple MAC addresses in the meantime. So at least for IPv4, you don’t need this. Does this apply to the IP supplied with the server? Because I can't find any Mac address option for it.
- fuzzy2 4y agoNo, the primary IP address cannot have its MAC address changed.