16.04 and 17.04 in Hyper-V does not resolve names on the network

I am using vagrant for the development and recently had to switch from VirtualBox to Hyper-V due to the requirement of developing for docker in windows. I have modified my vagrant files to use hyper-v as provider which require me to switch image from ubuntu/xenial64 to generic/ubuntu1604. I've configured the boxes to use the Hyper-V Switch that is configured as external for networking. When I am getting my VM up it cannot resolve any network names (though it resolves google or any other internet name fine). I thought it might be due to Hyper-V but Knoppix liveDVD with the same settings can resolve local network names fine. I tried 17.04 and having the same issue as in 16.04. What could be tweaked in the network configuration to get that working?

update: Ok. Looks like the issue in /etc/resolv.conf. By adding

nameserver 192.168.1.2 # my local dns

I am able to get to the hosts. However looks like when I reboot the VM this file is getting reset and I need to add local manually. What is the service that is doing such things on Ubuntu?

1

1 Answer

Ok. After little bit more digging I found out that /etc/resolv.conf is maintained by resolvconf service and by editing files under /etc/resolvconf/resolv.conf.d/ I would be able to permanently add information to /etc/resolv.conf

By end of the day I've endup modifying /etc/resolvconf/resolv.conf.d/head by adding my local dns as the 1st entry and restarting networking service.

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like