LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Virtualization and Cloud
User Name
Password
Linux - Virtualization and Cloud This forum is for the discussion of all topics relating to Linux Virtualization and Linux Cloud platforms. Xen, KVM, OpenVZ, VirtualBox, VMware, Linux-VServer and all other Linux Virtualization platforms are welcome. OpenStack, CloudStack, ownCloud, Cloud Foundry, Eucalyptus, Nimbus, OpenNebula and all other Linux Cloud platforms are welcome. Note that questions relating solely to non-Linux OS's should be asked in the General forum.

Notices


Reply
  Search this Thread
Old 03-10-2021, 06:46 AM   #1
Alan2103
LQ Newbie
 
Registered: Mar 2021
Posts: 2

Rep: Reputation: Disabled
KVM - Guest VM has no network connectivity


Hi All,

I am trying to get a Debian 10 VM up and running in the KVM-Host (running on Ubuntu Server 20.04.2 LTS)

I believe I have all the necessary packages installed on the KVM-Host machine:

Code:
KVM-Host$ sudo apt install --dry-run bridge-utils qemu-kvm libvirt-daemon-system

Reading package lists... Done
Building dependency tree       
Reading state information... Done

bridge-utils is already the newest version (1.6-2ubuntu1).
libvirt-daemon-system is already the newest version (6.0.0-0ubuntu8.7).
qemu-kvm is already the newest version (1:4.2-3ubuntu6.14).

0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
For the avoidance of doubt, there is no WiFi involved at any point, only ethernet NICs - the KVM-Host machine, my desktop, and the router (that is running DHCP service and is the default gateway) are all connected to a switch via ethernet cable.

I created a network bridge:

Code:
KVM-Host$ virsh iface-list

 Name   State    MAC Address
------------------------------------
 br0    active   de:c3:29:25:ea:2f
 eno1   active   de:c3:29:25:ea:2f
 eno2   active   de:c3:29:25:ea:2f
Code:
KVM-Host$ brctl show

bridge name    bridge id        STP enabled    interfaces
br0        8000.dec32925ea2f    no        bond0
                            vnet0
I note that both the VM Guest's 'vnet0' interface and the KVM-Host's 'bond0' interface are connected to the br0 bridge - I am inferring that this means that they should be talking to each other?


Code:
KVM-Host$ ip route

default via 172.25.25.254 dev br0 proto static 
172.25.25.0/24 dev br0 proto kernel scope link src 172.25.25.3
Code:
KVM-Host$ ip address show

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: eno1: <BROADCAST,MULTICAST,SLAVE,UP,LOWER_UP> mtu 1500 qdisc mq master bond0 state UP group default qlen 1000
    link/ether de:c3:29:25:ea:2f brd ff:ff:ff:ff:ff:ff
3: eno2: <BROADCAST,MULTICAST,SLAVE,UP,LOWER_UP> mtu 1500 qdisc mq master bond0 state UP group default qlen 1000
    link/ether de:c3:29:25:ea:2f brd ff:ff:ff:ff:ff:ff
4: bond0: <BROADCAST,MULTICAST,MASTER,UP,LOWER_UP> mtu 1500 qdisc noqueue master br0 state UP group default qlen 1000
    link/ether de:c3:29:25:ea:2f brd ff:ff:ff:ff:ff:ff
5: br0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
    link/ether de:c3:29:25:ea:2f brd ff:ff:ff:ff:ff:ff
    inet 172.25.25.3/24 brd 172.25.25.255 scope global br0
       valid_lft forever preferred_lft forever
    inet6 fe80::f0f3:b3ff:fe26:2cc9/64 scope link 
       valid_lft forever preferred_lft forever
11: vnet0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel master br0 state UNKNOWN group default qlen 1000
    link/ether fe:54:00:1b:f4:e1 brd ff:ff:ff:ff:ff:ff
    inet6 fe80::fc54:ff:fe1b:f4e1/64 scope link 
       valid_lft forever preferred_lft forever
I note that 'vnet0' is in an 'UNKNOWN' state - not sure if that is the issue, and if so, what I do to address it?


Code:
KVM-Host$ virsh net-dumpxml host-bridge

<network>
  <name>host-bridge</name>
  <uuid>a07efbb0-aa83-435e-a4ad-93b2303cad21</uuid>
  <forward mode='bridge'/>
  <bridge name='br0'/>
