Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I get Hyper V to detect my Ubuntu VM's IP Address

I just installed a new ISO downloaded from Ubuntu.com today, just installed it to a new machine. Networking is working just fine, but the IP address isn't getting picked up by the Hyper-V manager. I am trying to make a base box for vagrant, so I need networking to actually report the IP address.

Console output for ping, ifconfig, and lsmod:

root@trusty-tahr:~# ping -c 4 stackoverflow.com
PING stackoverflow.com (198.252.206.16) 56(84) bytes of data.
64 bytes from stackoverflow.com (198.252.206.16): icmp_seq=1 ttl=54 time=49.3 ms
64 bytes from stackoverflow.com (198.252.206.16): icmp_seq=2 ttl=54 time=50.2 ms
64 bytes from stackoverflow.com (198.252.206.16): icmp_seq=3 ttl=54 time=48.7 ms
64 bytes from stackoverflow.com (198.252.206.16): icmp_seq=4 ttl=54 time=49.8 ms

--- stackoverflow.com ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3005ms
rtt min/avg/max/mdev = 48.726/49.536/50.216/0.623 ms
root@trusty-tahr:~# ifconfig eth0
eth0      Link encap:Ethernet  HWaddr 00:15:5d:01:98:41
          inet addr:192.168.1.186  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::215:5dff:fe01:9841/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:530 errors:0 dropped:0 overruns:0 frame:0
          TX packets:252 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:83564 (83.5 KB)  TX bytes:33034 (33.0 KB)

root@trusty-tahr:~# lsmod
Module                  Size  Used by
joydev                 20480  0
hid_generic            16384  0
iosf_mbi               16384  0
crct10dif_pclmul       16384  0
crc32_pclmul           16384  0
ghash_clmulni_intel    16384  0
aesni_intel           172032  0
aes_x86_64             20480  1 aesni_intel
lrw                    16384  1 aesni_intel
gf128mul               16384  1 lrw
glue_helper            16384  1 aesni_intel
ablk_helper            16384  1 aesni_intel
cryptd                 20480  3 ghash_clmulni_intel,aesni_intel,ablk_helper
serio_raw              16384  0
hid_hyperv             16384  0
hid                   110592  2 hid_hyperv,hid_generic
hyperv_keyboard        16384  0
hv_balloon             24576  0
8250_fintek            16384  0
hyperv_fb              20480  1
i2c_piix4              24576  0
mac_hid                16384  0
lp                     20480  0
parport                45056  1 lp
hv_netvsc              36864  0
hv_utils               20480  0
hv_storvsc             20480  2
psmouse               114688  0
floppy                 77824  0
hv_vmbus               61440  8 hv_balloon,hyperv_keyboard,hv_netvsc,hid_hyperv,hv_utils,hyperv_fb,hv_storvsc
pata_acpi              16384  0
root@trusty-tahr:~#

Networking tab in Hyper-V manager:

Hyper-V Networking tab

This is on Windows 10 Professional

like image 641
John P Bloch Avatar asked Oct 08 '15 22:10

John P Bloch


3 Answers

Ok, I figured this one out.

The tl;dr version:

sudo apt-get install "linux-cloud-tools-$(uname -r)"

Normally you'd install linux-cloud-tools-virtual to get the KVP daemon installed. Unfortunately, the kernel version that ships with Ubuntu 14.04.3 is 3.19.0-25-generic, whereas linux-cloud-tools-virtual installs the cloud tools for 3.13.0-65-generic. So obviously you need to install the cloud tools for your kernel's release version. To do that automatically you need to get your relase version using uname -r, as above.

Hope that helps somebody somewhere along the line.

like image 141
John P Bloch Avatar answered Oct 19 '22 14:10

John P Bloch


seems like for 18.10 the sudo apt install linux-cloud-tools-virtual is what is needed again

like image 44
ondrovic Avatar answered Oct 19 '22 13:10

ondrovic


For my Ubuntu 20.04, I followed this guide for Ubuntu 18.04. I can see from the lsmodoutput from the question, that he doesn't require the first steps, but I wanted to post a more complete guide.

First edit the modules file (using nano) to add additional modules:

    sudo nano /etc/initramfs-tools/modules

and add following lines:

    hv_vmbus
    hv_storvsc
    hv_blkvsc
    hv_netvsc

Now install the virtual tools, update the initramfs modules and reboot:

    sudo apt-get install linux-virtual linux-cloud-tools-virtual linux-tools-virtual
    sudo update-initramfs -u
    sudo reboot
like image 2
Bart Jolling Avatar answered Oct 19 '22 13:10

Bart Jolling