Browse Source

Assign a static IP address

master
coolneng 5 months ago
parent
commit
8392ac213b
Signed by: coolneng GPG Key ID: 9893DA236405AF57
  1. 4
      configuration.nix
  2. 27
      modules/networking.nix

4
configuration.nix

@ -32,9 +32,6 @@
# Cleanup tmp on startup
boot.cleanTmpDir = true;
# Set hostname
networking.hostName = "zion";
# Create coolneng user
users.users.coolneng = {
isNormalUser = true;
@ -54,7 +51,6 @@
services.timesyncd.enable = true;
# Enable ZFS support
networking.hostId = "4e74ea68";
boot.supportedFilesystems = [ "zfs" ];
# Scrub zpool monthly

27
modules/networking.nix

@ -3,6 +3,25 @@
let password = builtins.readFile /var/keys/ddclient;
in {
# Assign a static IP
networking = {
hostName = "zion";
hostId = "4e74ea68";
interfaces.eth0 = {
useDHCP = false;
ipv4.addresses = [{
address = "192.168.13.2";
prefixLength = 24;
}];
};
defaultGateway = {
address = "192.168.13.1";
interface = "eth0";
};
nameservers = [ "195.10.195.195" "165.22.224.164" ];
enableIPv6 = false;
};
# Enable zeroconf
services.avahi = {
enable = true;
@ -42,12 +61,6 @@ in {
'';
};
# Disable IPv6
networking.enableIPv6 = false;
# Disable WiFi
networking.interfaces."eth0".useDHCP = true;
# Enable NAT for wireguard
networking.nat = {
enable = true;
@ -79,7 +92,7 @@ in {
# DNS server with ad-block
services.dnsmasq = {
enable = true;
servers = [ "195.10.195.195" "165.22.224.164" ];
servers = config.networking.nameservers;
extraConfig = ''
domain-needed
bogus-priv

Loading…
Cancel
Save