Networking: Difference between revisions
imported>Onny Add section on static ip configuration |
imported>Hypnosis2839 →VLAN's: rename section, also usePredictableInterfaceNames was meant for backwards compat |
||
Line 100: | Line 100: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
== | == VLANs == | ||
[https://nixos.org/manual/nixos/stable/options.html#opt-networking.vlans | Refer to [https://nixos.org/manual/nixos/stable/options.html#opt-networking.vlans {{ic|networking.vlans}} in the manual]. | ||
Below is a complete networking example showing two interfaces, one with VLAN trunk tagging and one without. | |||
{{ic|enp2s1}} is a normal network interface at {{ic|192.168.1.2}} with no VLAN information. | |||
{{ic|enp2s0}} is the virtual LAN trunk, with two tagged VLANs, {{ic|vlan100}} and {{ic|vlan101}}. | |||
vlan100 | |||
{{ic|vlan100}} is in the {{ic|10.1.1.X}} network and {{ic|vlan101}} is in the {{ic|10.10.10.X}} network. | |||
The {{ic|hostID}} should be unique among your machines, [https://nixos.org/manual/nixos/stable/options.html#opt-networking.hostId as mentioned in the manual]. | |||
Complete networking section example: | Complete networking section example: | ||
Line 124: | Line 122: | ||
domain = "example.com"; | domain = "example.com"; | ||
dhcpcd.enable = false; | dhcpcd.enable = false; | ||
interfaces.enp2s1.ipv4.addresses = [{ | |||
interfaces. | |||
address = "192.168.1.2"; | address = "192.168.1.2"; | ||
prefixLength = 28; | prefixLength = 28; | ||
}]; | }]; | ||
vlans = { | vlans = { | ||
vlan100 = { id=100; interface=" | vlan100 = { id=100; interface="enp2s0"; }; | ||
vlan101 = { id=101; interface=" | vlan101 = { id=101; interface="enp2s0"; }; | ||
}; | }; | ||
interfaces.vlan100.ipv4.addresses = [{ | interfaces.vlan100.ipv4.addresses = [{ |