在Hyper-V中安裝和配置Ubuntu網路

來源:互聯網
上載者:User

在Hyper-V中安裝和配置Ubuntu網路 安裝過程 1. 在Hyper-V中為安裝Ubuntu,安裝正常步驟安裝Ubuntu Server 2. 安裝結束後在編輯Ubuntu 中的檔案 #sudo vi /etc/initramfs-tools/modules,在檔案末尾添加配置行: hv_vmbus hv_storvsc hv_blkvsc hv_netvsc 3. 運行update-initramfs,並reboot系統 # update-initramfs –u # reboot 4. Ubunut再次啟動後已經是Hyper-V IC生效(enable)了,可以使用lsmod命令進行驗證: # lsmod | grep hv_vmbus hv_vmbus 50431 4 hv_utils,hv_netvsc,hv_blkvsc,hv_storvsc 5.設定IP、網關、掩碼等。 sudo vi /etc/network/interfaces,添加以下內容: 使用靜態IP(推薦): iface eth0 inet static address 192.168.1.200 netmask 255.255.255.0 gateway 192.168.1.1 auto eth0 使用DHCP: auto eth0 iface eth0 inet dhcp 6.添加DNS: vi /etc/resolv.conf(可能要建立),添加以下內容: # 添加網域名稱伺服器 nameserver 192.168.1.1 /etc/resolv.conf重啟後會重建,之前的修改會丟失,所以 #sudo vi /etc/resolvconf/resolv.conf.d/tail 然後在這個檔案裡添加的DNS,格式與以前的/etc/resolv.conf檔案一致: nameserver 192.168.1.1 然後輸入wq儲存退出,並重啟下resolvconf讓配置生效: #/etc/init.d/resolvconf restart 7.重新啟動網路: #sudo /etc/init.d/networking restart 這步如果報錯, RTNETLINK answers: File exists Failed to bring up ethX 可能需要先執行: #sudo iptables-save  另外還需要注意網路設定,可以在右上方的網路設定中修改,推薦使用靜態IP配置 

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.