Systemd/networkd: Difference between revisions
imported>Mweinelt |
imported>Mweinelt |
||
Line 131: | Line 131: | ||
linkConfig.RequiredForOnline = "routable"; | linkConfig.RequiredForOnline = "routable"; | ||
}; | }; | ||
</syntaxhighlight> | |||
=== VLAN === | |||
VLANs can be configured on top of hardlinks as well as virtual links, like bonding interfaces. They provide a logical network on a physical link. | |||
In this example we tag two VLANs with Ids 10 and 20 on a physical link <code>enp1s0</code>. The VLAN interfaces become available <code>vlan10</code> and <code>vlan20</code> and can receive additional configuration. | |||
<syntaxhighlight lang="nix"> | |||
systemd.network = { | |||
netdevs = { | |||
"20-vlan10" = { | |||
netdevConfig = { | |||
Kind = "vlan"; | |||
Name = "vlan10"; | |||
}; | |||
vlanConfig.Id = 10; | |||
}; | |||
"20-vlan20" = { | |||
netdevConfig = { | |||
Kind = "vlan"; | |||
Name = "vlan20"; | |||
}; | |||
vlanConfig.Id = 20; | |||
}; | |||
}; | |||
networks = { | |||
"30-enp1s0" = { | |||
matchConfig.Name = "enp1s0"; | |||
# tag vlan on this link | |||
vlan = [ | |||
vlan10 | |||
vlan20 | |||
]; | |||
}; | |||
"40-vlan10" = { | |||
matchConfig.Name = "vlan10"; | |||
# add relevant configuration here | |||
}; | |||
"40-vlan20" = { | |||
matchConfig.Name = "vlan20"; | |||
# add relevant configuration here | |||
}; | |||
}; | |||
</syntaxhighlight> | </syntaxhighlight> | ||