get('kea'); $settings = modules()->settings('kea'); $metadataFallback = is_array($module['metadata_db_defaults'] ?? null) ? $module['metadata_db_defaults'] : []; $metadataConfig = is_array($settings['metadata_db'] ?? null) ? array_replace($metadataFallback, $settings['metadata_db']) : $metadataFallback; $fallback = $module['db_defaults'] ?? []; $error = null; $notice = null; $groups = []; $availableIpsByGroup = []; $usedIps = []; try { if (empty($metadataConfig['driver']) || empty($metadataConfig['dbname'])) { throw new RuntimeException('Nexus DHCP Zusatzdatenbank ist nicht konfiguriert.'); } $metadataRepo = new KeaHostMetadataRepository(Database::createFromArray($metadataConfig)); $metadataRepo->ensureSchema(); if ($_SERVER['REQUEST_METHOD'] === 'POST') { $action = (string)($_POST['action'] ?? ''); if ($action === 'save_group') { $metadataRepo->saveGroup( (string)($_POST['name'] ?? ''), (string)($_POST['description'] ?? ''), (string)($_POST['parent_name'] ?? '') ); $notice = 'Gruppe gespeichert.'; } elseif ($action === 'add_range') { $metadataRepo->addRange( (string)($_POST['group_name'] ?? ''), (string)($_POST['start_ip'] ?? ''), (string)($_POST['end_ip'] ?? '') ); $notice = 'IP-Bereich gespeichert.'; } } $groups = $metadataRepo->listGroupsWithRanges(); $keaRepo = new KeaHostRepository(modules()->modulePdo('kea', $fallback), $metadataRepo); $usedIps = array_merge($keaRepo->usedIpAddresses(), $metadataRepo->desiredIps()); $availableIpsByGroup = $metadataRepo->availableIpsByGroup($usedIps, 4096); } catch (Throwable $e) { $error = $e->getMessage(); } $usedIpLookup = array_flip(array_filter(array_map('strval', $usedIps))); $matrixForGroup = static function (array $group) use ($usedIpLookup): array { $dots = []; foreach (($group['ranges'] ?? []) as $range) { $start = ip2long((string)($range['start_ip'] ?? '')); $end = ip2long((string)($range['end_ip'] ?? '')); if ($start === false || $end === false) { continue; } for ($ip = $start; $ip <= $end && count($dots) < 512; $ip++) { $address = long2ip($ip); if ($address === false) { continue; } $dots[] = [ 'ip' => $address, 'used' => isset($usedIpLookup[$address]), ]; } } return $dots; }; ?> 'KEA Gruppen', ]) ?>

KEA Gruppen

Gruppen und IP-Bereiche fuer DHCP-Reservierungen.

Zurueck
Gruppe

Gruppe anlegen

IP-Bereich

Bereich zuweisen

Uebersicht

Gruppen und freie IPs

Gruppe Untergruppe von Beschreibung Bereiche Freie IPs Matrix
Noch keine Gruppen definiert.
Kein Bereich
-
Kein Bereich