<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ??碼云GVP開源項目 12k star Uniapp+ElementUI 功能強大 支持多語言、二開方便! 廣告
                使用場景: 當我們不想通過端口映射連接到虛擬機(或通過端口映射訪問虛擬機里提供的web服務),此時我們就可以通過Public Networks網絡模型,讓虛擬機自動獲取公司內部DHCP服務器分配的IP地址,(此時虛擬機獲取的IP和公司內部的其他電腦上獲取的IP就在同一網段咯,如果不是,路由也能通),因此在局域網任何一臺電腦上,都可以ssh到虛擬機咯,或訪問虛擬機上提供的服務咯 1)配置:通過DHCP獲取 * 配置Vagrantfile 綁定接口Default Network Interface,通過bridge參數,配置如下 [root@vagrant ubuntu]# vim Vagrantfile config.vm.network "public_network",bridge: "ens33" config.vm.provision "shell",run: "always",inline: "route add default gw 10.2.11.1" ens33: 表示本地物理機能夠連接互聯網的接口(通過在物理機ifconfig查看) 10.2.11.1: 物理機的網關 * 啟動虛擬機 [root@vagrant ubuntu]# vagrant ssh Welcome to Ubuntu 16.04.3 LTS (GNU/Linux 4.4.0-112-generic x86_64) * Documentation: https://help.ubuntu.com * Management: https://landscape.canonical.com * Support: https://ubuntu.com/advantage Get cloud support with Ubuntu Advantage Cloud Guest: http://www.ubuntu.com/business/services/cloud 0 packages can be updated. 0 updates are security updates. Last login: Tue Jan 30 09:44:08 2018 from 10.0.2.2 vagrant@ubuntu-xenial:~$ route -n Kernel IP routing table Destination Gateway Genmask Flags Metric Ref Use Iface 0.0.0.0 10.2.11.1 0.0.0.0 UG 0 0 0 enp0s8 0.0.0.0 10.0.2.2 0.0.0.0 UG 0 0 0 enp0s3 10.0.2.0 0.0.0.0 255.255.255.0 U 0 0 0 enp0s3 10.2.11.0 0.0.0.0 255.255.255.0 U 0 0 0 enp0s8 enp0s8 Link encap:Ethernet HWaddr 08:00:27:0c:12:63 inet addr:10.2.11.198 Bcast:10.2.11.255 Mask:255.255.255.0 inet6 addr: fe80::a00:27ff:fe0c:1263/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:775 errors:0 dropped:0 overruns:0 frame:0 TX packets:42 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:71598 (71.5 KB) TX bytes:4578 (4.5 KB) * 通過其他機器xshell登錄虛擬機 ![](https://box.kancloud.cn/ce5554092bed8f8fa5975747ebfc08fe_581x502.png) ![](https://box.kancloud.cn/31ca35fe6ea625606a208a79c032f261_581x508.png) Connecting to 10.2.11.198:22... Connection established. To escape to local shell, press 'Ctrl+Alt+]'. Welcome to Ubuntu 16.04.3 LTS (GNU/Linux 4.4.0-112-generic x86_64) * Documentation: https://help.ubuntu.com * Management: https://landscape.canonical.com * Support: https://ubuntu.com/advantage Get cloud support with Ubuntu Advantage Cloud Guest: http://www.ubuntu.com/business/services/cloud 0 packages can be updated. 0 updates are security updates. Last login: Tue Jan 30 09:59:52 2018 from 10.0.2.2 vagrant@ubuntu-xenial:~$ 2)當我們需要根據實際的工作環境,配置自己想要的static ip 配置Vagrantfile文件,添加如下 config.vm.network "public_network", auto_config: false ,bridge: "ens33" config.vm.provision "shell",run: "always",inline: "ifconfig eth1 10.2.11.196 netmask 255.255.0.0 up" config.vm.provision "shell",run: "alway",inline: "route add default gw 10.2.11.1" 說明: 1、auto_config:關閉自動配置 2、ifconfig enp0s8 10.2.11.196 netmask 255.255.255.0 up 配置靜態ip(這里的ip不能和公司內部的地址沖突) 3、route add default gw 10.2.11.1 指定網關(添加默認路由) 4、bridge: 綁定接口(物理機哪個接口可以上網) 啟動虛擬機 [root@vagrant ubuntu16.04_xiong]# vagrant ssh Welcome to Ubuntu 16.04.3 LTS (GNU/Linux 4.4.0-112-generic x86_64) * Documentation: https://help.ubuntu.com * Management: https://landscape.canonical.com * Support: https://ubuntu.com/advantage Get cloud support with Ubuntu Advantage Cloud Guest: http://www.ubuntu.com/business/services/cloud 0 packages can be updated. 0 updates are security updates. 查看接口IP地址,發現這個地址就是我們剛剛指定的 vagrant@ubuntu-xenial:~$ ifconfig enp0s3 Link encap:Ethernet HWaddr 02:1f:2a:60:99:e3 inet addr:10.0.2.15 Bcast:10.0.2.255 Mask:255.255.255.0 inet6 addr: fe80::1f:2aff:fe60:99e3/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:858 errors:0 dropped:0 overruns:0 frame:0 TX packets:532 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:283815 (283.8 KB) TX bytes:70154 (70.1 KB) enp0s8 Link encap:Ethernet HWaddr 08:00:27:25:88:28 inet addr:10.2.11.196 Bcast:10.2.255.255 Mask:255.255.0.0 inet6 addr: fe80::a00:27ff:fe25:8828/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:1 errors:0 dropped:0 overruns:0 frame:0 TX packets:8 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:60 (60.0 B) TX bytes:648 (648.0 B) 查看路由 vagrant@ubuntu-xenial:~$ route -n Kernel IP routing table Destination Gateway Genmask Flags Metric Ref Use Iface 0.0.0.0 10.2.11.1 0.0.0.0 UG 0 0 0 enp0s8 0.0.0.0 10.0.2.2 0.0.0.0 UG 0 0 0 enp0s3 10.0.2.0 0.0.0.0 255.255.255.0 U 0 0 0 enp0s3 10.2.0.0 0.0.0.0 255.255.0.0 U 0 0 0 enp0s8
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看