{"id":559,"date":"2024-10-20T17:53:16","date_gmt":"2024-10-20T09:53:16","guid":{"rendered":"http:\/\/blog.naspro.cc\/?p=559"},"modified":"2025-02-19T21:33:17","modified_gmt":"2025-02-19T13:33:17","slug":"%e7%be%a4%e6%99%96%e7%bb%99docker%e5%ae%9d%e5%a1%94%e6%9c%8d%e5%8a%a1%e5%99%a8%e5%ae%b9%e5%99%a8%e6%b7%bb%e5%8a%a0%e7%8b%ac%e7%ab%8bip%e5%9c%b0%e5%9d%80","status":"publish","type":"post","link":"http:\/\/blog.naspro.cc\/?p=559","title":{"rendered":"\u7fa4\u6656\u7ed9Docker\u5b9d\u5854\u670d\u52a1\u5668\u5bb9\u5668\u6dfb\u52a0\u72ec\u7acbIP\u5730\u5740"},"content":{"rendered":"<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_73 counter-flat ez-toc-counter ez-toc-light-blue ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<span class=\"ez-toc-title-toggle\"><a href=\"#\" class=\"ez-toc-pull-right ez-toc-btn ez-toc-btn-xs ez-toc-btn-default ez-toc-toggle\" aria-label=\"Toggle Table of Content\"><span class=\"ez-toc-js-icon-con\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/span><\/a><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"http:\/\/blog.naspro.cc\/?p=559\/#%e6%9f%a5%e7%9c%8b%e7%bd%91%e5%8d%a1%e5%90%8d%e7%a7%b0\" title=\"\u67e5\u770b\u7f51\u5361\u540d\u79f0\">\u67e5\u770b\u7f51\u5361\u540d\u79f0<\/a><\/li><li class='ez-toc-page-1'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"http:\/\/blog.naspro.cc\/?p=559\/#%e5%88%9b%e5%bb%ba%e6%a1%a5%e6%8e%a5%e7%bd%91%e5%8d%a1\" title=\"\u521b\u5efa\u6865\u63a5\u7f51\u5361\">\u521b\u5efa\u6865\u63a5\u7f51\u5361<\/a><\/li><li class='ez-toc-page-1'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"http:\/\/blog.naspro.cc\/?p=559\/#%e5%90%af%e5%8a%a8%e5%ae%b9%e5%99%a8\" title=\"\u542f\u52a8\u5bb9\u5668\">\u542f\u52a8\u5bb9\u5668<\/a><\/li><li class='ez-toc-page-1'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"http:\/\/blog.naspro.cc\/?p=559\/#%e4%bf%ae%e6%94%b9%e5%b7%b2%e7%bb%8f%e8%bf%90%e8%a1%8c%e7%9a%84%e5%ae%b9%e5%99%a8%e7%bd%91%e7%bb%9cip\" title=\"\u4fee\u6539\u5df2\u7ecf\u8fd0\u884c\u7684\u5bb9\u5668\u7f51\u7edcIP\">\u4fee\u6539\u5df2\u7ecf\u8fd0\u884c\u7684\u5bb9\u5668\u7f51\u7edcIP<\/a><\/li><li class='ez-toc-page-1'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"http:\/\/blog.naspro.cc\/?p=559\/#%e4%bf%ae%e6%94%b9%e5%ae%9d%e5%a1%94%e6%9c%8d%e5%8a%a1%e5%99%a8%e7%94%a8%e6%88%b7%e5%90%8d%e5%af%86%e7%a0%81\" title=\"\u4fee\u6539\u5b9d\u5854\u670d\u52a1\u5668\u7528\u6237\u540d\u5bc6\u7801\">\u4fee\u6539\u5b9d\u5854\u670d\u52a1\u5668\u7528\u6237\u540d\u5bc6\u7801<\/a><\/li><li class='ez-toc-page-1'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"http:\/\/blog.naspro.cc\/?p=559\/#%e5%8f%96%e6%b6%88%e6%89%8b%e6%9c%ba%e5%8f%b7%e7%a0%81%e9%aa%8c\" title=\"\u53d6\u6d88\u624b\u673a\u53f7\u7801\u9a8c!\">\u53d6\u6d88\u624b\u673a\u53f7\u7801\u9a8c!<\/a><\/li><\/ul><\/nav><\/div>\n<h2><span class=\"ez-toc-section\" id=\"%e6%9f%a5%e7%9c%8b%e7%bd%91%e5%8d%a1%e5%90%8d%e7%a7%b0\"><\/span>\u67e5\u770b\u7f51\u5361\u540d\u79f0<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>\u901a\u8fc7ssh\u8f6f\u4ef6\u8fde\u5165\u7fa4\u6656\u540e\u53f0<br \/>\n<code>sudo -i<\/code><br \/>\n\u56de\u8f66\u8f93\u5165\u5bc6\u7801 \u5207\u6362root\u6743\u9650<br \/>\n\u8f93\u5165\u547d\u4ee4<br \/>\n<code>ip addr<\/code><br \/>\n\u8fd4\u56de\u7684\u503c\u4e2d\uff0c\u627e\u5230\u5bf9\u5e94\u4f60\u7684\u7fa4\u6656IP\u5730\u5740\u90a3\u6761\uff0c\u4e0a\u9762\u5c31\u662f\u7269\u7406\u7f51\u5361\u540d\u79f0\uff0c\u7f51\u5361\u540d\u79f0\u662fovs_eth0<br \/>\n<img decoding=\"async\" src=\"https:\/\/p.tolan.link:6688\/i\/2024\/10\/20\/qv8jms.png\" alt=\"image\" \/><\/p>\n<h2><span class=\"ez-toc-section\" id=\"%e5%88%9b%e5%bb%ba%e6%a1%a5%e6%8e%a5%e7%bd%91%e5%8d%a1\"><\/span>\u521b\u5efa\u6865\u63a5\u7f51\u5361<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p><img decoding=\"async\" src=\"https:\/\/p.tolan.link:6688\/i\/2024\/10\/20\/quk5l9.png\" alt=\"image\" \/><br \/>\n<code>docker network create -d macvlan --subnet=192.168.31.0\/24 --gateway=192.168.31.1 -o parent=ovs_eth0 bridge-host<\/code><br \/>\n\u547d\u4ee4\u8bf4\u660e\uff1a192.168.31.0\u4e3a\u4f60\u7684\u5185\u7f51\u5730\u5740\u6bb5\uff0c192.168.31.1\u4e3a\u4f60\u7684\u7f51\u5173\u5730\u5740,ovs_eth0\u662f\u4f60\u7684\u7269\u7406\u7f51\u5361\u540d\u79f0<br \/>\n\u521b\u5efa\u597d\u4e4b\u540e\uff0cdocker\u7684\u7f51\u7edc\u91cc\u4f1a\u591a\u51fa\u4e00\u4e2abridge-host\u7f51\u5361<br \/>\n<img decoding=\"async\" src=\"https:\/\/p.tolan.link:6688\/i\/2024\/10\/20\/s4x9q6.png\" alt=\"image\" \/><\/p>\n<h2><span class=\"ez-toc-section\" id=\"%e5%90%af%e5%8a%a8%e5%ae%b9%e5%99%a8\"><\/span>\u542f\u52a8\u5bb9\u5668<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>\u914d\u7f6e\u542f\u52a8docker\u5b9d\u5854\u5bb9\u5668<br \/>\n<img decoding=\"async\" src=\"https:\/\/p.tolan.link:6688\/i\/2024\/10\/20\/stf5fz.png\" alt=\"image\" \/><br \/>\n\u7f51\u5361\u9009\u62e9\u6865\u63a5\u7f51\u5361\uff0c\u6620\u5c04\u7f51\u7ad9\u78c1\u76d8\u76ee\u5f55\uff0c\u5220\u9664\u6240\u6709\u7aef\u53e3\u6620\u5c04<br \/>\n\u914d\u7f6e\u5b8c\u6bd5\u542f\u52a8\u8bbe\u5907<br \/>\n\u6ce8\u610f\uff1a\u53ef\u80fd\u4f1a\u63d0\u793a\u8bbf\u95eeAPI \u5931\u8d25\uff0c\u5173\u95ed\u7a97\u53e3\u76f4\u63a5\u542f\u52a8<br \/>\n<img decoding=\"async\" src=\"https:\/\/p.tolan.link:6688\/i\/2024\/10\/20\/sufcir.png\" alt=\"image\" \/><br \/>\n\u9ed8\u8ba4ip \u4e3a .2  \u4fee\u6539\u9ed8\u8ba4IP<br \/>\n<img decoding=\"async\" src=\"https:\/\/p.tolan.link:6688\/i\/2024\/10\/20\/swfkd4.png\" alt=\"image\" \/><\/p>\n<h2><span class=\"ez-toc-section\" id=\"%e4%bf%ae%e6%94%b9%e5%b7%b2%e7%bb%8f%e8%bf%90%e8%a1%8c%e7%9a%84%e5%ae%b9%e5%99%a8%e7%bd%91%e7%bb%9cip\"><\/span>\u4fee\u6539\u5df2\u7ecf\u8fd0\u884c\u7684\u5bb9\u5668\u7f51\u7edcIP<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>\u67e5\u770b\u6b63\u5728\u8fd0\u884c\u7684\u5bb9\u5668ID<br \/>\n<code>docker ps<\/code><br \/>\n<img decoding=\"async\" src=\"https:\/\/p.tolan.link:6688\/i\/2024\/10\/20\/qhjma0.png\" alt=\"image\" \/><br \/>\n\u8fdb\u5165\u7fa4\u6656SSH\u4fee\u6539\u5bb9\u5668IP<br \/>\n\u5148\u65ad\u5f00\u5bb9\u5668\u4e0e\u539f\u7f51\u7edc\u7684\u8fde\u63a5<\/p>\n<p><code>docker network disconnect [\u539f\u7f51\u7edc\u540d\u79f0] [\u5bb9\u5668\u540d\u79f0\u6216\u5bb9\u5668ID]<\/code><br \/>\n<code>docker network disconnect bridge-host 40fa7cadc44c<\/code><\/p>\n<p>\u8fde\u63a5\u65b0\u7f51\u7edc<br \/>\n<code>docker networkconnect [\u76ee\u6807\u7f51\u7edc\u540d\u79f0] [\u6307\u5b9a\u5bb9\u5668IP] [\u5bb9\u5668\u540d\u79f0\u6216\u5bb9\u5668ID]<\/code><br \/>\n<code>docker network connect bridge-host --ip=192.168.31.111 40fa7cadc44c<\/code><\/p>\n<p><img decoding=\"async\" src=\"https:\/\/p.tolan.link:6688\/i\/2024\/10\/20\/sxnowz.png\" alt=\"image\" \/><\/p>\n<p>\u67e5\u770b\u5bb9\u5668IP<br \/>\n<img decoding=\"async\" src=\"https:\/\/p.tolan.link:6688\/i\/2024\/10\/20\/sy886g.png\" alt=\"image\" \/><\/p>\n<h2><span class=\"ez-toc-section\" id=\"%e4%bf%ae%e6%94%b9%e5%ae%9d%e5%a1%94%e6%9c%8d%e5%8a%a1%e5%99%a8%e7%94%a8%e6%88%b7%e5%90%8d%e5%af%86%e7%a0%81\"><\/span>\u4fee\u6539\u5b9d\u5854\u670d\u52a1\u5668\u7528\u6237\u540d\u5bc6\u7801<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>\u5728docker\u7ec8\u7aef\u673a\u4e2d\u65b0\u5efa\u547d\u4ee4bt\uff0c\u6839\u636e\u63d0\u793a\u4fee\u6539\u8d26\u53f7\u5bc6\u7801<br \/>\n![image](<a href=\"https:\/\/p.tolan.link:6688\/i\/2024\/10\/20\/t2a7re.png\" class=\"fancybox\" data-fancybox=\"images\" data-fancybox-group=\"button\">https:\/\/p.tolan.link:6688\/i\/2024\/10\/20\/t2a7re.png<\/a><\/p>\n<h2><span class=\"ez-toc-section\" id=\"%e5%8f%96%e6%b6%88%e6%89%8b%e6%9c%ba%e5%8f%b7%e7%a0%81%e9%aa%8c\"><\/span>\u53d6\u6d88\u624b\u673a\u53f7\u7801\u9a8c!<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p><img decoding=\"async\" src=\"https:\/\/p.tolan.link:6688\/i\/2024\/10\/20\/tsahhy.png\" alt=\"image\" \/><\/p>\n<p>\u4e00\u952e\u4f18\u5316\u811a\u672c<br \/>\n<code> wget -O optimize.sh http:\/\/f.cccyun.cc\/bt\/optimize.sh &amp;&amp; bash optimize.sh<\/code><br \/>\n<img decoding=\"async\" src=\"https:\/\/p.tolan.link:6688\/i\/2024\/10\/20\/uar39b.png\" alt=\"image\" \/><\/p>\n<p>\u53c2\u8003\u6765\u6e90\uff1a<br \/>\n<a href=\"https:\/\/www.hncloud.com\/supports\/6199.html\">https:\/\/www.hncloud.com\/supports\/6199.html<\/a><br \/>\n<a href=\"https:\/\/www.xiaoten.com\/archives\/Use-Synology-nas-to-build-a-docker-version-of-independent-weekend-ip.html\">https:\/\/www.xiaoten.com\/archives\/Use-Synology-nas-to-build-a-docker-version-of-independent-weekend-ip.html<\/a><br \/>\n<a href=\"https:\/\/registry.hub.docker.com\/r\/pch18\/baota\/\">https:\/\/registry.hub.docker.com\/r\/pch18\/baota\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u67e5\u770b\u7f51\u5361\u540d\u79f0 \u901a\u8fc7ssh\u8f6f\u4ef6\u8fde\u5165\u7fa4\u6656\u540e\u53f0 sudo -i \u56de\u8f66\u8f93\u5165\u5bc6\u7801 \u5207\u6362root\u6743\u9650 \u8f93\u5165\u547d\u4ee4 ip addr \u8fd4\u56de\u7684\u503c\u4e2d\uff0c\u627e\u5230\u5bf9\u5e94\u4f60\u7684\u7fa4\u6656IP\u5730\u5740\u90a3\u6761\uff0c\u4e0a\u9762\u5c31\u662f\u7269\u7406\u7f51\u5361\u540d\u79f0\uff0c\u7f51\u5361\u540d\u79f0\u662fovs_eth0 \u521b\u5efa\u6865\u63a5\u7f51\u5361 docker network create -d macvlan &#8211;subnet=192.168.31.0\/24 &#8211;gateway=192.168.31.1 -o paren [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":590,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3,16],"tags":[],"class_list":["post-559","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-internet","category-16"],"_links":{"self":[{"href":"http:\/\/blog.naspro.cc\/index.php?rest_route=\/wp\/v2\/posts\/559","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/blog.naspro.cc\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/blog.naspro.cc\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/blog.naspro.cc\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/blog.naspro.cc\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=559"}],"version-history":[{"count":1,"href":"http:\/\/blog.naspro.cc\/index.php?rest_route=\/wp\/v2\/posts\/559\/revisions"}],"predecessor-version":[{"id":591,"href":"http:\/\/blog.naspro.cc\/index.php?rest_route=\/wp\/v2\/posts\/559\/revisions\/591"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/blog.naspro.cc\/index.php?rest_route=\/wp\/v2\/media\/590"}],"wp:attachment":[{"href":"http:\/\/blog.naspro.cc\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=559"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/blog.naspro.cc\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=559"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/blog.naspro.cc\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=559"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}