1
0
Fork 0

Add host nonat

This commit is contained in:
clerie 2020-12-07 16:57:50 +01:00
parent a89eabe338
commit 64d9609d49
2 changed files with 63 additions and 0 deletions

View File

@ -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";
}

View File

@ -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 = [ ];
}