{"id":2110,"date":"2023-04-02T06:47:57","date_gmt":"2023-04-01T22:47:57","guid":{"rendered":"https:\/\/www.appblog.cn\/?p=2110"},"modified":"2023-04-05T20:46:42","modified_gmt":"2023-04-05T12:46:42","slug":"vmware-openwrt-setting-network","status":"publish","type":"post","link":"https:\/\/www.appblog.cn\/index.php\/2023\/04\/02\/vmware-openwrt-setting-network\/","title":{"rendered":"VMware OpenWrt\u8bbe\u7f6e\u7f51\u7edc"},"content":{"rendered":"<p>\uff081\uff09OpenWrt\u7684\u865a\u62df\u673a\u9009\u62e9NAT\u6a21\u5f0f\uff0c\u6253\u5f00VMware\u7f16\u8f91\u83dc\u5355\u4e2d\u7684<code>\u865a\u62df\u7f51\u7edc\u7f16\u8f91\u5668<\/code>\uff0c\u67e5\u770bNAT\u6a21\u5f0f\u4e0b\u865a\u62df\u7f51\u5361\u7684\u5b50\u7f51\u5730\u5740\uff0c\u5047\u8bbe\u662f<code>192.168.111.0<\/code>\u3002\u542f\u52a8OpenWrt\u865a\u62df\u673a\uff0c\u4fee\u6539<code>\/etc\/config\/network<\/code>\uff0c\u5c06lan\u7f51\u5361\u7684\u5730\u5740\u8bbe\u4e3a<code>192.168.61.xxx<\/code>\u7f51\u6bb5\u7684\u5730\u5740<\/p>\n<p><!-- more --><\/p>\n<pre><code># vim \/etc\/config\/network\n\nconfig interface &#039;loopback&#039;\n    option ifname &#039;lo&#039;\n    option proto &#039;static&#039;\n    option ipaddr &#039;127.0.0.1&#039;\n    option netmask &#039;255.0.0.0&#039;\n\nconfig globals &#039;globals&#039;\n    option ula_prefix &#039;fdee:fb18:75af::\/48&#039;\n\nconfig interface &#039;lan&#039;\n    option type &#039;bridge&#039;\n    option ifname &#039;eth0&#039;\n    option proto &#039;static&#039;\n    option ipaddr &#039;192.168.111.188&#039;\n    option netmask &#039;255.255.255.0&#039;\n    option ip6assign &#039;60&#039;\n\n# \/etc\/inid.d\/network restart    \/\/\u91cd\u542f\u670d\u52a1 <\/code><\/pre>\n<p>\uff082\uff09\u5728<code>\u865a\u62df\u7f51\u7edc\u7f16\u8f91\u5668<\/code>\u5bf9\u8bdd\u6846\u4e2d\uff0c\u9009\u4e2d<code>NAT \u6a21\u5f0f<\/code>\uff0c\u70b9\u51fb<code>NAT \u8bbe\u7f6e<\/code>\uff0c\u67e5\u770b<code>\u7f51\u5173 IP<\/code>\uff0c\u4f8b\u5982<code>192.168.111.2<\/code><\/p>\n<p>\uff083\uff09\u5728openwrt\u4e0a\u6dfb\u52a0\u9ed8\u8ba4\u7f51\u5173<\/p>\n<p>\u4fee\u6539\uff1a<code>\/etc\/rc.local <\/code><br \/>\n\u6dfb\u52a0\uff1a<code>route add default gw (nat gateway ip)<\/code><\/p>\n<pre><code># vim \/etc\/rc.local\n\n# Put your custom commands here that should be executed once\n# the system init finished. By default this file does nothing.\nroute add default gw 192.168.111.2\nexit 0<\/code><\/pre>\n<p>\uff084\uff09Web\u63a7\u5236\u53f0\uff1a<a target=\"_blank\" rel=\"noopener\" href=\"http:\/\/192.168.111.188\">http:\/\/192.168.111.188<\/a><\/p>\n<p>\uff085\uff09\u8bbe\u7f6edns<\/p>\n<p>\u5728Web\u63a7\u5236\u53f0\u4e2d\uff0c\u9009\u62e9<code>Network<\/code> -&gt; <code>DHCP and DNS<\/code> -&gt; <code>DNS forwardings<\/code> \u8f93\u5165 <code>8.8.8.8<\/code> -&gt; <code>Save &amp; Apply<\/code><\/p>\n<p>\uff086\uff09Xshell\u8fde\u63a5<\/p>\n<pre><code>Connecting to 192.168.111.188:22...\nConnection established.\nTo escape to local shell, press &#039;Ctrl+Alt+]&#039;.\n\nBusyBox v1.28.4 () built-in shell (ash)\n\n  _______                     ________        __\n |       |.-----.-----.-----.|  |  |  |.----.|  |_\n |   -   ||  _  |  -__|     ||  |  |  ||   _||   _|\n |_______||   __|_____|__|__||________||__|  |____|\n          |__| W I R E L E S S   F R E E D O M\n -----------------------------------------------------\n OpenWrt 18.06.2, r7676-cddd7b4c77\n -----------------------------------------------------\nroot@OpenWrt:~#<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\uff081\uff09OpenWrt\u7684\u865a\u62df\u673a\u9009\u62e9NAT\u6a21\u5f0f\uff0c\u6253\u5f00VMware\u7f16\u8f91\u83dc\u5355\u4e2d\u7684\u865a\u62df\u7f51\u7edc\u7f16\u8f91\u5668\uff0c\u67e5\u770bNAT\u6a21\u5f0f\u4e0b\u865a\u62df\u7f51 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[97],"tags":[536,535],"class_list":["post-2110","post","type-post","status-publish","format-standard","hentry","category-tools-skills","tag-openwrt","tag-vmware"],"_links":{"self":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts\/2110","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/comments?post=2110"}],"version-history":[{"count":0,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts\/2110\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/media?parent=2110"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/categories?post=2110"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/tags?post=2110"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}