From 8e88006abe80653e09781b7f8ba85b874a8c1ece Mon Sep 17 00:00:00 2001 From: clerie Date: Sun, 14 Jul 2024 00:43:47 +0200 Subject: [PATCH] hosts/carbon: Move net-voip to seperate file --- hosts/carbon/configuration.nix | 93 +---------------------------- hosts/carbon/net-voip.nix | 105 +++++++++++++++++++++++++++++++++ 2 files changed, 106 insertions(+), 92 deletions(-) create mode 100644 hosts/carbon/net-voip.nix diff --git a/hosts/carbon/configuration.nix b/hosts/carbon/configuration.nix index 9508a93..e585000 100644 --- a/hosts/carbon/configuration.nix +++ b/hosts/carbon/configuration.nix @@ -9,6 +9,7 @@ ./dns.nix ./net-gastnetz.nix ./net-heimnetz.nix + ./net-voip.nix ./ppp.nix ]; @@ -49,14 +50,6 @@ id = 102; interface = "enp1s0"; }; - ## VoIP - networking.vlans."enp1s0.204" = { - id = 204; - interface = "enp1s0"; - }; - networking.interfaces."enp1s0.204".ipv4.addresses = [ - { address = "10.152.33.1"; prefixLength = 24; } - ]; # Use Anycast Nameservers networking.nameservers = [ "fd00:152:152::1" "10.152.0.1" ]; @@ -75,7 +68,6 @@ enable = true; settings = { interfaces-config = { - interfaces = [ "enp1s0.204" ]; service-sockets-max-retries = 15; service-sockets-retry-wait-time = 2000; }; @@ -84,89 +76,6 @@ persist = true; type = "memfile"; }; - option-def = [ - { - space = "dhcp4"; - name = "vendor-encapsulated-options"; - code = 43; - type = "empty"; - encapsulate = "sipdect"; - } - { - space = "sipdect"; - name = "ommip1"; - code = 10; - type = "ipv4-address"; - } - { - space = "sipdect"; - name = "ommip2"; - code = 19; - type = "ipv4-address"; - } - { - space = "sipdect"; - name = "syslogip"; - code = 14; - type = "ipv4-address"; - } - { - space = "sipdect"; - name = "syslogport"; - code = 15; - type = "int16"; - } - { - space = "dhcp4"; - name = "magic_str"; - code = 224; - type = "string"; - } - ]; - subnet4 = [ - # VoIP - { - id = 204; - subnet = "10.152.33.0/24"; - pools = [ - { - pool = "10.152.33.10 - 10.152.33.200"; - } - ]; - option-data = [ - { - name = "routers"; - data = "10.152.33.1"; - } - ]; - - reservations = [ - { - hostname = "iridium"; - hw-address = "00:30:42:1B:8C:7C"; - ip-address = "10.152.33.11"; - option-data = [ - { - name = "host-name"; - data = "iridium"; - } - { - name = "vendor-encapsulated-options"; - } - { - space = "sipdect"; - name = "ommip1"; - data = "10.152.33.11"; - } - { - name = "magic_str"; - data = "OpenMobilitySIP-DECT"; - } - ]; - } - ]; - } - ]; }; }; diff --git a/hosts/carbon/net-voip.nix b/hosts/carbon/net-voip.nix new file mode 100644 index 0000000..3a816fc --- /dev/null +++ b/hosts/carbon/net-voip.nix @@ -0,0 +1,105 @@ +{ ... }: + +{ + + ## VoIP + networking.vlans."enp1s0.204" = { + id = 204; + interface = "enp1s0"; + }; + networking.interfaces."enp1s0.204".ipv4.addresses = [ + { address = "10.152.33.1"; prefixLength = 24; } + ]; + + services.kea.dhcp4 = { + settings = { + interfaces-config = { + interfaces = [ "enp1s0.204" ]; + }; + option-def = [ + { + space = "dhcp4"; + name = "vendor-encapsulated-options"; + code = 43; + type = "empty"; + encapsulate = "sipdect"; + } + { + space = "sipdect"; + name = "ommip1"; + code = 10; + type = "ipv4-address"; + } + { + space = "sipdect"; + name = "ommip2"; + code = 19; + type = "ipv4-address"; + } + { + space = "sipdect"; + name = "syslogip"; + code = 14; + type = "ipv4-address"; + } + { + space = "sipdect"; + name = "syslogport"; + code = 15; + type = "int16"; + } + { + space = "dhcp4"; + name = "magic_str"; + code = 224; + type = "string"; + } + ]; + subnet4 = [ + # VoIP + { + id = 204; + subnet = "10.152.33.0/24"; + pools = [ + { + pool = "10.152.33.10 - 10.152.33.200"; + } + ]; + option-data = [ + { + name = "routers"; + data = "10.152.33.1"; + } + ]; + + reservations = [ + { + hostname = "iridium"; + hw-address = "00:30:42:1B:8C:7C"; + ip-address = "10.152.33.11"; + option-data = [ + { + name = "host-name"; + data = "iridium"; + } + { + name = "vendor-encapsulated-options"; + } + { + space = "sipdect"; + name = "ommip1"; + data = "10.152.33.11"; + } + { + name = "magic_str"; + data = "OpenMobilitySIP-DECT"; + } + ]; + } + ]; + } + ]; + }; + }; + +}