User Tools

Site Tools


сервис_dhcp

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
сервис_dhcp [2021/07/21 13:12]
admin [Стандартная конфигурация]
сервис_dhcp [2024/04/23 15:35] (current)
val [isc-kea]
Line 3: Line 3:
   * [[https://​ru.wikipedia.org/​wiki/​DHCP|Dynamic Host Configuration Protocol]]   * [[https://​ru.wikipedia.org/​wiki/​DHCP|Dynamic Host Configuration Protocol]]
   * [[https://​www.isc.org/​|Internet Systems Consortium, Inc. Mission-driven non-profit since 1994]]   * [[https://​www.isc.org/​|Internet Systems Consortium, Inc. Mission-driven non-profit since 1994]]
 +
 +  * [[https://​www.vultr.com/​docs/​stop-dhcp-from-changing-resolve-conf/​|Stop DHCP From Changing resolv.conf]]
 +
 +  * [[https://​www.isc.org/​kea/​|Kea DHCP Modern, open source DHCPv4 & DHCPv6 server]]
 +
 +===== isc-dhcp-server =====
  
 ===== Установка ===== ===== Установка =====
Line 13: Line 19:
 </​code><​code>​ </​code><​code>​
 INTERFACESv4="​eth0"​ INTERFACESv4="​eth0"​
 +#​INTERFACESv4="​vlan2"​
 +#​INTERFACESv4="​eth0 eth2"
 </​code>​ </​code>​
  
Line 33: Line 41:
 option domain-name "​corpX.un";​ option domain-name "​corpX.un";​
 option domain-name-servers 192.168.X.10;​ option domain-name-servers 192.168.X.10;​
 +#option domain-name-servers 192.168.X.12;​
 +
 +
 +#### For phone provisioning ####
 +#option file-server-name code 66 = string; # RFC 2132
 +#option file-server-address code 150 = ip-address; # RFC 5859 (Cisco)
 +#option file-server-name "​server.corpX.un";​
 +#option file-server-address 192.168.X.10;​
  
 #### For PXE #### #### For PXE ####
Line 39: Line 55:
 #​next-server 192.168.X.10;​ #​next-server 192.168.X.10;​
 #filename "​pxelinux.0";​ #filename "​pxelinux.0";​
- 
-#### For provisioning #### 
-#option file-server-name code 66 = string; # RFC 2132 
-#option file-server-address code 150 = ip-address; # RFC 5859 
-#option file-server-name "​server.corpX.un";​ 
-#option file-server-address 192.168.X.10;​ 
   ​   ​
 shared-network LAN1 { shared-network LAN1 {
   subnet 192.168.X.0 netmask 255.255.255.0 {   subnet 192.168.X.0 netmask 255.255.255.0 {
-    range 192.168.X.101 192.168.X.199;+    range 192.168.X.101 192.168.X.109;
     option routers 192.168.X.1;​     option routers 192.168.X.1;​
   }   }
 } }
 +
 +#​shared-network LAN2 {
 +#  subnet 192.168.113.0 netmask 255.255.255.0 {
 +#    range 192.168.113.101 192.168.113.109;​
 +#    option routers 192.168.113.1;​
 +#    next-server 192.168.X.10;​
 +#    filename "​pxe_lan2/​pxelinux.0";​
 +#  }
 +#}
 +
 +#### For ip by mac ####
 +#host kube1 {hardware ethernet 08:​00:​27:​12:​34:​51;​fixed-address 192.168.X.221;​}
 +#host kube2 {hardware ethernet 08:​00:​27:​12:​34:​52;​fixed-address 192.168.X.222;​}
 +#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 57: Line 82:
 #  hardware ethernet 00:​0f:​d3:​06:​11:​d3; ​ #  hardware ethernet 00:​0f:​d3:​06:​11:​d3; ​
 #  option file-server-name "​http://​server.corpX.un/";​ #  option file-server-name "​http://​server.corpX.un/";​
-#} 
- 
-#### For client config by mac #### 
-#host client3 { 
-#  hardware ethernet 00:​12:​f0:​79:​3b:​51;​ 
-#  fixed-address 192.168.100+X.200;​ 
 #} #}
 </​code>​ </​code>​
Line 69: Line 88:
  
   * !!! Синхронизируем время в системах !!! [[Сервис NTP]]   * !!! Синхронизируем время в системах !!! [[Сервис NTP]]
-  * [[http://www.lithodyne.net/docs/dhcp/dhcp.html|DHCP Failover/load balancing]]+  ​* man dhcpd.conf (DHCP FAILOVER) 
 +  ​* [[https://stevendiver.com/2020/02/21/isc-dhcp-failover-configuration/​|ISC DHCP Failover ​Configuration]]
  
 <​code>​ <​code>​
Line 174: Line 194:
 root@gate:​~#​ dhcp-lease-list root@gate:​~#​ dhcp-lease-list
  
-root@gate:​~# ​tail -f /​var/​lib/​dhcp/​dhcpd.leases+root@gate:​~# ​less /​var/​lib/​dhcp/​dhcpd.leases 
 + 
 +root@gate:​~#​ grep dhcp /​var/​log/​syslog
 </​code>​ </​code>​
  
 ===== Статистика DHCP сервера ===== ===== Статистика DHCP сервера =====
  
-[[http://​sourceforge.net/​projects/​dhcpd-pools/​files/​]]+  * [[http://​sourceforge.net/​projects/​dhcpd-pools/​files/​]]
  
 ==== Debian/​Ubuntu ==== ==== Debian/​Ubuntu ====
 <​code>​ <​code>​
 # apt install dhcpd-pools # apt install dhcpd-pools
 +
 +# dhcpd-pools
  
 # dhcpd-pools -l /​var/​lib/​dhcp/​dhcpd.leases -c /​etc/​dhcp/​dhcpd.conf # dhcpd-pools -l /​var/​lib/​dhcp/​dhcpd.leases -c /​etc/​dhcp/​dhcpd.conf
Line 208: Line 232:
  
 # 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"​ ]
 +    },
 +
 +    "​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.13.10"​
 +        },
 +
 +        {
 +            "​name":​ "​domain-search",​
 +            "​data":​ "​corp13.un"​
 +        },
 +
 +    ],
 +
 +    "​subnet4":​ [
 +        {
 +            "​subnet":​ "​192.168.113.0/​24",​
 +            "​pools":​ [ { "​pool":​ "​192.168.113.100 - 192.168.113.109"​ } ],
 +            "​option-data":​ [
 +                {
 +                    "​name":​ "​routers",​
 +                    "​data":​ "​192.168.113.1"​
 +                }
 +            ],
 +        }
 +    ],
 +    "​loggers":​ [
 +    {
 +        "​name":​ "​kea-dhcp4",​
 +        "​output_options":​ [
 +            {
 +                "​output":​ "​stdout",​
 +                "​pattern":​ "%-5p %m\n",
 +            }
 +        ],
 +        "​severity":​ "​INFO",​
 +        "​debuglevel":​ 0
 +    }
 +  ]
 +}
 +}
 +</​code><​code>​
 +# service kea-dhcp4-server restart
 +
 +# service kea-dhcp4-server status
 </​code>​ </​code>​
  
сервис_dhcp.1626862348.txt.gz · Last modified: 2021/07/21 13:12 by admin