{"id":261,"date":"2022-01-19T12:19:44","date_gmt":"2022-01-19T09:19:44","guid":{"rendered":"https:\/\/tech.zeleneew.ru\/?p=261"},"modified":"2022-01-19T12:19:46","modified_gmt":"2022-01-19T09:19:46","slug":"%d0%bf%d1%80%d0%be%d0%b1%d1%80%d0%be%d1%81-%d0%bf%d0%be%d1%80%d1%82%d0%be%d0%b2-%d0%b2-%d0%b2%d0%b8%d1%80%d1%82%d1%83%d0%b0%d0%bb%d1%8c%d0%bd%d1%83%d1%8e-%d0%bc%d0%b0%d1%88%d0%b8%d0%bd%d1%83-kvm","status":"publish","type":"post","link":"https:\/\/tech.zeleneew.ru\/?p=261","title":{"rendered":"\u041f\u0440\u043e\u0431\u0440\u043e\u0441 \u043f\u043e\u0440\u0442\u043e\u0432 \u0432 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u0443\u044e \u043c\u0430\u0448\u0438\u043d\u0443 KVM"},"content":{"rendered":"\n<p>\u0412\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0439 \u0441\u0435\u0442\u0435\u0432\u043e\u0439 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u043e\u0439 \u043c\u0430\u0448\u0438\u043d\u044b \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0432 \u0440\u0435\u0436\u0438\u043c\u0435 NAT (Network Address Translation).<\/p>\n\n\n\n<p>\u0412 \u0440\u0435\u0436\u0438\u043c\u0435 NAT \u043d\u0430 \u0445\u043e\u0441\u0442 \u0441\u0438\u0441\u0442\u0435\u043c\u0435 KVM \u0441\u043e\u0437\u0434\u0430\u0435\u0442\u0441\u044f \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0439 \u0441\u0435\u0442\u0435\u0432\u043e\u0439 \u043a\u043e\u043c\u043c\u0443\u0442\u0430\u0442\u043e\u0440 \u0441 DNS \u0438 DHCP \u0441\u0435\u0440\u0432\u0435\u0440\u043e\u043c (dnsmasq), \u0430 \u0441\u0435\u0442\u0435\u0432\u043e\u0439 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u043e\u0439 \u043c\u0430\u0448\u0438\u043d\u044b \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438. Dnsmasq \u0438 NAT \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442\u0441\u044f Libvirt.<\/p>\n\n\n\n<p>\u041a\u0440\u0430\u0442\u043a\u043e\u0435 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u043e\u0432:<\/p>\n\n\n\n<p><strong>eth0<\/strong> &#8212; \u0444\u0438\u0437\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u0445\u043e\u0441\u0442\u043e\u0432\u043e\u0439 \u043c\u0430\u0448\u0438\u043d\u044b. <\/p>\n\n\n\n<p><strong>virbr0<\/strong> &#8212; \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0439 \u043d\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u0434\u043b\u044f \u0433\u043e\u0441\u0442\u0435\u0432\u043e\u0439 \u043c\u0430\u0448\u0438\u043d\u044b. <\/p>\n\n\n\n<p>\u0414\u043b\u044f \u043f\u0440\u043e \u043f\u0440\u043e\u0431\u0440\u043e\u0441\u0430 \u043d\u0430 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u0443\u044e \u043c\u0430\u0448\u0438\u043d\u0443 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u043f\u043e\u0440\u0442\u0430 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u043d\u0430 \u0445\u043e\u0441\u0442\u043e\u0432\u043e\u0439 \u043c\u0430\u0448\u0438\u043d\u0435: <\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">sudo iptables -t nat -A PREROUTING --dst &lt;host_IP> -p tcp --dport &lt;port_forward> -j DNAT --to-destination &lt;virtual_IP>\n\nsudo iptables -I FORWARD 1 -i eth0 -o virbr0 -d &lt;virtual_IP> -p tcp -m tcp --dport &lt;port_forvard> -j ACCEPT<\/pre>\n\n\n\n<p>\u0433\u0434\u0435:<\/p>\n\n\n\n<p><strong>&lt;host_IP><\/strong> &#8212; IP \u0430\u0434\u0440\u0435\u0441 \u0445\u043e\u0441\u0442\u043e\u0432\u043e\u0439 \u043c\u0430\u0448\u0438\u043d\u044b, \u043f\u0440\u0438 \u043e\u0431\u0440\u0430\u0449\u0435\u043d\u0438\u0438 \u043a \u043a\u043e\u0442\u043e\u0440\u043e\u043c\u0443 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u043f\u0440\u043e\u0431\u0440\u043e\u0441 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u043f\u043e\u0440\u0442\u0430 \u0432 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u0443\u044e \u0441\u0440\u0435\u0434\u0443<\/p>\n\n\n\n<p><strong>&lt;virtual_IP><\/strong> &#8212; IP \u0430\u0434\u0440\u0435\u0441 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u043d\u043e\u0439 \u043c\u0430\u0448\u044b\u043d\u044b, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u043f\u0440\u043e\u0431\u0440\u043e\u0441 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u043d\u0430 \u0442\u0440\u0435\u0431\u0443\u0435\u043c\u044b\u0439 \u043f\u043e\u0440\u0442<\/p>\n\n\n\n<p><strong>&lt;port_forward><\/strong> &#8212; \u043d\u043e\u043c\u0435\u0440 \u043f\u0435\u0440\u0435\u0431\u0440\u0430\u0441\u044b\u0432\u0430\u0435\u043c\u043e\u0433\u043e \u043f\u043e\u0440\u0442\u0430.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u0412\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0439 \u0441\u0435\u0442\u0435\u0432\u043e\u0439 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u043e\u0439 \u043c\u0430\u0448\u0438\u043d\u044b \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0432 \u0440\u0435\u0436\u0438\u043c\u0435 NAT (Network Address Translation). \u0412 \u0440\u0435\u0436\u0438\u043c\u0435 NAT \u043d\u0430 \u0445\u043e\u0441\u0442 \u0441\u0438\u0441\u0442\u0435\u043c\u0435 KVM \u0441\u043e\u0437\u0434\u0430\u0435\u0442\u0441\u044f \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0439 \u0441\u0435\u0442\u0435\u0432\u043e\u0439 \u043a\u043e\u043c\u043c\u0443\u0442\u0430\u0442\u043e\u0440 \u0441 DNS \u0438 DHCP \u0441\u0435\u0440\u0432\u0435\u0440\u043e\u043c (dnsmasq), \u0430 \u0441\u0435\u0442\u0435\u0432\u043e\u0439 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u043e\u0439 \u043c\u0430\u0448\u0438\u043d\u044b \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438. Dnsmasq &hellip; <a href=\"https:\/\/tech.zeleneew.ru\/?p=261\">\u0427\u0438\u0442\u0430\u0442\u044c \u0434\u0430\u043b\u0435\u0435 <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[30,8],"tags":[],"class_list":["post-261","post","type-post","status-publish","format-standard","hentry","category-opensuse","category-8"],"_links":{"self":[{"href":"https:\/\/tech.zeleneew.ru\/index.php?rest_route=\/wp\/v2\/posts\/261","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/tech.zeleneew.ru\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/tech.zeleneew.ru\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/tech.zeleneew.ru\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/tech.zeleneew.ru\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=261"}],"version-history":[{"count":1,"href":"https:\/\/tech.zeleneew.ru\/index.php?rest_route=\/wp\/v2\/posts\/261\/revisions"}],"predecessor-version":[{"id":262,"href":"https:\/\/tech.zeleneew.ru\/index.php?rest_route=\/wp\/v2\/posts\/261\/revisions\/262"}],"wp:attachment":[{"href":"https:\/\/tech.zeleneew.ru\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=261"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/tech.zeleneew.ru\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=261"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/tech.zeleneew.ru\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=261"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}