Kea-dhcp-5105: Unterschied zwischen den Versionen

Aus Xinux Wiki
Zur Navigation springen Zur Suche springen
 
(4 dazwischenliegende Versionen desselben Benutzers werden nicht angezeigt)
Zeile 7: Zeile 7:
 
[[Kategorie:Kea]]
 
[[Kategorie:Kea]]
  
=Template klonen=
+
=Debian Template klonen=
name: dhcp.it2XX.int
+
 
ip: 172.26.2XX.2
+
{| class="wikitable" style="background-color: #f2f2f2;"
gw: 172.26.2XX.1
+
! Parameter !! Wert !! Erläuterung
nameserver: 10.88.2XX.21
+
|-
 +
| '''Netzwerk (NIC)''' || LAN || Interface-Zuweisung in VirtualBox
 +
|-
 +
| '''IP''' || 172.26.2XX.2 || Statische IP
 +
|-
 +
| '''CIDR''' || 24 || Classless Inter-Domain Routing Präfixlänge
 +
|-
 +
| '''GW''' || 172.26.2XX.1 || GATEWAY
 +
|-
 +
| '''NS''' || 10.88.2XX.21 || Resolver
 +
|-
 +
| '''FQDN''' || dhcp.it2XX.int || Fully Qualified Domain Name
 +
|-
 +
| '''SHORT''' || dhcp || Short Name
 +
|-
 +
| '''DOM''' || it2XX.int|| Domain Name
 +
|}
  
 
=Jump Host einrichten=
 
=Jump Host einrichten=
;Auf eurem Host
+
;Auf eurem Host anfügen
 
[kit@host200 ~]$ cat .ssh/config  
 
[kit@host200 ~]$ cat .ssh/config  
 +
Host fw
 +
  HostName 192.168.HS.2XX
 +
  User kit
 +
 +
Host ns
 +
    Hostname 10.88.2XX.21
 +
    User kit
 +
    proxyJump kit@fw
 +
 
  Host dhcp
 
  Host dhcp
     Hostname 172.26.213.2
+
     Hostname 172.26.2XX.2
    User kit
 
    ProxyJump kit@192.168.9.213
 
 
Host ns
 
    Hostname 10.88.213.21
 
 
     User kit
 
     User kit
 +
    ProxyJump kit@fw
 +
 
= Installation =
 
= Installation =
 
* Die Installation und Konfiguration nimmt an das Debian 13 verwendet wird
 
* Die Installation und Konfiguration nimmt an das Debian 13 verwendet wird
Zeile 31: Zeile 53:
 
* Die Konfigurationssprache ist im JSON-Format
 
* Die Konfigurationssprache ist im JSON-Format
 
* Die folgende Konfiguration nimmt an, dass auf enp0s3 DHCP-Anfragen kommen
 
* Die folgende Konfiguration nimmt an, dass auf enp0s3 DHCP-Anfragen kommen
* enp0s8 sollte eine IP-Adresse im Netz 172.26.2xx.0/24 haben, damit er IP-Adressen aus dem angegebenen Subnetz vergeben kann
+
* enp0s3 sollte eine IP-Adresse im Netz 172.26.2XX.0/24 haben, damit er IP-Adressen aus dem angegebenen Subnetz vergeben kann
 
* Die Konfigurationen sind für 2 Stunden (7200 Sekunden) gültig
 
* Die Konfigurationen sind für 2 Stunden (7200 Sekunden) gültig
* Es werden IP-Adressen von 172.26.2xx.100 bis .200 vergeben
+
* Es werden IP-Adressen von 172.26.2XX.100 bis .200 vergeben
* Die Clients bekommen 10.88.2xx.21 als DNS-Server
+
* Die Clients bekommen 10.88.2XX.21 als DNS-Server
* Die Clients bekommen it2xx.int als Suchdomäne
+
* Die Clients bekommen it2XX.int als Suchdomäne
 
* vim /etc/kea/kea-dhcp4.conf
 
* vim /etc/kea/kea-dhcp4.conf
  
Zeile 58: Zeile 80:
 
       {
 
       {
 
         "name": "domain-name-servers",
 
         "name": "domain-name-servers",
         "data": "10.88.213.21"
+
         "data": "10.88.2XX.21"
 
       },
 
       },
 
       {
 
       {
 
         "name": "domain-search",
 
         "name": "domain-search",
         "data":  "it213.int"  
+
         "data":  "it2XX.int"  
 
       }
 
       }
 
     ],
 
     ],
Zeile 69: Zeile 91:
 
       {
 
       {
 
         "id": 1,
 
         "id": 1,
         "subnet": "172.26.213.0/24",
+
         "subnet": "172.26.2XX.0/24",
  
 
         "pools": [
 
         "pools": [
 
           {
 
           {
             "pool": "172.26.213.100 - 172.26.213.200"
+
             "pool": "172.26.2XX.100 - 172.26.2XX.200"
 
           }
 
           }
 
         ],
 
         ],
Zeile 80: Zeile 102:
 
           {
 
           {
 
             "name": "routers",
 
             "name": "routers",
             "data": "172.26.213.1"
+
             "data": "172.26.2XX.1"
 
           }
 
           }
 
         ]
 
         ]

Aktuelle Version vom 3. Juni 2026, 08:59 Uhr


Debian Template klonen

Parameter Wert Erläuterung
Netzwerk (NIC) LAN Interface-Zuweisung in VirtualBox
IP 172.26.2XX.2 Statische IP
CIDR 24 Classless Inter-Domain Routing Präfixlänge
GW 172.26.2XX.1 GATEWAY
NS 10.88.2XX.21 Resolver
FQDN dhcp.it2XX.int Fully Qualified Domain Name
SHORT dhcp Short Name
DOM it2XX.int Domain Name

Jump Host einrichten

Auf eurem Host anfügen

[kit@host200 ~]$ cat .ssh/config

Host fw
  HostName 192.168.HS.2XX
  User kit
Host ns
    Hostname 10.88.2XX.21
    User kit
    proxyJump kit@fw
Host dhcp
    Hostname 172.26.2XX.2
    User kit
    ProxyJump kit@fw

Installation

  • Die Installation und Konfiguration nimmt an das Debian 13 verwendet wird
  • apt install kea

Konfiguration

  • Die Konfigurationssprache ist im JSON-Format
  • Die folgende Konfiguration nimmt an, dass auf enp0s3 DHCP-Anfragen kommen
  • enp0s3 sollte eine IP-Adresse im Netz 172.26.2XX.0/24 haben, damit er IP-Adressen aus dem angegebenen Subnetz vergeben kann
  • Die Konfigurationen sind für 2 Stunden (7200 Sekunden) gültig
  • Es werden IP-Adressen von 172.26.2XX.100 bis .200 vergeben
  • Die Clients bekommen 10.88.2XX.21 als DNS-Server
  • Die Clients bekommen it2XX.int als Suchdomäne
  • vim /etc/kea/kea-dhcp4.conf
{
  "Dhcp4": {
    "interfaces-config": {
      "interfaces": [
        "enp0s3"
      ]
    },
    "control-socket": {
      "socket-type": "unix",
      "socket-name": "/run/kea/kea4-ctrl-socket"
    },
    "lease-database": {
      "type": "memfile",
      "persist": true
    },
    "valid-lifetime": 7200,
    "option-data": [
      {
        "name": "domain-name-servers",
        "data": "10.88.2XX.21"
      },
      {
        "name": "domain-search",
        "data":  "it2XX.int" 
      }
    ],

    "subnet4": [
      {
        "id": 1,
        "subnet": "172.26.2XX.0/24",

        "pools": [
          {
            "pool": "172.26.2XX.100 - 172.26.2XX.200"
          }
        ],
     
        "option-data": [
          {
            "name": "routers",
            "data": "172.26.2XX.1"
          }
        ]
      }
    ]
  }
}

  • systemctl restart kea-dhcp4-server

Logging

  • Für die letzten 20 Zeilen des Dienstes kann journalctl befragt werden
  • journalctl -u kea-dhcp4-server -n 20
  • journalctl -fu kea-dhcp4-server
  • Eine Datenbank der Leases liegt unter /var/lib/kea/kea-leases4.csv
  • tail /var/lib/kea/kea-leases4.csv

Test

  • ss -lnup | grep 67
UNCONN 0      0       172.26.213.2:67         0.0.0.0:*    users:(("kea-dhcp4",pid=966,fd=13)

Debugging

  • kea-dhcp4 -t /pfad/zur/config

Logging

  • Letzte 20 Zeilen anzeigen: journalctl -u kea-dhcp4-server -n 20
  • Die Lease-Datenbank befindet sich unter /var/lib/kea/kea-leases4.csv
  • tail /var/lib/kea/kea-leases4.csv

Debugging

  • kea-dhcp4 -t /pfad/zur/config