</network>
This is the network interface section from the VMGuest machine description in /etc/libvirt/qemu/Debian10-Test.xml (I have tried changing the model type from 'virtio' to 'e1000', and 'rtl8139' (all options) - none make any difference.

Code:
<interface type='bridge'>
      <mac address='52:54:00:1b:f4:e1'/>
      <source bridge='br0'/>
      <model type='e1000'/>
      <address type='pci' domain='0x0000' bus='0x09' slot='0x01' function='0x0'/>
    </interface>


Code:
KVM-Host$ brctl showmacs br0

port no    mac addr        is local?    ageing timer
  1    00:15:62:20:14:41    no           1.46
  1    00:21:70:4d:ad:4f    no           0.00
  1    00:80:0f:b0:3f:1e    no          72.52
  1    00:d9:d1:f5:e9:b0    no           8.98
  1    28:80:23:12:e9:16    no           9.85
  1    34:31:c4:2f:ac:09    no           0.04
  1    52:54:00:1b:f4:e1    no           0.04
  1    6c:ad:f8:fd:9b:55    no          30.68
  1    84:2b:2b:a1:b2:1a    no           9.34
  1    84:2b:2b:a3:5b:42    no          75.13
  1    90:f6:52:f8:af:98    no           9.44
  1    a8:13:74:72:d4:69    no         129.83
  1    d4:53:83:b3:96:0f    no           5.64
  1    de:c3:29:25:ea:2f    yes           0.00
  1    de:c3:29:25:ea:2f    yes           0.00
  1    e8:2a:44:c1:ce:b3    no         208.79
  2    fe:54:00:1b:f4:e1    yes           0.00
  2    fe:54:00:1b:f4:e1    yes           0.00
The MAC listed above as '52:54:00:1b:f4:e1' is the same as you see in Virt-Manager - Debian10-Test - Info Screen - NIC - MAC Address

Not sure if required, but IPv4 forwarding is enabled:

Code:
KVM-Host$ cat /proc/sys/net/ipv4/ip_forward

1

I have created the VM using this command:

Code:
virt-install --name Debian10-Test --description "Debian10-Test" --virt-type kvm --memory 2048 --vcpus 2 --hvm --cpu host --cdrom /media/D_Data/VM/Media/debian-10.8.0-amd64-netinst.iso --disk path=/media/D_Data/VM/KVM/Debian10-Test.qcow2,bus=virtio,size=20,format=qcow2 --noautoconsole --graphics spice --network bridge:br0 --os-variant debian10

The VM appears to be created fine, and I can connect to it from my desktop (Ubuntu Desktop 18.04 LTS) using Virt-Manager.

When I run the VM, it boots up into the Debian 10 install as it would if I did it on bare metal, but when it gets to the DHCP configuration, the VM shows:

Quote:
Network autoconfiguration failed
Your network is probably not using the DHCP protocol. Alternatively the DHCP server may
be slow or some network hardware is not working properly
,

I have disabled the KVM-Host firewall to see if that helps, but it made no difference:

Code:
KVM-Host$ sudo ufw status

Status: inactive

There is no issue with DHCP elsewhere in the LAN, and I can communicate between the KVM Server and my Desktop no problem, so there is no general network issue that I can see (other than, possibly, the 'vnet0' item mentioned above).

If I try entering the network config manually (I used 172.25.25.102/24 which is guaranteed not being used, and confirmed via my router), it gets to a 'page' saying:

Quote:
Detecting link on ens1
then asks for a hostname and other config.

that appears to work fine, and it installs. I can login, but it is not actually connected - I cannot ping in or out, ssh into it etc.


Any suggestions are welcome.

Thanks,

Alan.
 
Old 03-11-2021, 01:27 AM   #2
berndbausch
LQ Addict
 
Registered: Nov 2013
Location: Tokyo
Distribution: Mostly Ubuntu and Centos
Posts: 6,316

Rep: Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002
I'd like to see virsh domiflist VMNAME on the host, and ip address on the VM. Since you have no network connectivity to the VM, you could configure a serial console (kernel parameter console=ttyS0) and use virsh console. That would allow you to copy-paste text.

I have to admit I don't understand what "page" you are talking about, and where you enter network config manually. Can you elaborate? On Debian, I would use /etc/network/interfaces to configure network parameters.

To understand what happens with DHCP, you could trace packets on the host:
Code:
tcpdump -i br0 port 67 or port 68

Last edited by berndbausch; 03-11-2021 at 01:30 AM.
 
Old 03-11-2021, 03:52 AM   #3
Alan2103
LQ Newbie
 
Registered: Mar 2021
Posts: 2

Original Poster
Rep: Reputation: Disabled
Hi berndbausch,

Quote:
Originally Posted by berndbausch View Post

I'd like to see virsh domiflist VMNAME on the host
This is what I get:

Code:
KVM-Host$ virsh domiflist Debian10-Test

 Interface   Type     Source   Model     MAC
------------------------------------------------------------
 -           bridge   br0      rtl8139   52:54:00:1b:f4:e1
Would you expect the 'interface' to be blank?



Quote:
Originally Posted by berndbausch View Post

I'd like to see ... ip address on the VM.
I took a snapshot of the VM, but then decided to give it another go from booting the VM and installing Debian again, so I will need to snapshot that one, restore the first snapshot, and run ip address - I will post back with that.

Quote:
Originally Posted by berndbausch View Post

Since you have no network connectivity to the VM, you could configure a serial console (kernel parameter console=ttyS0) and use virsh console. That would allow you to copy-paste text.
I have wondered about that console=ttyS0 and whether it does what you have described. Can I somehow add that 'kernel parameter' to my existing VM, or do I need to recreate the VM using the virt-install command as above, but with that additional parameter included?

I am guessing it is possible to add it to the existing VM config so I will research that - might be trivial (hopefully!)


Quote:
Originally Posted by berndbausch View Post

I have to admit I don't understand what "page" you are talking about, and where you enter network config manually. Can you elaborate? On Debian, I would use /etc/network/interfaces to configure network parameters.
Sorry - I mean the 'screens' that you get as you go through the install of Debian from ISO (or CD or USB). One of the early ones is about network configuration, and the default option is to try using DHCP, but you can also choose to enter the network settings manually. This is all before you even get to login to Debian for the first time (and hence before you could view or edit /etc/network/interfaces). Hope that makes sense?


Quote:
Originally Posted by berndbausch View Post

To understand what happens with DHCP, you could trace packets on the host:

Code:
tcpdump -i br0 port 67 or port 68
I guess I would need to start a new VM setup from scratch with tcpdump running already? I could do that either with two login sessions on the KVM-Host, or I could run it from an SSH session, and create the new VM from virt-manager - either would show all the network activity on the VM? If I cannot add the console=ttyS0 parameter to the existing VM as above, then I will do both at the same time and post back.


Thank you so much for joining me on this - I really appreciate the company :-)

