zoukankan      html  css  js  c++  java
  • 在Hyper-V中安装和配置Ubuntu网络

    http://www.abcde.cn/knowledgebase/845/Hyper-VUbuntu.html

    (文中的nameserver要改成自己路由器的IP:我的是192.168.2.1。)

    安装过程
     
    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.2.200
     
    netmask 255.255.255.0
     
    gateway 192.168.2.1
     
    auto eth0
     
    使用DHCP:
     
    auto eth0
     
    iface eth0 inet dhcp
     
    6.添加DNS:
     
    vi /etc/resolv.conf(可能要新建),添加以下内容:
     
    # 添加域名服务器
     
    nameserver 192.168.2.1
     
    /etc/resolv.conf重启后会重新生成,之前的修改会丢失,所以
     
    #sudo vi /etc/resolvconf/resolv.conf.d/tail
     
    然后在这个文件里添加的DNS,格式与以前的/etc/resolv.conf文件一致:
     
    nameserver 192.168.2.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配置
  • 相关阅读:
    Enables DNS lookups on client IP addresses 域名的分层结构
    移除 URL 中的 index.php
    Design and Architectural Goals
    The Model represents your data structures.
    If a cache file exists, it is sent directly to the browser, bypassing the normal system execution.
    UNION WHERE
    cookie less
    http 2
    UNION DISTINCT
    联合约束 CONCAT()
  • 原文地址:https://www.cnblogs.com/hurner/p/3558454.html
Copyright © 2011-2022 走看看