From 64d9609d49a2d2740d878eed9be9d6f97572cc56 Mon Sep 17 00:00:00 2001 From: clerie Date: Mon, 7 Dec 2020 16:57:50 +0100 Subject: [PATCH] Add host nonat --- hosts/nonat/configuartion.nix | 40 ++++++++++++++++++++++++++ hosts/nonat/hardware-configuartion.nix | 23 +++++++++++++++ 2 files changed, 63 insertions(+) create mode 100644 hosts/nonat/configuartion.nix create mode 100644 hosts/nonat/hardware-configuartion.nix diff --git a/hosts/nonat/configuartion.nix b/hosts/nonat/configuartion.nix new file mode 100644 index 0000000..967cec9 --- /dev/null +++ b/hosts/nonat/configuartion.nix @@ -0,0 +1,40 @@ +{ config, pkgs, lib, ... }: + +{ + imports = + [ + ./hardware-configuration.nix + ../../configuration/common + ../../configuration/proxmox-vm + ]; + + boot.loader.grub.enable = true; + boot.loader.grub.version = 2; + boot.loader.grub.device = "/dev/vda"; + + networking.hostName = "nonat"; + + networking.useDHCP = false; + networking.interfaces.ens18.ipv4.addresses = [ + { address = "141.24.46.169"; prefixLength = 24; } + ]; + networking.interfaces.ens18.ipv6.addresses = [ + { address = "2001:638:904:ffca::6"; prefixLength = 64; } + ]; + networking.defaultGateway = { address = "141.24.46.1"; interface = "ens18"; }; + networking.defaultGateway6 = { address = "2001:638:904:ffca::1"; interface = "ens18"; }; + networking.nameservers = [ "141.24.40.3" "141.24.40.4" ]; + + networking.interfaces.ens19.ipv4.addresses = [ + { address = "192.168.10.1"; prefixLength = 24; } + ]; + networking.nat = { + enable = true; + externalInterface = "ens18"; + externalIP = (lib.head config.networking.interfaces.ens18.ipv4.addresses).address; + internalInterfaces = [ "ens19" ]; + internalIPs = "${ (lib.head config.networking.interfaces.ens18.ipv4.addresses).address}/${ (lib.head config.networking.interfaces.ens18.ipv4.addresses).prefixLength }"; + }; + + system.stateVersion = "21.03"; +} diff --git a/hosts/nonat/hardware-configuartion.nix b/hosts/nonat/hardware-configuartion.nix new file mode 100644 index 0000000..399f929 --- /dev/null +++ b/hosts/nonat/hardware-configuartion.nix @@ -0,0 +1,23 @@ +# Do not modify this file! It was generated by ‘nixos-generate-config’ +# and may be overwritten by future invocations. Please make changes +# to /etc/nixos/configuration.nix instead. +{ config, lib, pkgs, modulesPath, ... }: + +{ + imports = + [ (modulesPath + "/profiles/qemu-guest.nix") + ]; + + boot.initrd.availableKernelModules = [ "ata_piix" "uhci_hcd" "virtio_pci" "sr_mod" "virtio_blk" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = + { device = "/dev/disk/by-uuid/e39651d8-77cd-4e84-9dd6-6056b4d87fc2"; + fsType = "ext4"; + }; + + swapDevices = [ ]; + +}