Alan.
 
Old 03-11-2021, 06:05 AM   #4
berndbausch
LQ Addict
 
Registered: Nov 2013
Location: Tokyo
Distribution: Mostly Ubuntu and Centos
Posts: 6,316

Rep: Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002
Quote:
Originally Posted by Alan2103 View Post

Code:
KVM-Host$ virsh domiflist Debian10-Test

 Interface   Type     Source   Model     MAC
------------------------------------------------------------
 -           bridge   br0      rtl8139   52:54:00:1b:f4:e1
Would you expect the 'interface' to be blank?
You also get a blank stare from me. That's kind of unexpected. No need to do all the other suggestions; this needs fixing first. You normally have a vnetX in the first column, X being a number. That's a virtual NIC.
Quote:
I have wondered about that console=ttyS0 and whether it does what you have described. Can I somehow add that 'kernel parameter' to my existing VM, or do I need to recreate the VM using the virt-install command as above, but with that additional parameter included?

I am guessing it is possible to add it to the existing VM config so I will research that - might be trivial (hopefully!)
On a running computer, you add console=ttyS0 to the kernel parameters in /etc/default/grub and reconfigure Grub. Not hard. No need here, since your vnet is missing, and if I understand you correctly, your VM is not even installed yet.

Yes I understand what you mean by "page".
Quote:
I guess I would need to start a new VM setup from scratch with tcpdump running already?
Yes but no need right now.

My guess is that something trivial is missing in your virt-install command and therefore the XML file. I will simp,y compare that with VMs I created in the past, but it's evening here and I won't come with a fast solution.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] No network connectivity in KVM/Qemu guest pressman57 Linux - Software 2 10-30-2016 07:14 PM
Kernel-based Virtual Machine (KVM): Switching from KVM guest to host (e.g. Linux Mint) & maximize guest screen fanoflq Linux - Newbie 2 07-13-2016 06:10 PM
Guest to Host message passing - guest's memory usage statistics & guest's IP address Prince_Pangeni Linux - Virtualization and Cloud 2 03-03-2012 03:06 AM
KVM on Redhat 5.7: KVM can ping outside network, outside network can't ping KVM svandyk Linux - Networking 1 09-23-2011 06:45 AM
KVM: Mouse under Windows Guest performs way better than under Centos Guest martdj Linux - Virtualization and Cloud 3 03-29-2010 04:20 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Virtualization and Cloud

All times are GMT -5. The time now is 01:04 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration