Unterschiede
Hier werden die Unterschiede zwischen zwei Versionen angezeigt.
Beide Seiten der vorigen Revision Vorhergehende Überarbeitung Nächste Überarbeitung | Vorhergehende Überarbeitung | ||
linux:kea [19.10.2024 09:14. ] – [Konfigurationsoptionen für unseren DHCPv6-Daemon] django | linux:kea [14.03.2025 13:17. ] (aktuell) – [Ergebniskontrolle] django | ||
---|---|---|---|
Zeile 7: | Zeile 7: | ||
|< 100% 5% 8% 12% 12% 12% 12% 12% >| | |< 100% 5% 8% 12% 12% 12% 12% 12% >| | ||
- | ^ Subnetz \\ (ID) ^ Subnetz \\ (Use) ^ Subnetz Prefix\\ (global Unicast) | + | ^ Subnetz \\ (ID) ^ Subnetz \\ (Use) ^ Subnetz Prefix\\ (global Unicast) |
- | | **7** | Intra | 2003:a:e0d:760**7**::/ | + | | **7** | Intra | 2003:a:bcd:123**4**::/ |
- | | | + | | |
- | | | + | | |
- | | | + | | |
Zeile 1152: | Zeile 1152: | ||
==== Grund-Konfiguration ==== | ==== Grund-Konfiguration ==== | ||
=== Firewall/ | === Firewall/ | ||
- | Bevor wir nun unseren **Kea-DHCP-Daemon** | + | Bevor wir nun unseren **Kea-DHCP-Daemon** |
Wie auch schon früher bei **CentOS** ab Release **7** bzw. den nachfolgenden Relaese-Kandidaten **Stream von RHEL** nutzen wir auch unter **Arch Linux** den dynamischen **[[https:// | Wie auch schon früher bei **CentOS** ab Release **7** bzw. den nachfolgenden Relaese-Kandidaten **Stream von RHEL** nutzen wir auch unter **Arch Linux** den dynamischen **[[https:// | ||
Zeile 1180: | Zeile 1180: | ||
Werfen wir noch kurz einen Blick in die Zone **'' | Werfen wir noch kurz einen Blick in die Zone **'' | ||
- | # firewall-cmd --zone=intra --list-services | + | < |
dhcp dhcpv6 | dhcp dhcpv6 | ||
Zeile 2651: | Zeile 2651: | ||
Aus den oben genannten Konfigurationsparametern erstellen wir uns nun eine entsprechende Konfigurationsdatei **''/ | Aus den oben genannten Konfigurationsparametern erstellen wir uns nun eine entsprechende Konfigurationsdatei **''/ | ||
- | # vim / | + | # vim / |
- | FIXME | + | <file java / |
- | <file java / | + | // 9.2 DHCPv6 |
- | // 8.2. DHCPv4 | + | // for the stable version is https:// |
// | // | ||
- | // This configuration file contains only DHCPv4 | + | // This configuration file contains only DHCPv6 |
// If configurations for other Kea services are also included in this file they | // If configurations for other Kea services are also included in this file they | ||
- | // are ignored by the DHCPv4 | + | // are ignored by the DHCPv6 |
+ | // | ||
+ | // DHCPv6 configuration starts here. This section will be read by DHCPv6 server | ||
+ | // and will be ignored by other components. | ||
{ | { | ||
- | + | | |
- | // DHCPv4 configuration starts here. This section will be read by DHCPv4 server | + | // See section |
- | // and will be ignored by other components. | + | |
- | "Dhcp4": { | + | |
- | // See section | + | |
" | " | ||
- | | + | |
- | " | + | |
}, | }, | ||
- | + | ||
- | // See section 8.9. Management API for the DHCPv4 Server for more details. | + | // Kea supports control channel, which is a way to receive management |
+ | // commands while the server is running. For detailed description, | ||
+ | // see Sections | ||
" | " | ||
- | | + | |
- | " | + | " |
}, | }, | ||
- | + | // Use Memfile lease database backend to store leases in a CSV file. | |
- | // See Section | + | // See Section |
" | " | ||
- | | + | |
- | " | + | " |
- | " | + | " |
- | " | + | " |
- | " | + | " |
}, | }, | ||
+ | |||
// Setup reclamation of the expired leases and leases affinity. | // Setup reclamation of the expired leases and leases affinity. | ||
- | // See section 11. Lease Expiration for more and detailed informations. | + | // See section 11. Lease Expiration for more and detailed informations. |
" | " | ||
- | | + | |
- | " | + | " |
- | " | + | " |
- | " | + | " |
- | " | + | " |
- | " | + | " |
}, | }, | ||
+ | |||
// Global timers specified here apply to all subnets, unless there are | // Global timers specified here apply to all subnets, unless there are | ||
// subnet specific values defined in particular subnets. See section | // subnet specific values defined in particular subnets. See section | ||
- | // 8.2.1. Introduction | + | // 9.2.1. Introduction. |
- | | + | |
" | " | ||
" | " | ||
- | "valid-lifetime": | + | "preferred-lifetime": |
+ | |||
// Many additional parameters can be specified here. Alle datails will be | // Many additional parameters can be specified here. Alle datails will be | ||
// found in following sections: | // found in following sections: | ||
- | // - 8.2.10. Standard | + | // - 9.2.11. Standard |
- | // - 8.2.11. Custom DHCPv4 Options | + | // - 9.2.14. Custom DHCPv4 Options |
- | // - 8.2.12. DHCPv4 Private Options | + | // - 9.2.15. DHCPv6 |
- | // - 8.2.13. DHCPv4 | + | // - 9.2.16. Nested |
- | // - 8.2.14. Nested | + | // - 9.2.17. Unspecified Parameters for DHCPv6 |
- | // - 8.2.15. Unspecified Parameters for DHCPv4 | + | // |
- | // - 8.2.16. Support for Long Options | + | // For a complete list of options currently supported by Kea, see |
+ | // Section 9.2.11 " | ||
+ | // vendor options (see Section 7.2.10) and allows users to define their | ||
+ | // own custom options (see Section 7.2.9). | ||
" | " | ||
- | | + | |
- | //{ | + | { |
- | | + | " |
- | | + | " |
- | //}, | + | }, |
- | + | ||
- | // Domain-Name: | + | // Domain-Search-Liste: |
- | { | + | { |
- | " | + | " |
- | " | + | " |
- | }, | + | } |
- | + | ||
- | // Time-Server: | + | |
- | //{ | + | |
- | // " | + | |
- | // " | + | |
- | //}, | + | |
- | + | ||
- | // Time-Offset ( Eastern Standard Time): | + | |
- | { | + | |
- | " | + | |
- | " | + | |
- | | + | |
], | ], | ||
// Finally, we list the subnets from which we will be leasing addresses. | // Finally, we list the subnets from which we will be leasing addresses. | ||
- | // See section | + | // See section |
// for more details. | // for more details. | ||
- | "subnet4": [ | + | "subnet6": [ |
- | { | + | { |
- | // This defines the whole subnet. Kea will use this information to | + | " |
- | // determine where the clients are connected. This is the whole | + | |
- | // subnet in your network. | + | |
- | | + | // This defines the whole subnet. Kea will use this information to |
- | " | + | // determine where the clients are connected. This is the whole |
+ | // subnet in your network. | ||
+ | |||
+ | | ||
+ | // Subnet identifier for zone intra | ||
+ | | ||
- | | + | |
- | " | + | " |
- | | + | |
- | // by Kea. | + | // by Kea. |
- | " | + | " |
- | | + | " |
- | "option-data": | + | |
- | { | + | // specific. Also, you can override global options here. |
- | // Router for the IPv4 subnet. | + | { |
- | | + | "name": "dns-servers", |
- | " | + | "data": |
- | }, | + | |
+ | | ||
+ | " | ||
+ | " | ||
+ | } | ||
- | { | + | ], |
- | // Time-Server: | + | |
- | " | + | |
- | " | + | |
- | }, | + | |
- | { | + | // Host reservations can be defined for each subnet. |
- | // Domain-Name-Server: | + | // Note that reservations are subnet-specific in Kea. This is |
- | " | + | // different than ISC DHCP. Keep that in mind when migrating |
- | "data": | + | // your configurations. |
- | } | + | |
- | | + | // This are the reservations for specific DUID matchings. |
+ | // "MNSS (C7)" | ||
+ | { | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | }, | ||
- | | + | |
- | // by several different types of identifiers: | + | { |
- | // (hardware/ | + | |
- | | + | |
- | | + | "hostname": |
- | "reservations": | + | }, |
- | | + | |
- | // MNSS (c7) | + | { |
- | { | + | "duid": "00:03:00:01:64: |
- | "hw-address": "ac:1f:6b:00:d3:9a", | + | "ip-addresses": |
- | "ip-address": "10.0.10.2", | + | " |
- | " | + | }, |
- | }, | + | |
- | | + | |
- | { | + | { |
- | "hw-address": "00:25:90:13:ba:a2", | + | "duid": "00:03:00:01:6c:cd:d6:b8:52:be", |
- | " | + | "ip-addresses": [ "fd00:0:0:7:10:0:10:7" |
- | " | + | " |
- | } | + | }, |
- | ], | + | |
- | "reservations": [ | + | |
- | + | ||
- | // This are the reservations for a specific hardware/ | + | |
- | // vml000200 | + | |
- | { | + | |
- | " | + | |
- | " | + | |
- | " | + | |
- | }, | + | |
- | | + | |
- | { | + | { |
- | "hw-address": "52:54:00:41:20:11", | + | "duid": "00:03:00:01:00: |
- | "ip-address": "10.0.0.201", | + | "ip-addresses": |
- | " | + | " |
- | }, | + | }, |
- | | + | |
- | { | + | { |
- | "hw-address": "52:54:00:41:20:21", | + | "duid": "00:02:00:00: |
- | "ip-address": "10.0.0.202", | + | "ip-addresses": |
- | " | + | " |
- | }, | + | }, |
- | | + | |
- | { | + | { |
- | "hw-address": "52:54:00:41:20: | + | "duid": "00:03:00:01: |
- | " | + | "ip-addresses": |
- | " | + | " |
- | }, | + | } |
- | + | ] | |
- | // vml000204 | + | } |
- | { | + | |
- | " | + | |
- | "ip-address": "10.0.0.204", | + | |
- | " | + | |
- | } | + | |
- | ] | + | |
- | } | + | |
], | ], | ||
// Logging configuration starts here. Kea uses different loggers to log various | // Logging configuration starts here. Kea uses different loggers to log various | ||
- | // activities. For details (e.g. names of loggers), see Chapter | + | //# activities. For details (e.g. names of loggers), see Chapter |
" | " | ||
- | | + | |
- | // This section affects | + | // This specifies the logging for kea-dhcp6 logger, i.e. all logs |
- | // component. It tells DHCPv4 server to write all log messages (on | + | // generated by Kea DHCPv6 server. |
- | // severity INFO or more) to a file. | + | " |
- | " | + | |
" | " | ||
- | | + | |
- | // Specifies the output file. There are several special values | + | // Specifies the output file. There are several special values |
- | // supported: | + | // supported: |
- | // - stdout (prints on standard output) | + | // - stdout (prints on standard output) |
- | // - stderr (prints on standard error) | + | // - stderr (prints on standard error) |
- | // - syslog (logs to syslog) | + | // - syslog (logs to syslog) |
- | // - syslog:name (logs to syslog using specified name) | + | // - syslog:name (logs to syslog using specified name) |
- | // Any other value is considered a name of the file | + | // Any other value is considered a name of the file |
- | " | + | " |
- | } | + | } |
], | ], | ||
+ | |||
// This specifies the severity of log messages to keep. Supported values | // This specifies the severity of log messages to keep. Supported values | ||
// are: FATAL, ERROR, WARN, INFO, DEBUG | // are: FATAL, ERROR, WARN, INFO, DEBUG | ||
Zeile 2872: | Zeile 2855: | ||
// of logs if told to do so. | // of logs if told to do so. | ||
" | " | ||
- | | + | |
- | ] | + | ] |
- | } | + | } |
- | } | + | }</ |
- | </ | + | |
Wollen wir die Kondfigurationsdate ohne die Kommentare sehen, grep' | Wollen wir die Kondfigurationsdate ohne die Kommentare sehen, grep' | ||
- | # grep -Ev ' | + | # grep -Ev ' |
++++ Beispielkonfigurationsdatei ohne Kommentare | | ++++ Beispielkonfigurationsdatei ohne Kommentare | | ||
- | <file java / | + | <file java / |
- | "Dhcp4": { | + | "Dhcp6": { |
" | " | ||
- | | + | |
- | " | + | |
}, | }, | ||
+ | |||
" | " | ||
- | | + | |
- | " | + | " |
}, | }, | ||
" | " | ||
- | | + | |
- | " | + | " |
- | " | + | " |
- | " | + | " |
- | " | + | " |
}, | }, | ||
+ | |||
" | " | ||
- | | + | |
- | " | + | " |
- | " | + | " |
- | " | + | " |
- | " | + | " |
- | " | + | " |
}, | }, | ||
+ | |||
+ | " | ||
" | " | ||
" | " | ||
- | "valid-lifetime": | + | "preferred-lifetime": |
+ | |||
" | " | ||
- | | + | |
- | " | + | " |
- | " | + | " |
- | }, | + | }, |
- | { | + | |
- | " | + | |
- | " | + | " |
- | } | + | " |
+ | } | ||
], | ], | ||
- | "subnet4": [ | + | "subnet6": [ |
- | { | + | { |
- | " | + | " |
- | " | + | |
- | " | + | |
- | " | + | " |
- | { | + | " |
- | " | + | " |
- | " | + | { |
- | }, | + | " |
- | { | + | " |
- | " | + | }, |
- | " | + | { |
- | }, | + | " |
- | { | + | " |
- | " | + | } |
- | " | + | ], |
- | } | + | " |
- | ], | + | { |
- | " | + | "duid": "00: |
- | { | + | "ip-addresses": |
- | "hw-address": " | + | " |
- | "ip-address": "10.0.10.2", | + | }, |
- | " | + | { |
- | }, | + | "duid": "00:03:00: |
- | { | + | "ip-addresses": |
- | "hw-address": "00:25:90:13:ba:a2", | + | " |
- | "ip-address": "10.0.10.3", | + | }, |
- | " | + | { |
- | } | + | "duid": "00:03:00: |
- | ] | + | "ip-addresses": [ "fd00:0:0:7:10:0:10:6" |
- | | + | "hostname": "pnc010006.intra.nausch.org" |
- | { | + | }, |
- | "id": | + | { |
- | " | + | "duid": "00:03:00:01:6c:cd: |
- | " | + | "ip-addresses": |
- | "option-data": [ | + | " |
- | { | + | }, |
- | "name": | + | { |
- | " | + | "duid": "00:03:00:01:00:0b: |
- | }, | + | "ip-addresses": |
- | + | " | |
- | { | + | }, |
- | " | + | { |
- | " | + | "duid": "00:02:00:00:ab:11:3e:4a:0e:2c:c1:5b:e2:64", |
- | }, | + | "ip-addresses": |
- | + | " | |
- | { | + | }, |
- | " | + | { |
- | "data": "172.17.2.1" | + | "duid": "00: |
- | } | + | "ip-addresses": |
- | + | " | |
- | ], | + | } |
- | " | + | ] |
- | + | } | |
- | | + | |
- | "hw-address": "52:54:00:41:20:01", | + | |
- | "ip-address": "10.0.0.200", | + | |
- | " | + | |
- | }, | + | |
- | { | + | |
- | "hw-address": "52:54:00:41:20:11", | + | |
- | "ip-address": "10.0.0.201", | + | |
- | " | + | |
- | }, | + | |
- | { | + | |
- | "hw-address": "52:54:00:41:20:21", | + | |
- | " | + | |
- | " | + | |
- | }, | + | |
- | { | + | |
- | " | + | |
- | "ip-address": "10.0.0.203", | + | |
- | " | + | |
- | }, | + | |
- | { | + | |
- | "hw-address": " | + | |
- | "ip-address": "10.0.0.204", | + | |
- | " | + | |
- | } | + | |
- | ] | + | |
- | } | + | |
], | ], | ||
" | " | ||
- | | + | |
- | " | + | " |
" | " | ||
- | | + | |
- | " | + | " |
- | } | + | } |
], | ], | ||
" | " | ||
" | " | ||
- | | + | |
- | ] | + | ] |
- | } | + | } |
}</ | }</ | ||
++++ | ++++ | ||
- | Bevor wir nun unseren **kea-dhcp4** starten, führen wir noch einen Konfigurationstest durch. Wir prüfen also nun die Konfigurationsdatei unseres **kea-dhcp4** auf syntaktische Fehler. | + | |
- | # kea-dhcp4 -t / | + | |
- | < | + | Bevor wir nun unseren **kea-dhcp6**-Daemon |
- | 2024-07-04 17:23:55.328 WARN [kea-dhcp4.dhcpsrv/1913.135232873002112] DHCPSRV_MT_DISABLED_QUEUE_CONTROL disabling dhcp queue control when multi-threading is enabled. | + | # kea-dhcp6 -t / |
- | 2024-07-04 17:23:55.328 WARN [kea-dhcp4.dhcp4/1913.135232873002112] DHCP4_RESERVATIONS_LOOKUP_FIRST_ENABLED | + | < |
- | 2024-07-04 17:23:55.328 INFO [kea-dhcp4.dhcpsrv/1913.135232873002112] DHCPSRV_CFGMGR_NEW_SUBNET4 | + | 2024-10-19 11:42:46.736 WARN [kea-dhcp6.dhcpsrv/13028.126477756442496] DHCPSRV_MT_DISABLED_QUEUE_CONTROL disabling dhcp queue control when multi-threading is enabled. |
- | 2024-07-04 17:23:55.330 INFO [kea-dhcp4.dhcpsrv/1913.135232873002112] DHCPSRV_CFGMGR_NEW_SUBNET4 | + | 2024-10-19 11:42:46.736 WARN [kea-dhcp6.dhcp6/13028.126477756442496] DHCP6_RESERVATIONS_LOOKUP_FIRST_ENABLED |
- | 2024-07-04 17:23:55.330 | + | 2024-10-19 11:42:46.736 INFO [kea-dhcp6.dhcpsrv/13028.126477756442496] DHCPSRV_CFGMGR_NEW_SUBNET6 |
- | 2024-07-04 17:23:55.330 INFO [kea-dhcp4.dhcpsrv/1913.135232873002112] DHCPSRV_CFGMGR_SOCKET_TYPE_SELECT | + | 2024-10-19 11:42:46.738 INFO [kea-dhcp6.dhcpsrv/13028.126477756442496] DHCPSRV_CFGMGR_SOCKET_TYPE_SELECT using socket type raw |
- | 2024-07-04 17:23:55.331 INFO [kea-dhcp4.dhcpsrv/1913.135232873002112] DHCPSRV_CFGMGR_ADD_IFACE listening | + | 2024-10-19 11: |
- | 2024-07-04 17:23:55.331 INFO [kea-dhcp4.dhcpsrv/1913.135232873002112] DHCPSRV_CFGMGR_ADD_IFACE listening | + | |
+ | === Start des kea-dhcp6 === | ||
+ | Nun können wir beruhigt und guten Mutes unseren **kea-dhcp6** Daemon starten. | ||
+ | # systemctl start kea-dhcp6.service | ||
+ | |||
+ | Im **Journal** wir der Start entsprechend dokumentiert. | ||
+ | |||
+ | < | ||
+ | Oct 19 11:49:49 vml000110 kea-dhcp6[13092]: | ||
+ | Oct 19 11:49:49 vml000110 kea-dhcp6[13092]: | ||
+ | Oct 19 11:49:49 vml000110 kea-dhcp6[13092]: | ||
+ | Oct 19 11:49:49 vml000110 kea-dhcp6[13092]: | ||
+ | Oct 19 11:49:49 vml000110 kea-dhcp6[13092]: | ||
+ | Oct 19 11:49:49 vml000110 kea-dhcp6[13092]: | ||
+ | Oct 19 11:49:49 vml000110 kea-dhcp6[13092]: INFO [kea-dhcp6.dhcpsrv.138845348149120] DHCPSRV_CFGMGR_SOCKET_TYPE_SELECT using socket type raw | ||
+ | Oct 19 11:49:49 vml000110 kea-dhcp6[13092]: | ||
+ | Oct 19 11:49:49 vml000110 kea-dhcp6[13092]: | ||
+ | Oct 19 11:49:49 vml000110 kea-dhcp6[13092]: | ||
+ | Oct 19 11:49:49 vml000110 kea-dhcp6[13092]: | ||
+ | Oct 19 11:49:49 vml000110 kea-dhcp6[13092]: INFO [kea-dhcp6.dhcpsrv.138845348149120] DHCPSRV_MEMFILE_LEASE_FILE_LOAD loading leases from file / | ||
+ | Oct 19 11:49:49 vml000110 kea-dhcp6[13092]: | ||
+ | Oct 19 11:49:49 vml000110 kea-dhcp6[13092]: | ||
+ | Oct 19 11:49:49 vml000110 kea-dhcp6[13092]: | ||
+ | Oct 19 11:49:49 vml000110 kea-dhcp6[13092]: | ||
+ | Oct 19 11:49:49 vml000110 kea-dhcp6[13092]: | ||
+ | Oct 19 11:49:49 vml000110 kea-dhcp6[13092]: | ||
+ | Oct 19 11:49:49 vml000110 kea-dhcp6[13092]: | ||
+ | Oct 19 11:49:49 vml000110 kea-dhcp6[13092]: | ||
+ | Oct 19 11:49:49 vml000110 kea-dhcp6[13092]: | ||
+ | </ | ||
+ | |||
+ | Bei Bedarf können wir natürlich auch den Status unseres Daemons jederzeit abfragen. | ||
+ | # systemctl status kea-dhcp6.service | ||
+ | |||
+ | < | ||
+ | <font style=" | ||
+ | | ||
+ | | ||
+ | | ||
+ | Docs: man: | ||
+ | Main PID: 13092 (kea-dhcp6) | ||
+ | Tasks: 9 (limit: 9510) | ||
+ | | ||
+ | CPU: 66ms | ||
+ | | ||
+ | | ||
+ | |||
+ | Oct 19 11:49:49 vml000110 kea-dhcp6[13092]: | ||
+ | Oct 19 11:49:49 vml000110 kea-dhcp6[13092]: | ||
+ | Oct 19 11:50:00 vml000110 kea-dhcp6[13092]: | ||
+ | Oct 19 11:50:00 vml000110 kea-dhcp6[13092]: | ||
+ | Oct 19 11:50:00 vml000110 kea-dhcp6[13092]: | ||
+ | Oct 19 11:50:00 vml000110 kea-dhcp6[13092]: | ||
+ | Oct 19 11:51:52 vml000110 kea-dhcp6[13092]: | ||
+ | Oct 19 11:51:52 vml000110 kea-dhcp6[13092]: | ||
+ | Oct 19 11:51:52 vml000110 kea-dhcp6[13092]: | ||
+ | Oct 19 11:51:52 vml000110 kea-dhcp6[13092]: | ||
+ | </pre></ | ||
+ | |||
+ | Verbindet sich nun ein uns unbekannter Host und kontaktiert unseren **kea-dhcp6**-Daemon wird der erfolgreiche Handshake im **Journal** protokolliert. | ||
+ | # journalctl -fu kea-dhcp6 | ||
+ | |||
+ | < | ||
+ | Oct 19 12:10:53 vml000110 kea-dhcp6[13178]: | ||
+ | Oct 19 12:10:53 vml000110 kea-dhcp6[13178]: | ||
+ | Oct 19 12:10:53 vml000110 kea-dhcp6[13178]: | ||
+ | </ | ||
+ | |||
+ | Dem Client wurde also die IP-Adresse **'' | ||
+ | |||
+ | Verbindet sich jedoch nun ein uns bekannter Client, dessen DUID **'' | ||
+ | # journalctl -fu kea-dhcp4 | ||
+ | < | ||
+ | Oct 19 12:11:14 vml000110 kea-dhcp6[13178]: | ||
+ | Oct 19 12:11:14 vml000110 kea-dhcp6[13178]: | ||
+ | Oct 19 12:11:14 vml000110 kea-dhcp6[13178]: | ||
+ | Oct 19 12:11:14 vml000110 kea-dhcp6[13178]: | ||
+ | |||
+ | Der Host hat also seine vordefinierte **feste IPv6-Adresse** **'' | ||
+ | |||
+ | ===== Orchestrierung - Installation und Konfiguration der beiden Kea-Daemon mit Hilfe von Ansible | ||
+ | ==== Aufgabenstellung ==== | ||
+ | Natürlich wird man im Jahr 2024 nicht mehr ernsthaft, manuell Server aufsetzen und betreiben wollen. Vielmehr wird man auf ein Orchestrierungswerkzeug wie z.B. **[[linux: | ||
+ | |||
+ | Wir werden uns nun nachfolgend die Server-Installation und -konfiguration genauer betrachten. | ||
+ | |||
+ | ==== Lösung ==== | ||
+ | |||
+ | <WRAP center round tip 80%> | ||
+ | Der ungeduldigen Leser kann auch direkt zur Tat schreiten und das manuelle Anlegen der Inventory-Hülle, | ||
+ | |||
+ | < | ||
+ | -O - | tar -xz --strip-components=1 -C ~/ | ||
+ | |||
+ | Nach Anpassung der Daten im Inventory kann man anschliessend direkt **[[# | ||
+ | </ | ||
+ | |||
+ | === Vorbereitung - (Server-)Daten im Inventory === | ||
+ | Bei unserem Konfigurationsbeispiel hier gehen wir von folgenden Host-Parametern aus: | ||
+ | * **'' | ||
+ | * **'' | ||
+ | |||
+ | Die Konfigurationsdatei unseres **inventory** in unsere, Ansible-Verzeichnis beinhaltet demnach unter anderem: | ||
+ | $ vim inventories/ | ||
+ | ++++ inventories/ | ||
+ | <file bash inventories/ | ||
+ | # | ||
+ | # Hinweise: | ||
+ | # - Kommentare beginnen mit einem '#' | ||
+ | # - leere Zeilen werden ignoriert | ||
+ | # - Host- und Gruppendefinitionen werden mit [] abgegrenzt | ||
+ | # - Hosts können über ihren Hostnamen, FQN oder ihrer IP-Adresse definiert | ||
+ | # - übergeordnete Gruppen werden durch [:children] abgegrenzt | ||
+ | # | ||
+ | # Host-Definitionen | ||
+ | |||
+ | # Hosts ohne Gruppenzuordnung | ||
+ | localhost | ||
+ | |||
+ | [edmz] | ||
+ | vml000210 | ||
+ | |||
+ | [idmz] | ||
+ | vml000110 | ||
+ | |||
+ | [intra] | ||
+ | pnc010007 | ||
+ | vml010110 | ||
+ | |||
+ | |||
+ | # Host-Gruppen-Definitionen | ||
+ | # (zu welcher Gruppe gehören Untergruppen bzw. Hosts) | ||
+ | |||
+ | [linux: | ||
+ | intra | ||
+ | edmz | ||
+ | idmz | ||
+ | </ | ||
+ | ++++ | ||
+ | |||
+ | Die beiden Beispiel-Hosts aus der Gruppe|Zone **'' | ||
+ | * Der Host **'' | ||
+ | * Der Host **'' | ||
+ | |||
+ | Wir legen uns also nun die Hostdefinitionsdatei für unseren Switch im SOHO an. | ||
+ | $ vim inventories/ | ||
+ | ++++ inventories/ | ||
+ | |||
+ | {{gh> https:// | ||
+ | |||
+ | ++++ | ||
+ | |||
+ | Als nächstes legen wir die Datei für den KVM-Host, auf dem unser Kea-Daemon laufen soll an und definieren darin die zugehörigen Eigenschaften. | ||
+ | $ vim inventories/ | ||
+ | ++++ inventories/ | ||
+ | |||
+ | {{gh> https:// | ||
+ | |||
+ | ++++ | ||
+ | |||
+ | Die für die beiden **kea-Daemon** relevanten Konfigurationsparameter legen wir in der Inventrory-Datei **'' | ||
+ | $ vim inventories/ | ||
+ | ++++ inventories/ | ||
+ | |||
+ | {{gh> https:// | ||
+ | |||
+ | ++++ | ||
+ | |||
+ | Unser Beispiels-Inventory hat also nunmehr folgenden Aufbau: | ||
+ | < | ||
+ | ├── hosts | ||
+ | └── host_vars | ||
+ | ├── pnc010007 | ||
+ | └── vml010110 | ||
+ | ├── kea | ||
+ | └── kvm_vhost | ||
+ | |||
+ | 3 directories, | ||
+ | |||
+ | === Playbook === | ||
+ | Unser Playbook zum Installieren und Konfigurieren der beiden Kea-Daemon **kea-dhcp4** und **kea-dhcp6**, | ||
+ | $ vim playbooks/ | ||
+ | ++++ playbooks/ | ||
+ | |||
+ | {{gh> https:// | ||
+ | |||
+ | ++++ | ||
+ | |||
+ | === Rolle === | ||
+ | Für die Konfiguration der **kea**-Daemon verwenden wir eine eigene Rolle **'' | ||
+ | $ cp -avr roles/ | ||
+ | |||
+ | ++++ Ausgabe von cp -avr roles/ | ||
+ | < | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | </ | ||
+ | ++++ | ||
+ | |||
+ | Bei Bedarf können wir uns die Struktur die somit angelegt wurde mit nachfolgendem Befehl anzeigen lassen. | ||
+ | $ tree roles/ | ||
+ | |||
+ | ++++ Ausgabe von tree roles/ | ||
+ | < | ||
+ | ├── defaults | ||
+ | ├── files | ||
+ | ├── handlers | ||
+ | │ └── main.yml | ||
+ | ├── library | ||
+ | ├── lookup_plugins | ||
+ | ├── meta | ||
+ | ├── module_utils | ||
+ | ├── tasks | ||
+ | │ ├── dhcp4.yml | ||
+ | │ ├── dhcp6.yml | ||
+ | │ ├── firewalld.yml | ||
+ | │ ├── main.yml | ||
+ | │ └── vorbereitung.yml | ||
+ | ├── templates | ||
+ | │ ├── dhcp4.j2 | ||
+ | │ └── dhcp6.j2 | ||
+ | └── vars | ||
+ | |||
+ | 11 directories, | ||
+ | </ | ||
+ | ++++ | ||
+ | |||
+ | Wie wir sehen ist die Rolle durchaus überschaubar, | ||
+ | $ vim roles/ | ||
+ | ++++ roles/ | ||
+ | |||
+ | {{gh> https:// | ||
+ | |||
+ | ++++ | ||
+ | |||
+ | Die Installation des Kea DHCP-Servers wird in der ersten Task-Gruppe mit dem tag **'' | ||
+ | $ vim roles/ | ||
+ | ++++ roles/ | ||
+ | |||
+ | {{gh> https:// | ||
+ | |||
+ | ++++ | ||
+ | |||
+ | Für die Konfiguration des Kea-DHCP4-Daemon werden die nötigen Schritte in der Task-Gruppe mit dem tag **'' | ||
+ | $ vim roles/ | ||
+ | ++++ roles/ | ||
+ | |||
+ | {{gh> https:// | ||
+ | |||
+ | ++++ | ||
+ | |||
+ | Der Kea-DHCP4-Daemon wird mit Hilfe der Task-Gruppe mit dem tag **'' | ||
+ | $ vim roles/ | ||
+ | ++++ roles/ | ||
+ | |||
+ | {{gh> https:// | ||
+ | |||
+ | ++++ | ||
+ | |||
+ | Nun brauchen wir noch eine Beschreibung der Aufgaben für die Konfiguration der firewalld-Regeln für beide Kea Daemons. | ||
+ | $ vim roles/ | ||
+ | ++++ roles/ | ||
+ | |||
+ | {{gh> https:// | ||
+ | |||
+ | ++++ | ||
+ | |||
+ | Sollte bei der Abarbeitung des Playbook eine oder beide Konfigurationsdateien **'' | ||
+ | |||
+ | Zu guter Letzt brauchen wir noch eine Konfiguration der Aufgaben die bei einem **'' | ||
+ | $ vim roles/ | ||
+ | ++++ roles/ | ||
+ | |||
+ | {{gh> https:// | ||
+ | |||
+ | ++++ | ||
+ | |||
+ | Für die Erstellung der jeweiligen Konfigurationsdateien **''/ | ||
+ | $ vim roles/ | ||
+ | ++++ roles/ | ||
+ | |||
+ | {{gh> https:// | ||
+ | |||
+ | ++++ | ||
+ | |||
+ | $ vim roles/ | ||
+ | ++++ roles/ | ||
+ | |||
+ | {{gh> https:// | ||
+ | |||
+ | ++++ | ||
+ | |||
+ | === Ausführung - Playbooklauf === | ||
+ | Die orchestrierte Variante der Installation und Konfiguration unserer **kea**-Daemon gestaltet sich ab sofort sehr einfach, brauchen wir doch lediglich die Konfigurationswerte im Inventory zu hinterlegen und zu pflegen und letztendlich das Playbook entsprechend aufzurufen, wenn z.B. ein Client im Intranet hinzugefügt, | ||
+ | $ ansible-playbook playbooks/ | ||
+ | |||
+ | < | ||
+ | <font style=" | ||
+ | <font style=" | ||
+ | <font style=" | ||
+ | <font style=" | ||
+ | <font style=" | ||
+ | <font style=" | ||
+ | <font style=" | ||
+ | <font style=" | ||
+ | <font style=" | ||
+ | <font style=" | ||
+ | <font style=" | ||
+ | <font style=" | ||
+ | <font style=" | ||
+ | <font style=" | ||
+ | <font style=" | ||
+ | <font style=" | ||
+ | <font style=" | ||
+ | <font style=" | ||
+ | <font style=" | ||
+ | <font style=" | ||
+ | <font style=" | ||
+ | <font style=" | ||
+ | <font style=" | ||
+ | <font style=" | ||
+ | <font style=" | ||
+ | <font style=" | ||
+ | <font style=" | ||
+ | <font style=" | ||
+ | <font style=" | ||
+ | <font style=" | ||
+ | <font style=" | ||
+ | <font style=" | ||
+ | <font style=" | ||
+ | <font style=" | ||
+ | <font style=" | ||
+ | <font style=" | ||
+ | <font style=" | ||
+ | <font style=" | ||
+ | <font style=" | ||
+ | <font style=" | ||
+ | <font style=" | ||
+ | </ | ||
+ | </ | ||
+ | |||
+ | ==== Ergebniskontrolle ==== | ||
+ | Ob die Konfigurationsdateien valide erstellt und auch von den Kea-Daemons erfolgreich geladen worden sind, kontrollieren wir zum Beispiel auf dem Zielhost mit einem Blick in die betreffenden Konfigurationsdateien, | ||
+ | * **kea-dhcp4** < | ||
+ | * **kea-dhcp6** < | ||
+ | |||
+ | ====== Links ====== | ||
+ | * **[[linux: | ||
+ | * **=> [[linux: | ||
+ | * **[[linux: | ||
+ | * **[[wiki: | ||
+ | * **[[http:// | ||