You are not logged in.
Hello community,
i am trying to create multiple macvlan networks with systemd-networkd.
When using the ip command i am doing the following:
sudo ip link add link ens18 ens18.1 type macvlan
sudo ip addr add 192.168.178.21/24 dev ens18.1
And at the end it looks like this:
lo UNKNOWN 127.0.0.1/8 ::1/128
ens18 UP 192.168.178.20/24
ens18.1@ens18 UP 192.168.178.21/24
ens18.2@ens18 UP 192.168.178.22/24
So i followed the introduction from arch wiki (https://wiki.archlinux.org/title/system … LAN_bridge) and i am getting the following result:
lo UNKNOWN 127.0.0.1/8 ::1/128
ens18 UP
mv-0@ens18 UP 192.168.178.20/24
That are my files:
[docker@docker network]$ cat 25-mv-0.netdev
[NetDev]
Name=mv-0
Kind=macvlan
[MACVLAN]
Mode=bridge
[docker@docker network]$ cat 30-enp1s0.network
[Match]
Name=ens18
[Link]
RequiredForOnline=carrier
[Network]
MACVLAN=mv-0
DHCP=no
IPv6AcceptRA=false
LinkLocalAddressing=no
MulticastDNS=false
LLMNR=false
[docker@docker network]$ cat 35-mv-0.network
[Match]
Name=mv-0
[Link]
RequiredForOnline=routable
[Network]
BindCarrier=ens18
Address=192.168.178.20/24
Gateway=192.168.178.1
DNS=192.168.178.1
So now i am asking my self how to generate a second macvlan network with a second ip address like i did with the ip command.
And i wand to understand why arch wiki says that i also have to add my hosts interface (ens18) to the macvlan bridge and with the ip command i didnt have to?
It would be great if you can give me a working example and additional information to delve deeper into the topic.
Regards
Offline
I solved my problem and I would like to introduce it.
console> cd /etc/systemd/network
console> ls
bridge1.netdev bridge1.network bridge2.netdev bridge2.network host.network
bridge1.netdev
[NetDev]
Name=veth1
Kind=macvlan
bridge1.network
[Match]
Name=veth1
[Network]
Address=192.168.178.21/24
Gateway=192.168.178.1
DNS=192.168.178.1
Address=fd00::21/64
Gateway=fd00::1
DNS=fd00::1
IPv6AcceptRA=false
LinkLocalAddressing=no
host.network
[Match]
Name=ens18
[Network]
Address=192.168.178.20/24
Gateway=192.168.178.1
DNS=192.168.178.1
Address=fd00::20/64
Gateway=fd00::7642:7fff:fe03:1a46
DNS=fd00::7642:7fff:fe03:1a46
IPv6AcceptRA=false
LinkLocalAddressing=no
MACVLAN=veth1
MACVLAN=veth2
For bridge2 you can copy bridge1 and change the ip addresses and names.
The important thing is that the MACVLAN attribute must be entered twice in the host file (host.network).
Offline