mirror of
https://github.com/foo-dogsquared/nixos-config.git
synced 2025-01-31 10:58:02 +00:00
hosts/plover: update networking setup
This commit is contained in:
parent
2ee3f755fd
commit
5fab811812
@ -5,9 +5,11 @@
|
|||||||
# from nixos-generators.
|
# from nixos-generators.
|
||||||
let
|
let
|
||||||
network = import ./networks.nix;
|
network = import ./networks.nix;
|
||||||
inherit (network) publicIP publicIPv6 privateNetworkGatewayIP;
|
inherit (network) publicIP' publicIPv6 publicIPv6PrefixLength privateNetworkGatewayIP;
|
||||||
in
|
|
||||||
|
|
||||||
|
# This is just referring to the same interface just with alternative names.
|
||||||
|
mainEthernetInterfaceNames = [ "ens3" "enp0s3" ];
|
||||||
|
in
|
||||||
{
|
{
|
||||||
imports = [
|
imports = [
|
||||||
(modulesPath + "/profiles/qemu-guest.nix")
|
(modulesPath + "/profiles/qemu-guest.nix")
|
||||||
@ -50,9 +52,47 @@ in
|
|||||||
# https://discourse.nixos.org/t/nixos-on-hetzner-cloud-servers-ipv6/221/
|
# https://discourse.nixos.org/t/nixos-on-hetzner-cloud-servers-ipv6/221/
|
||||||
systemd.network = {
|
systemd.network = {
|
||||||
enable = true;
|
enable = true;
|
||||||
networks."20-wan" = {
|
|
||||||
matchConfig.Name = "en*";
|
# For more information, you can look at Hetzner documentation from
|
||||||
networkConfig.DHCP = "yes";
|
# https://docs.hetzner.com/robot/dedicated-server/ip/additional-ip-adresses/
|
||||||
|
networks = {
|
||||||
|
"60-wan" = {
|
||||||
|
matchConfig.Name = lib.concatStringsSep " " mainEthernetInterfaceNames;
|
||||||
|
|
||||||
|
# Setting the primary static IPs.
|
||||||
|
address = [
|
||||||
|
publicIP'
|
||||||
|
|
||||||
|
# The public IPv6 is assigned to a server so we'll to have to go with
|
||||||
|
# something else.
|
||||||
|
"${publicIPv6}1/${publicIPv6PrefixLength}"
|
||||||
|
];
|
||||||
|
|
||||||
|
networkConfig = {
|
||||||
|
DHCP = "yes";
|
||||||
|
IPForward = true;
|
||||||
|
IPMasquerade = "both";
|
||||||
|
};
|
||||||
|
|
||||||
|
routes = [
|
||||||
|
{ routeConfig.Gateway = "fe80::1"; }
|
||||||
|
{ routeConfig.Destination = publicIP'; }
|
||||||
|
|
||||||
|
{
|
||||||
|
routeConfig = {
|
||||||
|
Gateway = publicIP';
|
||||||
|
GatewayOnLink = true;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
|
# This is to make use of the remaining ethernet interfaces as we can
|
||||||
|
# build a local network.
|
||||||
|
"60-dhcpv6-pd-downstreams" = {
|
||||||
|
matchConfig.Name = "en*";
|
||||||
|
networkConfig.DHCP = "yes";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1,9 +1,14 @@
|
|||||||
# It just contains a set of network-related variables mainly used for
|
# It just contains a set of network-related variables mainly used for
|
||||||
# network-related services. Make sure to change this every time you migrate to
|
# network-related services. Make sure to change this every time you migrate to
|
||||||
# a new server.
|
# a new server.
|
||||||
{
|
rec {
|
||||||
publicIP = "95.217.212.19/32";
|
publicIP = "95.217.212.19";
|
||||||
|
publicIPPrefixLength = 32;
|
||||||
|
publicIP' = "${publicIP}/${publicIPPrefixLength}";
|
||||||
|
|
||||||
publicIPv6 = "2a01:4f9:c011:a448::";
|
publicIPv6 = "2a01:4f9:c011:a448::";
|
||||||
|
publicIPv6PrefixLength = 64;
|
||||||
|
publicIPv6' = "${publicIPv6}/${publicIPv6PrefixLength}";
|
||||||
|
|
||||||
privateIPNetworkRange = "172.16.0.0/32";
|
privateIPNetworkRange = "172.16.0.0/32";
|
||||||
privateNetworkGatewayIP = "172.16.0.1/32";
|
privateNetworkGatewayIP = "172.16.0.1/32";
|
||||||
|
Loading…
Reference in New Issue
Block a user