{"id":415,"date":"2012-09-02T07:43:32","date_gmt":"2012-09-02T05:43:32","guid":{"rendered":"http:\/\/bos-info.com\/?p=415"},"modified":"2012-09-05T12:39:24","modified_gmt":"2012-09-05T10:39:24","slug":"failover-dhcp","status":"publish","type":"post","link":"https:\/\/bos-info.com\/?p=415","title":{"rendered":"\u041e\u0442\u043a\u0430\u0437\u043e\u0443\u0441\u0442\u043e\u0439\u0447\u0438\u0432\u044b\u0439 DHCP \u043d\u0430 \u0434\u0432\u0443\u0445 \u043c\u0430\u0448\u0438\u043d\u0430\u0445 FreeBSD \u0441 \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u0438\u0437\u0430\u0446\u0438\u0435\u0439 \u0431\u0430\u0437"},"content":{"rendered":"<p>\u0414\u0430\u0432\u043d\u043e \u0431\u044b\u043b \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u0435\u043d \u0432\u043e\u043f\u0440\u043e\u0441 \u0440\u0435\u0437\u0435\u0440\u0432\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f DHCP-\u0441\u0435\u0440\u0432\u0435\u0440\u0430. \u041f\u043e\u0447\u0438\u0442\u0430\u0432 \u0438\u043d\u0442\u0435\u0440\u043d\u0435\u0442, \u0432\u043d\u0435\u0437\u0430\u043f\u043d\u043e \u043e\u043a\u0430\u0437\u0430\u043b\u043e\u0441\u044c, \u0447\u0442\u043e \u043d\u0435 \u043e\u0434\u043d\u043e\u043c\u0443 \u043c\u043d\u0435 \u043f\u0440\u0438\u0448\u043b\u0430 \u0432 \u0433\u043e\u043b\u043e\u0432\u0443 \u0442\u0430\u043a\u0430\u044f \u043c\u044b\u0441\u043b\u044c. \u0412\u0441\u0435-\u0442\u0430\u043a\u0438 \u0435\u0441\u043b\u0438 DHCP \u0443\u043f\u0430\u0434\u0435\u0442, \u0442\u043e \u043c\u043d\u043e\u0433\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439 \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u043d\u0435\u0434\u043e\u0432\u043e\u043b\u044c\u043d\u044b \ud83d\ude42<br \/>\n<!--more--><br \/>\n\u0418\u0442\u0430\u043a, \u0432\u043d\u0435\u0437\u0430\u043f\u043d\u043e:<a title=\"HOWTO Configure DHCP failover\" href=\"http:\/\/consultancy.edvoncken.net\/index.php\/HOWTO_Configure_DHCP_failoverhttp:\/\/\" target=\"_blank\"><br \/>\n<\/a><\/p>\n<ol>\n<li><a title=\"HOWTO Configure DHCP failover\" href=\"http:\/\/consultancy.edvoncken.net\/index.php\/HOWTO_Configure_DHCP_failoverhttp:\/\/\" target=\"_blank\">HOWTO Configure DHCP failover<\/a><\/li>\n<li><a href=\"http:\/\/metalcandy.ru\/how-to-forge-centos\/221-fail-over-dhcp-cnetos\" target=\"_blank\">http:\/\/metalcandy.ru\/how-to-forge-centos\/221-fail-over-dhcp-cnetos<\/a><\/li>\n<\/ol>\n<p>\u0414\u043e\u043f\u0443\u0441\u0442\u0438\u043c, DHCP \u0443 \u043d\u0430\u0441 \u0443\u0436\u0435 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d, \u043f\u0440\u0438\u0447\u0435\u043c \u043d\u0430 \u0434\u0432\u0443\u0445 \u0441\u0435\u0440\u0432\u0435\u0440\u0430\u0445 192.168.8.10 \u0438 192.168.8.11. \u0412\u0441\u0435 \u044d\u0442\u043e \u043a\u0440\u0443\u0442\u0438\u0442\u0441\u044f \u043d\u0430 \u0441\u0432\u0435\u0436\u0435\u0439 FreeBSD 9.0 RELEASE.<\/p>\n<p>\u041a\u043e\u043d\u0444\u0438\u0433\u0438 \u0432 \u043f\u0440\u0438\u043c\u0435\u0440\u0430\u0445 \u043d\u0435 \u043f\u043e\u043b\u043d\u044b\u0435, \u0442\u0430\u043a \u0447\u0442\u043e \u043f\u043e\u043f\u044b\u0442\u0430\u0435\u043c\u0441\u044f \u0438\u0437\u043e\u0431\u0440\u0430\u0437\u0438\u0442\u044c \u0432\u0441\u044e \u043a\u0430\u0440\u0442\u0438\u043d\u0443.<\/p>\n<p>Configuring \/usr\/local\/etc\/dhcpd.conf on the Primary<\/p>\n<pre> # DHCP Server - Configuration file for Primary\r\n\r\n # Global configuration\r\n# \r\noption domain-name \"me.local\";\r\noption domain-name-servers 192.168.8.9, 192.168.8.8, 192.168.8.10, 192.168.8.11;\r\noption ntp-servers 192.168.8.10, 192.168.8.11;\r\noption log-servers 192.168.8.10;\r\n# 1 day\r\ndefault-lease-time 86400; \r\n# 1 week\r\nmax-lease-time 604800;\r\nauthoritative;\r\nlog-facility local7;\r\nset vendorclass = option vendor-class-identifier;\r\n\r\n # DHCP Failover, Primary\r\n include \"\/usr\/local\/etc\/dhcpd\/dhcpd.conf_primary\";\r\n\r\n # Subnet declaration\r\n include \"\/usr\/local\/etc\/dhcpd\/dhcpd.subnet\";\r\n\r\n # Static IP addresses\r\n include \"\/usr\/local\/etc\/dhcpd\/dhcpd.static\";\r\n\r\n # EOF<\/pre>\n<p><tt>\/usr\/local\/etc\/dhcpd\/dhcpd.conf_primary<\/tt> (\u0440\u0430\u0437\u043d\u044b\u0435 \u0434\u043b\u044f \u043f\u0435\u0440\u0432\u0438\u0447\u043d\u043e\u0433\u043e \u0438 \u0432\u0442\u043e\u0440\u0438\u0447\u043d\u043e\u0433\u043e):<\/p>\n<pre>##########################\r\n # DHCP Failover, Primary #\r\n ##########################\r\n\r\n failover peer \"ls\" {                   # Failover configuration\r\n        primary; # I am the primary\r\n        address 192.168.8.10;               # My IP address\r\n        port 647;\r\n        peer address 192.168.8.11;          # Peer's IP address\r\n        peer port 647;\r\n        max-response-delay 60;\r\n        max-unacked-updates 10;\r\n        mclt 3600;\r\n        split 128; # Leave this at 128, only defined on Primary\r\n        load balance max seconds 3;\r\n }<\/pre>\n<p><tt>\/usr\/local\/etc\/dhcpd\/dhcpd.subnet<\/tt> (\u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u044b\u0435 \u043d\u0430 \u043e\u0431\u043e\u0438\u0445 \u0441\u0435\u0440\u0432\u0435\u0440\u0430\u0445, \u0437\u0430 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435\u043c \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044f, \u0434\u0430\u043b\u0435\u0435 \u043f\u0440\u0438\u043c\u0435\u0440, \u043e\u0431\u044a\u044f\u0432\u043b\u044f\u0435\u043c \u0437\u0434\u0435\u0441\u044c \u0432\u0441\u0435 \u043f\u043e\u0434\u0441\u0435\u0442\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u044b):<\/p>\n<pre>subnet 192.168.6.0 netmask 255.255.255.0 {\r\n interface em0;\r\n   pool {\r\n         failover peer \"ls\";\r\n         range 192.168.6.201 192.168.6.220;\r\n        }\r\n   option routers 192.168.6.254;\r\n}<\/pre>\n<p><tt>\/usr\/local\/etc\/dhcpd\/dhcpd.static<br \/>\n\u042d\u0442\u0438 \u0444\u0430\u0439\u043b\u044b \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u044b\u0435 \u043d\u0430 \u0434\u0432\u0443\u0445 \u0441\u0435\u0440\u0432\u0435\u0440\u0430\u0445, \u0438\u0445 \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c.<\/tt><\/p>\n<pre>host phone07 { hardware ethernet 00:0b:82:14:36:10; fixed-address phone07; }\r\nhost testcomp { hardware ethernet 1c:bd:b9:d8:1c:22; fixed-address testcomp; }<\/pre>\n<p><tt>\u041a\u0430\u043a \u0432\u0438\u0434\u043d\u043e, \u043f\u0440\u0438 \u0437\u0430\u043f\u0440\u043e\u0441\u0435 \u0441 \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u043e\u0433\u043e \u043c\u0430\u043a\u0430 \u0441\u0435\u0440\u0432\u0435\u0440 \u0440\u0435\u0437\u043e\u043b\u0432\u0438\u0442 \u0430\u0439\u043f\u0438\u0448\u043a\u0443 \u043f\u043e \u0438\u043c\u0435\u043d\u0438, \u0438 \u0432\u044b\u0434\u0430\u0435\u0442 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0439 \u0430\u0434\u0440\u0435\u0441. \u041d\u0430 \u043e\u0431\u043e\u0438\u0445 \u0441\u0435\u0440\u0432\u0435\u0440\u0430\u0445 \u043f\u043e\u0434\u043d\u044f\u0442 BIND, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0437\u0430\u0431\u0438\u0440\u0430\u0435\u0442 \u0437\u043e\u043d\u0443 \u0441 \u043f\u0435\u0440\u0432\u0438\u0447\u043d\u043e\u0433\u043e \u0441\u0435\u0440\u0432\u0435\u0440\u0430. \u0412 resolv.conf \u043f\u0440\u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c<\/tt><\/p>\n<pre>domain me.local\r\nsearch me.local me.site.ua\r\nnameserver 127.0.0.1\r\nnameserver 192.168.8.9\r\nnameserver 192.168.8.8\r\nnameserver 192.168.8.11<\/pre>\n<p><tt>\u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u0438\u0449\u0435\u043c \u0432 \u0438\u043c\u0435\u043d\u0430 \u0432 \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u044b\u0445 \u0434\u043e\u043c\u0435\u043d\u0430\u0445, \u0430 \u0435\u0441\u043b\u0438 \u0447\u0442\u043e-\u0442\u043e \u0441\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c \u0441 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u044b\u043c \u0431\u0438\u043d\u0434\u043e\u043c, \u0441\u043f\u0440\u0430\u0448\u0438\u0432\u0430\u0435\u043c \u0443 \u0434\u0440\u0443\u0437\u0435\u0439.<\/tt><\/p>\n<p><tt>\u0422\u0435\u043f\u0435\u0440\u044c \u043f\u0435\u0440\u0435\u0439\u0434\u0435\u043c \u043a\u043e \u0432\u0442\u043e\u0440\u043e\u043c\u0443 \u0441\u0435\u0440\u0432\u0435\u0440\u0443:<\/tt><\/p>\n<p>Configuring \/usr\/local\/etc\/dhcpd.conf on the Secondary<\/p>\n<pre> # DHCP Server - Configuration file for Secondary\r\n # Global configuration\r\n# \r\noption domain-name \"me.local\";\r\noption domain-name-servers 192.168.8.9, 192.168.8.8, 192.168.8.10, 192.168.8.11;\r\noption ntp-servers 192.168.8.10, 192.168.8.11;\r\noption log-servers 192.168.8.10;\r\n# 1 day\r\ndefault-lease-time 86400; \r\n# 1 week\r\nmax-lease-time 604800;\r\nauthoritative;\r\nlog-facility local7;\r\nset vendorclass = option vendor-class-identifier;\r\n\r\n # DHCP Failover, Primary\r\n include \"\/usr\/local\/etc\/dhcpd\/dhcpd.conf_secondary\";\r\n\r\n # Subnet declaration\r\n include \"\/usr\/local\/etc\/dhcpd\/dhcpd.subnet.DONOTEDIT\";\r\n\r\n # Static IP addresses\r\n include \"\/usr\/local\/etc\/dhcpd\/dhcpd.static.DONOTEDIT\";\r\n\r\n # EOF<\/pre>\n<p><tt>\/usr\/local\/etc\/dhcpd\/dhcpd.conf_secondary<\/tt>:<\/p>\n<pre>##########################\r\n # DHCP Failover, Secondary #\r\n ##########################\r\n\r\n failover peer \"ls\" {                   # Failover configuration\r\n        secondary;                           # I am the secondary\r\n        address 192.168.8.11;               # My IP address\r\n        port 647;\r\n        peer address 192.168.8.10;          # Peer's IP address\r\n        peer port 647;\r\n        max-response-delay 60;\r\n        max-unacked-updates 10;\r\n        mclt 3600;\r\n        load balance max seconds 3;\r\n }<\/pre>\n<p>\u041d\u0430 \u0432\u0442\u043e\u0440\u0438\u0447\u043d\u043e\u043c \u0441\u0435\u0440\u0432\u0435\u0440\u0435 \u044f \u043f\u043b\u0430\u043d\u0438\u0440\u0443\u044e \u0432\u044b\u0434\u0430\u0432\u0430\u0442\u044c \u0434\u0440\u0443\u0433\u043e\u0439 \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d \u0434\u043b\u044f \u0434\u0438\u043d\u0430\u043c\u0438\u043a\u0438, \u0430 \u043e\u0441\u043d\u043e\u0432\u043d\u0430\u044f \u0447\u0430\u0441\u0442\u044c \u0445\u043e\u0441\u0442\u043e\u0432 \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u044c \u0430\u0434\u0440\u0435\u0441\u0430 \u0441\u0442\u0430\u0442\u0438\u043a\u043e\u0439 \u043f\u043e \u043c\u0430\u043a\u0430\u043c.\u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u0437\u0430\u0434\u0430\u0447\u0435\u0439 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u0438\u0437\u0430\u0446\u0438\u044f \u0444\u0430\u0439\u043b\u043e\u0432 \/usr\/local\/etc\/dhcpd\/dhcp.static \u043c\u0435\u0436\u0434\u0443 \u0441\u0435\u0440\u0432\u0435\u0440\u0430\u043c\u0438.<\/p>\n<p>\u0427\u0438\u0442\u0430\u0435\u043c:<\/p>\n<blockquote><p>By keeping the sub-configurations in sync across servers (perhaps using <tt>rsync<\/tt>), maintenance is reduced to a minimum.<\/p><\/blockquote>\n<p>\u041d\u0443 \u043a\u0430\u043a \u0432\u0441\u0435\u0433\u0434\u0430, &#8220;\u043b\u0435\u0433\u043a\u043e \u0441\u043e\u043e\u0431\u0440\u0430\u0437\u0438\u0442\u044c, \u043d\u0435\u0442\u0440\u0443\u0434\u043d\u043e \u0434\u043e\u0433\u0430\u0434\u0430\u0442\u044c\u0441\u044f&#8221; \ud83d\ude42<\/p>\n<p>\u041f\u043e\u0441\u0442\u0430\u0432\u0438\u043c \u0437\u0430\u0434\u0430\u0447\u0438:<\/p>\n<ol>\n<li>\u041f\u0440\u0438 \u043f\u0435\u0440\u0435\u0437\u0430\u043f\u0443\u0441\u043a\u0435 \u0434\u0435\u043c\u043e\u043d\u0430 \u043d\u0430 Primary \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0431\u0435\u043a\u0430\u043f \u043a\u043e\u043d\u0444\u0438\u0433\u043e\u0432 .subnets \u0438 .static.<\/li>\n<li>\u041f\u0440\u0438 \u043f\u0435\u0440\u0435\u0437\u0430\u043f\u0443\u0441\u043a\u0435 \u0434\u0435\u043c\u043e\u043d\u0430 \u043d\u0430 Primary \u0441\u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u0442\u044c .subnets \u0438 .static \u0432 .subnets.DONOTEDIT \u0438 .static.DONOTEDIT \u043d\u0430 Secondary.<\/li>\n<li>\u041d\u0430 \u0432\u0441\u044f\u043a\u0438\u0439 \u0441\u043b\u0443\u0447\u0430\u0439 \u043f\u0440\u043e\u0432\u043e\u0434\u0438\u0442\u044c \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044e \u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0438 \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0431\u0435\u043a\u0430\u043f\u043e\u0432 \u043a\u0430\u0436\u0434\u0443\u044e \u043d\u043e\u0447\u044c.<\/li>\n<\/ol>\n<p>\u0418\u0442\u0430\u043a, \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u043d\u0430 \u043e\u0431\u043e\u0438\u0445 \u0441\u0435\u0440\u0432\u0435\u0440\u0430\u0445:<\/p>\n<pre>ls2# adduser\r\nUsername: dhcp-updater<\/pre>\n<p>\u0414\u0430\u0435\u043c \u044d\u0442\u043e\u043c\u0443 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044e \u0434\u043e\u0441\u0442\u0443\u043f \u043d\u0430 \u0437\u0430\u043f\u0438\u0441\u044c \u0444\u0430\u0439\u043b\u043e\u0432 \u043d\u0430 \u0432\u0442\u043e\u0440\u0438\u0447\u043d\u043e\u043c \u0441\u0435\u0440\u0432\u0435\u0440\u0435:<\/p>\n<pre>chown dhcp-updater dhcpd.subnet.DONOTEDIT\r\nchgrp dhcp-updater dhcpd.subnet.DONOTEDIT\r\nchown dhcp-updater dhcpd.static.DONOTEDIT\r\nchgrp dhcp-updater dhcpd.static.DONOTEDIT<\/pre>\n<p>\u0414\u0430\u043b\u044c\u0448\u0435 \u043d\u0443\u0436\u043d\u043e \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043a\u043b\u044e\u0447\u0438 RSA, \u0447\u0442\u043e\u0431\u044b \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043f\u043e \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u0443 SCP \u0431\u0435\u0437 \u0432\u0432\u043e\u0434\u0430 \u043f\u0430\u0440\u043e\u043b\u044f.<\/p>\n<p>\u0414\u0435\u043b\u0430\u0435\u043c \u0442\u0430\u043a \u043d\u0430 \u043f\u0435\u0440\u0432\u0438\u0447\u043d\u043e\u043c:<\/p>\n<pre>su dhcp-updater\r\nssh-keygen -t rsa<\/pre>\n<p>\u041d\u0430\u0436\u0430\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0440\u0430\u0437 Enter, \u043f\u0430\u0440\u043e\u043b\u044c \u043d\u0435 \u0432\u0432\u043e\u0434\u0438\u0442\u044c. \u0412 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u0438\u043c\u0435\u0435\u043c 2 \u0444\u0430\u0439\u043b\u0430 \u0432 \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0435 \/home\/dhcp-updater\/.ssh\/ : id_rsa \u0438 id_rsa.pub. \u042d\u0442\u043e \u043f\u0440\u0438\u0432\u0430\u0442\u043d\u044b\u0439 \u0438 \u043f\u0443\u0431\u043b\u0438\u0447\u043d\u044b\u0439 \u043a\u043b\u044e\u0447\u0438. \u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0443\u0436\u043d\u043e \u0441\u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u0443\u0431\u043b\u0438\u0447\u043d\u044b\u0439 \u043a\u043b\u044e\u0447 \u043d\u0430 \u0432\u0442\u043e\u0440\u0438\u0447\u043d\u044b\u0439 \u0441\u0435\u0440\u0432\u0435\u0440, \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e:<\/p>\n<pre>ls1# scp id_rsa.pub dhcp-updater@192.168.8.11:\/home\/dhcp-updater\/authorized_keys<\/pre>\n<p>\u0412\u0432\u043e\u0434\u0438\u043c \u043f\u0430\u0440\u043e\u043b\u044c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f dhcp-updater \u043d\u0430 \u0432\u0442\u043e\u0440\u0438\u0447\u043d\u043e\u043c \u0441\u0435\u0440\u0432\u0435\u0440\u0435. \u0422\u0435\u043f\u0435\u0440\u044c \u043c\u044b \u0441\u043c\u043e\u0436\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c SCP.<\/p>\n<p>\u0415\u0449\u0435 \u043d\u0430\u043c \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u0441\u044f sudo \u043d\u0430 \u043e\u0431\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0430:<\/p>\n<pre>cd \/usr\/ports\/security\/sudo ; make install clean<\/pre>\n<p>\u0421\u043e\u0437\u0434\u0430\u0435\u043c \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0438 \u0434\u043b\u044f \u0431\u0435\u043a\u0430\u043f\u043e\u0432 \u043d\u0430 \u043e\u0431\u043e\u0438\u0445 \u0441\u0435\u0440\u0432\u0435\u0440\u0430\u0445:<\/p>\n<pre>mkdir \/var\/dhcp-backup\r\nchown dhcp-updater \/var\/dhcp-backup<\/pre>\n<p>\u0421\u043e\u0437\u0434\u0430\u0435\u043c \u0441\u043a\u0440\u0438\u043f\u0442 \u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043d\u0430 \u043f\u0435\u0440\u0432\u0438\u0447\u043d\u043e\u043c \u0441\u0435\u0440\u0432\u0435\u0440\u0435:<\/p>\n<pre>touch \/usr\/local\/bin\/dhcp-sync\r\nchmod 755 \/usr\/local\/bin\/dhcp-sync<\/pre>\n<p>\u0412 \u0441\u043a\u0440\u0438\u043f\u0442\u0435 \u043f\u0438\u0448\u0435\u043c \u0447\u0442\u043e-\u0442\u043e \u043f\u043e\u0434\u043e\u0431\u043d\u043e\u0435:<\/p>\n<pre>#!\/bin\/sh\r\n# \u0413\u0435\u043d\u0440\u0430\u0446\u0438\u044f \u0431\u0435\u043a\u0430\u043f\u043e\u0432\r\ndate=`date -v-1d '+%Y%m%d-%H%M%s'`\r\nmonth=`date '+%m%Y'`\r\nsudo -u dhcp-updater cp -f \/usr\/local\/etc\/dhcpd\/dhcpd.subnet \/var\/dhcp-backup\/dhcpd.subnet.$date\r\nsudo -u dhcp-updater bzip2 -f -k -z \/var\/dhcp-backup\/dhcpd.subnet.$date\r\nsudo -u dhcp-updater tar -r -f \/var\/dhcp-backup\/dhcpd.subnet.$month.tar \/var\/dhcp-backup\/dhcpd.subnet.$date.bz2\r\n\r\nsudo -u dhcp-updater cp -f \/usr\/local\/etc\/dhcpd\/dhcpd.static \/var\/dhcp-backup\/dhcpd.static.$date\r\nsudo -u dhcp-updater bzip2 -f -k -z \/var\/dhcp-backup\/dhcpd.static.$date\r\nsudo -u dhcp-updater tar -r -f \/var\/dhcp-backup\/dhcpd.static.$month.tar \/var\/dhcp-backup\/dhcpd.static.$date.bz2\r\n\r\nsudo -u dhcp-updater scp -q \/var\/dhcp-backup\/dhcpd.subnet.$date.bz2 dhcp-updater@ls2:\/var\/dhcp-backup\r\nsudo -u dhcp-updater ssh ls2 tar -r -f \/var\/dhcp-backup\/dhcpd.subnet.$month.tar \/var\/dhcp-backup\/dhcpd.subnet.$date.bz2\r\n\r\nsudo -u dhcp-updater scp -q \/var\/dhcp-backup\/dhcpd.static.$date.bz2 dhcp-updater@ls2:\/var\/dhcp-backup\r\nsudo -u dhcp-updater ssh ls2 tar -r -f \/var\/dhcp-backup\/dhcpd.static.$month.tar \/var\/dhcp-backup\/dhcpd.static.$date.bz2\r\n\r\nsudo -u dhcp-updater ssh ls2 rm \/var\/dhcp-backup\/dhcpd.subnet.$date.bz2\r\nsudo -u dhcp-updater ssh ls2 rm \/var\/dhcp-backup\/dhcpd.static.$date.bz2\r\n\r\nsudo -u dhcp-updater rm \/var\/dhcp-backup\/dhcpd.subnet.$date\r\nsudo -u dhcp-updater rm \/var\/dhcp-backup\/dhcpd.static.$date\r\nsudo -u dhcp-updater rm \/var\/dhcp-backup\/dhcpd.subnet.$date.bz2\r\nsudo -u dhcp-updater rm \/var\/dhcp-backup\/dhcpd.static.$date.bz2\r\n\r\n# \u0421\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u0438\u0437\u0430\u0446\u0438\u044f \u0438 \u0440\u0435\u0441\u0442\u0430\u0440\u0442 \u0443\u0434\u0430\u043b\u0435\u043d\u043d\u043e\u0433\u043e DHCP\r\nsudo -u dhcp-updater scp -q \/usr\/local\/etc\/dhcpd\/dhcpd.subnet dhcp-updater@ls2:\/usr\/local\/etc\/dhcpd\/dhcpd.subnet.DONOTEDIT\r\nsudo -u dhcp-updater scp -q \/usr\/local\/etc\/dhcpd\/dhcpd.static dhcp-updater@ls2:\/usr\/local\/etc\/dhcpd\/dhcpd.static.DONOTEDIT\r\nsudo -u dhcp-updater ssh ls2 sudo \/usr\/local\/etc\/rc.d\/isc-dhcpd restart<\/pre>\n<p>\u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u043a\u0440\u043e\u043c\u0435 \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u0438\u0437\u0430\u0446\u0438\u0438 \u0441\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u0435\u043c \u043a\u043e\u043d\u0444\u0438\u0433\u0438 \u0432 \u0430\u0440\u0445\u0438\u0432\u044b, \u043d\u0430\u0437\u044b\u0432\u0430\u043d\u0438\u044f \u0444\u0430\u0439\u043b\u043e\u0432 \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u043c \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u0434\u0430\u0442\u044b, \u0447\u0442\u043e\u0431\u044b \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0432 \u043d\u0438\u0445 \u043e\u0440\u0438\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c\u0441\u044f.<\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0442\u044c \u0441\u043a\u0440\u0438\u043f\u0442. \u041b\u043e\u0433\u0438\u0447\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u044d\u0442\u043e \u0434\u0435\u043b\u0430\u0442\u044c \u043f\u0440\u0438 \u043f\u0435\u0440\u0435\u0437\u0430\u043f\u0443\u0441\u043a\u0435 \u0434\u0435\u043c\u043e\u043d\u0430 dhcpd \u043d\u0430 \u043f\u0435\u0440\u0432\u0438\u0447\u043d\u043e\u043c \u0441\u0435\u0440\u0432\u0435\u0440\u0435. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u043c \u0444\u0430\u0439\u043b \/usr\/local\/etc\/rc.d\/isc-dhcpd, \u043d\u0430\u0445\u043e\u0434\u0438\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u044e dhcpd_checkconfig () \u0438 \u043c\u043e\u0434\u0438\u0444\u0438\u0446\u0438\u0440\u0443\u0435\u043c \u0435\u0435 \u0442\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u0447\u0442\u043e\u0431\u044b \u043f\u0440\u0438 \u0443\u0434\u0430\u0447\u043d\u043e\u043c \u043f\u0440\u043e\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u0438 \u0442\u0435\u0441\u0442\u0430 \u043f\u0440\u043e\u0432\u043e\u0434\u0438\u043b\u043e\u0441\u044c \u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438:<\/p>\n<pre>dhcpd_checkconfig ()\r\n{\r\n        local rc_flags_mod\r\n        setup_flags\r\n\trc_flags_mod=\"$rc_flags\"\r\n        # Eliminate '-q' flag if it is present\r\n\tcase \"$rc_flags\" in\r\n\t*-q*)\trc_flags_mod=`echo \"${rc_flags}\" | sed -Ee 's\/(^-q | -q | -q$)\/\/'` ;;\r\n\tesac\r\n        if ! ${command} -t -q ${rc_flags_mod}; \r\n        then\r\n                err 1 \"`${command} -t ${rc_flags_mod}` Configuration file sanity check failed\"\r\n        <em><strong>else sh \/usr\/local\/bin\/dhcp-sync<\/strong><\/em>\r\n        fi\r\n}<\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043e\u0441\u0442\u0430\u043b\u0430\u0441\u044c \u043e\u0434\u043d\u0430 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430: \u0447\u0442\u043e\u0431\u044b \u043f\u0435\u0440\u0435\u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c DHCP \u043d\u0430 \u0443\u0434\u0430\u043b\u0435\u043d\u043d\u043e\u043c \u0441\u0435\u0440\u0432\u0435\u0440\u0435, \u043d\u0443\u0436\u0435\u043d root, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043c\u044b \u0434\u0435\u043b\u0430\u0435\u043c sudo. \u041d\u043e \u0447\u0442\u043e\u0431\u044b sudo \u043d\u0435 \u043f\u0440\u043e\u0441\u0438\u043b \u043f\u0430\u0440\u043e\u043b\u044c \u0440\u0443\u0442\u0430, \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0437\u0430\u043f\u0438\u0441\u044c \u0432 \/usr\/local\/etc\/sudoers:<\/p>\n<pre>dhcp-updater\tALL = NOPASSWD: \/usr\/local\/etc\/rc.d\/isc-dhcpd restart<\/pre>\n<p>\u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u0440\u0430\u0437\u0440\u0435\u0448\u0430\u0435\u043c \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u0434\u0430\u043d\u043d\u0443\u044e \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u044d\u0442\u043e\u043c\u0443 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044e \u0431\u0435\u0437 \u0432\u0432\u043e\u0434\u0430 \u043f\u0430\u0440\u043e\u043b\u044f.<\/p>\n<p>\u041f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0439 \u0448\u0442\u0440\u0438\u0445 &#8211; \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0432 \u043a\u0440\u043e\u043d\u0442\u0430\u0431 \u0437\u0430\u0434\u0430\u043d\u0438\u0435:<\/p>\n<pre>crontab -e\r\n0 0 * * * root \/usr\/local\/etc\/rc.d\/isc-dhcpd restart<\/pre>\n<p>\u0415\u0441\u043b\u0438 \u0432\u0441\u0435 \u0431\u044b\u043b\u043e \u0441\u0434\u0435\u043b\u0430\u043d\u043e \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e, \u0442\u0435\u043f\u0435\u0440\u044c DHCP-\u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u0431\u0443\u0434\u0443\u0442 \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0438 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0432 \u043f\u0430\u0440\u0435. \u0423\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c \u043f\u043e \u0434\u0432\u0430 ip helper address \u0438 \u0440\u0430\u0434\u0443\u0435\u043c\u0441\u044f.<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u0414\u0430\u0432\u043d\u043e \u0431\u044b\u043b \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u0435\u043d \u0432\u043e\u043f\u0440\u043e\u0441 \u0440\u0435\u0437\u0435\u0440\u0432\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f DHCP-\u0441\u0435\u0440\u0432\u0435\u0440\u0430. \u041f\u043e\u0447\u0438\u0442\u0430\u0432 \u0438\u043d\u0442\u0435\u0440\u043d\u0435\u0442, \u0432\u043d\u0435\u0437\u0430\u043f\u043d\u043e \u043e\u043a\u0430\u0437\u0430\u043b\u043e\u0441\u044c, \u0447\u0442\u043e \u043d\u0435 \u043e\u0434\u043d\u043e\u043c\u0443 \u043c\u043d\u0435 \u043f\u0440\u0438\u0448\u043b\u0430 \u0432 \u0433\u043e\u043b\u043e\u0432\u0443 \u0442\u0430\u043a\u0430\u044f \u043c\u044b\u0441\u043b\u044c. \u0412\u0441\u0435-\u0442\u0430\u043a\u0438 \u0435\u0441\u043b\u0438 DHCP \u0443\u043f\u0430\u0434\u0435\u0442, \u0442\u043e \u043c\u043d\u043e\u0433\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439 \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u043d\u0435\u0434\u043e\u0432\u043e\u043b\u044c\u043d\u044b \ud83d\ude42<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[57],"tags":[],"_links":{"self":[{"href":"https:\/\/bos-info.com\/index.php?rest_route=\/wp\/v2\/posts\/415"}],"collection":[{"href":"https:\/\/bos-info.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/bos-info.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/bos-info.com\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/bos-info.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=415"}],"version-history":[{"count":1,"href":"https:\/\/bos-info.com\/index.php?rest_route=\/wp\/v2\/posts\/415\/revisions"}],"predecessor-version":[{"id":416,"href":"https:\/\/bos-info.com\/index.php?rest_route=\/wp\/v2\/posts\/415\/revisions\/416"}],"wp:attachment":[{"href":"https:\/\/bos-info.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=415"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/bos-info.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=415"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/bos-info.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=415"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}