Networking: Difference between revisions
→Static IP for network adapter: Add IPv4 static ip configuration |
|||
| Line 5: | Line 5: | ||
=== Static IP for network adapter === | === Static IP for network adapter === | ||
The following example configures a static IPv6 address and a default gateway for the interface <code>ens3</code> | The following example configures a static IPv4 and IPv6 address and a default gateway for the interface <code>ens3</code> | ||
<syntaxhighlight lang="nix"> | <syntaxhighlight lang="nix"> | ||
networking = { | networking = { | ||
interfaces = { | interfaces.ens3 = { | ||
ipv6.addresses = [{ | |||
address = "2a01:4f8:1c1b:16d0::1"; | address = "2a01:4f8:1c1b:16d0::1"; | ||
prefixLength = 64; | prefixLength = 64; | ||
}]; | }]; | ||
ipv4.addresses = [{ | |||
address = "10.0.0.2"; | |||
prefixLength = 24; | |||
}]; | |||
}; | |||
defaultGateway = { | |||
address = "10.0.0.1"; | |||
interface = "ens3"; | |||
}; | }; | ||
defaultGateway6 = { | defaultGateway6 = { | ||