This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
сервис_dhcp [2022/11/03 13:46] val [Сервис DHCP] |
сервис_dhcp [2024/11/30 16:33] (current) val [Мониторинг выданных адресов] |
||
---|---|---|---|
Line 7: | Line 7: | ||
* [[https://www.isc.org/kea/|Kea DHCP Modern, open source DHCPv4 & DHCPv6 server]] | * [[https://www.isc.org/kea/|Kea DHCP Modern, open source DHCPv4 & DHCPv6 server]] | ||
+ | |||
+ | ===== isc-dhcp-server ===== | ||
+ | |||
===== Установка ===== | ===== Установка ===== | ||
Line 37: | Line 40: | ||
option domain-name "corpX.un"; | option domain-name "corpX.un"; | ||
+ | #option domain-search "jet.msk.su","service.jet.msk.su","jetinf.jet.msk.su"; | ||
option domain-name-servers 192.168.X.10; | option domain-name-servers 192.168.X.10; | ||
+ | #option domain-name-servers 192.168.X.12; | ||
Line 68: | Line 73: | ||
#} | #} | ||
- | #### For client config by mac #### | + | #### For ip by mac #### |
- | #host client3 { | + | #host kube1 {hardware ethernet 08:00:27:12:34:51;fixed-address 192.168.X.221;} |
- | # hardware ethernet 00:12:f0:79:3b:51; | + | #host kube2 {hardware ethernet 08:00:27:12:34:52;fixed-address 192.168.X.222;} |
- | # fixed-address 192.168.100+X.200; | + | #host kube3 {hardware ethernet 08:00:27:12:34:53;fixed-address 192.168.X.223;} |
- | #} | + | #host kube4 {hardware ethernet 08:00:27:12:34:54;fixed-address 192.168.X.224;} |
#### Digim D40 #### | #### Digim D40 #### | ||
Line 105: | Line 110: | ||
max-lease-time 7200; | max-lease-time 7200; | ||
} | } | ||
+ | |||
+ | #host node3 {hardware ethernet 08:00:27:12:34:53;fixed-address 192.168.X.3;} | ||
+ | #host node4 {hardware ethernet 08:00:27:12:34:54;fixed-address 192.168.X.4;} | ||
+ | #host node5 {hardware ethernet 08:00:27:12:34:55;fixed-address 192.168.X.5;} | ||
+ | #host node6 {hardware ethernet 08:00:27:12:34:56;fixed-address 192.168.X.6;} | ||
+ | #host node7 {hardware ethernet 08:00:27:12:34:57;fixed-address 192.168.X.7;} | ||
</code> | </code> | ||
Line 186: | Line 197: | ||
===== Мониторинг выданных адресов ===== | ===== Мониторинг выданных адресов ===== | ||
+ | * [[https://stackoverflow.com/questions/2142824/parse-a-dhcpd-lease-file-with-bash|Parse a dhcpd.lease File with Bash]] | ||
==== Debian/Ubuntu ==== | ==== Debian/Ubuntu ==== | ||
<code> | <code> | ||
Line 228: | Line 240: | ||
# dhcpd-pools -l /var/db/dhcpd/dhcpd.leases -c /usr/local/etc/dhcpd.conf | # dhcpd-pools -l /var/db/dhcpd/dhcpd.leases -c /usr/local/etc/dhcpd.conf | ||
+ | </code> | ||
+ | |||
+ | ===== isc-kea ===== | ||
+ | |||
+ | * [[https://ubuntu.com/server/docs/how-to-install-and-configure-isc-kea|How to install and configure isc-kea]] | ||
+ | |||
+ | <code> | ||
+ | gate# apt install kea | ||
+ | |||
+ | gate# cat /etc/kea/kea-dhcp4.conf | ||
+ | </code><code> | ||
+ | { | ||
+ | "Dhcp4": { | ||
+ | "interfaces-config": { | ||
+ | "interfaces": [ "eth2" ], | ||
+ | "dhcp-socket-type": "raw" | ||
+ | }, | ||
+ | |||
+ | "control-socket": { | ||
+ | "socket-type": "unix", | ||
+ | "socket-name": "/run/kea/kea4-ctrl-socket" | ||
+ | }, | ||
+ | |||
+ | "lease-database": { | ||
+ | "type": "memfile", | ||
+ | "lfc-interval": 3600 | ||
+ | }, | ||
+ | |||
+ | "expired-leases-processing": { | ||
+ | "reclaim-timer-wait-time": 10, | ||
+ | "flush-reclaimed-timer-wait-time": 25, | ||
+ | "hold-reclaimed-time": 3600, | ||
+ | "max-reclaim-leases": 100, | ||
+ | "max-reclaim-time": 250, | ||
+ | "unwarned-reclaim-cycles": 5 | ||
+ | }, | ||
+ | |||
+ | "renew-timer": 900, | ||
+ | "rebind-timer": 1800, | ||
+ | "valid-lifetime": 3600, | ||
+ | |||
+ | "option-data": [ | ||
+ | { | ||
+ | "name": "domain-name-servers", | ||
+ | "data": "192.168.X.10" | ||
+ | }, | ||
+ | # not work in windows | ||
+ | { | ||
+ | "name": "domain-search", | ||
+ | "data": "corpX.un,isp.un" | ||
+ | }, | ||
+ | { | ||
+ | "name": "domain-name", | ||
+ | "data": "corpX.un" | ||
+ | } | ||
+ | ], | ||
+ | |||
+ | "subnet4": [ | ||
+ | { | ||
+ | "id": 1, | ||
+ | "subnet": "192.168.100+X.0/24", | ||
+ | "pools": [ { "pool": "192.168.100+X.100 - 192.168.100+X.109" } ], | ||
+ | "option-data": [ | ||
+ | { | ||
+ | "name": "routers", | ||
+ | "data": "192.168.100+X.1" | ||
+ | } | ||
+ | ] | ||
+ | } | ||
+ | ], | ||
+ | "loggers": [ | ||
+ | { | ||
+ | "name": "kea-dhcp4", | ||
+ | "output_options": [ | ||
+ | { | ||
+ | "output": "stdout", | ||
+ | "pattern": "%-5p %m\n" | ||
+ | } | ||
+ | ], | ||
+ | "severity": "INFO", | ||
+ | "debuglevel": 0 | ||
+ | } | ||
+ | ] | ||
+ | } | ||
+ | } | ||
+ | </code><code> | ||
+ | # kea-dhcp4 -t /etc/kea/kea-dhcp4.conf | ||
+ | |||
+ | # service kea-dhcp4-server restart | ||
+ | |||
+ | # service kea-dhcp4-server status | ||
+ | |||
+ | # cat /var/lib/kea/kea-leases4.csv | ||
</code> | </code> | ||