With the recent study of Docker, a virtual machine was needed to install Ubuntu 16.04 to Hyper-V and deploy Docker. This process filled up a few small pits, in order to meet similar situation in the future to save time, I will be the problems of these small pits and solutions to share, for your reference.
When using a Wi-Fi connection, a virtual switch created with Hyper-V establishes a bridge to connect to the WLAN network as a new virtual switch
Now look at the network configuration as shown, the system creates a network bridge, and then the virtual machine creates the virtual Nic Vethernet through the bridge to the external network
Because the virtual machine's virtual network card is connected through this bridge, so network protocol also need bridge support, very funny is, the IPV4 protocol is closed here by default. If you want the virtual machine to be able to obtain an address, you must manually enable the IPV4 protocol and configure the IP address (which can be obtained automatically) and DNS:
Need to manually tick Tcp/ipv4
The Unbuntu16.4 version of the network configuration needs to be filled in manually:
DNS and network card IP, Gateway, mask
#如果配置动态获取ip, add the following to the above file:
Auto Eth0iface eth0 inet DHCP
#如果配置静态ip, add the following:
Auto eth0iface eth0 inet staticaddress 192.168.1.21netmask 255.255.255.0gateway 192.168.1.1
#要是配置生效, you need to restart the network card:
Ifconfig eth0 downifconfig eth0 up
You must then manually configure DNS:
Modify the following file, the default file is empty
sudo vim/etc/resolvconf/resolv.conf.d/base
Join the DNS server you want to add,
NameServer 8.8.8.8
Then run the following command to make the DNS configuration effective
Sudo/sbin/resolvconf-u
Can not directly modify the /etc/resolv.conf, because the reboot after the direct modification of the configuration will not be.
This allows you to restart the virtual machine and finally connect to the network:
Use the Ifconfig command to look at the NIC configuration and look normal. :)
To install the Ubuntu16.04 Server network configuration by using Hyper-V