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.
|
||||
let
|
||||
network = import ./networks.nix;
|
||||
inherit (network) publicIP publicIPv6 privateNetworkGatewayIP;
|
||||
in
|
||||
inherit (network) publicIP' publicIPv6 publicIPv6PrefixLength privateNetworkGatewayIP;
|
||||
|
||||
# This is just referring to the same interface just with alternative names.
|
||||
mainEthernetInterfaceNames = [ "ens3" "enp0s3" ];
|
||||
in
|
||||
{
|
||||
imports = [
|
||||
(modulesPath + "/profiles/qemu-guest.nix")
|
||||
@ -50,11 +52,49 @@ in
|
||||
# https://discourse.nixos.org/t/nixos-on-hetzner-cloud-servers-ipv6/221/
|
||||
systemd.network = {
|
||||
enable = true;
|
||||
networks."20-wan" = {
|
||||
|
||||
# For more information, you can look at Hetzner documentation from
|
||||
# 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";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
# This is to look out for any errors that will occur for my networking setup
|
||||
# which is always a possibility.
|
||||
|
@ -1,9 +1,14 @@
|
||||
# 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
|
||||
# a new server.
|
||||
{
|
||||
publicIP = "95.217.212.19/32";
|
||||
rec {
|
||||
publicIP = "95.217.212.19";
|
||||
publicIPPrefixLength = 32;
|
||||
publicIP' = "${publicIP}/${publicIPPrefixLength}";
|
||||
|
||||
publicIPv6 = "2a01:4f9:c011:a448::";
|
||||
publicIPv6PrefixLength = 64;
|
||||
publicIPv6' = "${publicIPv6}/${publicIPv6PrefixLength}";
|
||||
|
||||
privateIPNetworkRange = "172.16.0.0/32";
|
||||
privateNetworkGatewayIP = "172.16.0.1/32";
|
||||
|
Loading…
Reference in New Issue
Block a user