1

I have set up kvm/quemu on a server. I followed the guide and it worked with one exception. I can only ssh to the vm's through the server that kvm is running. If I use my laptop I cannot. I have to first ssh to the server, then the vm's.

SERVER Ubuntu 18.04 server

Here is the /etc/network/interfaces on the server.

source /etc/network/interfaces.d/*

# The loopback network interface
auto lo
iface lo inet loopback

# primary network interface
#auto eth0
#iface eth0 inet manual
#       address 192.168.1.100
#       netmask 255.255.255.0
#       dns-nameservers 8.8.8.8


#bridge
auto br0
iface br0 inet static
        address 192.168.1.100
        netmask 255.255.224.0
        gateway 192.168.1.1
        dns-nameserver 192.168.100.1 8.8.8.8
        bridge_ports eth0
        bridge_stp n
        bridge_fd 0
        bridge_maxwait 0



br0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500                                                            
        inet 192.168.1.100  netmask 255.255.224.0  broadcast 192.168.31.255                                          
        ether 0e:37:a0:d5:da:e5  txqueuelen 1000  (Ethernet)                                                         
        RX packets 0  bytes 0 (0.0 B)                                                                                
        RX errors 0  dropped 0  overruns 0  frame 0                                                                  
        TX packets 0  bytes 0 (0.0 B)                                                                                
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0                                                   

docker0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500                                                                
        inet 172.17.0.1  netmask 255.255.0.0  broadcast 172.17.255.255                                               
        ether 02:42:ac:48:67:60  txqueuelen 0  (Ethernet)                                                            
        RX packets 0  bytes 0 (0.0 B)                                                                                
        RX errors 0  dropped 0  overruns 0  frame 0                                                                  
        TX packets 0  bytes 0 (0.0 B)                                                                                
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0                                                   

eno1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500                                                           
        inet 192.168.1.7  netmask 255.255.255.0  broadcast 192.168.1.255                                             
        ether 78:2b:cb:03:27:5c  txqueuelen 1000  (Ethernet)                                                         
        RX packets 209192  bytes 21456278 (21.4 MB)                                                                  
        RX errors 0  dropped 1400  overruns 0  frame 0                                                               
        TX packets 1220945  bytes 1689016362 (1.6 GB)                                                                
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0                                                   

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536                                                                         
        inet 127.0.0.1  netmask 255.0.0.0                                                                            
        loop  txqueuelen 1000  (Local Loopback)                                                                      
        RX packets 350787  bytes 5953177436 (5.9 GB)                                                                 
        RX errors 0  dropped 0  overruns 0  frame 0                                                                  
        TX packets 350787  bytes 5953177436 (5.9 GB)                                                                 
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0                                                   

virbr0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500                                                         
        inet 192.168.100.1  netmask 255.255.255.0  broadcast 192.168.100.255                                         
        ether 52:54:00:81:56:35  txqueuelen 1000  (Ethernet)                                                         
        RX packets 4662  bytes 313603 (313.6 KB)                                                                     
        RX errors 0  dropped 41  overruns 0  frame 0                                                                 
        TX packets 2177  bytes 228116 (228.1 KB)                                                                     
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0                                                   

vnet0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500                                                          
        ether fe:54:00:de:c7:b6  txqueuelen 1000  (Ethernet)                                                         
        RX packets 4223  bytes 336843 (336.8 KB)                                                                     
        RX errors 0  dropped 0  overruns 0  frame 0                                                                  
        TX packets 24991  bytes 1402572 (1.4 MB)                                                                     
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0                                                   

Virsh edit 16

<domain type='qemu'>
  <name>ubuntu18.04</name>
  <uuid>bf380e27-73bf-4633-b69a-4b04cae4d0ab</uuid>
  <memory unit='KiB'>2097152</memory>
  <currentMemory unit='KiB'>2097152</currentMemory>
  <vcpu placement='static'>1</vcpu>
  <os>
    <type arch='x86_64' machine='pc-i440fx-bionic'>hvm</type>
    <boot dev='hd'/>
  </os>
  <features>
    <acpi/>
    <apic/>
    <vmport state='off'/>
  </features>
  <clock offset='utc'>
    <timer name='rtc' tickpolicy='catchup'/>
    <timer name='pit' tickpolicy='delay'/>
    <timer name='hpet' present='no'/>
  </clock>
  <on_poweroff>destroy</on_poweroff>
  <on_reboot>restart</on_reboot>
  <on_crash>destroy</on_crash>
  <pm>
    <suspend-to-mem enabled='no'/>
    <suspend-to-disk enabled='no'/>
  </pm>
  <devices>
    <emulator>/usr/bin/qemu-system-x86_64</emulator>
    <disk type='file' device='disk'>
      <driver name='qemu' type='qcow2'/>
      <source file='/mnt/md1/vm/images/ubuntu18.04.qcow2'/>
      <target dev='vda' bus='virtio'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0'/>
    </disk>
    <disk type='file' device='cdrom'>
      <driver name='qemu' type='raw'/>
      <target dev='hda' bus='ide'/>
      <readonly/>
      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
    </disk>
    <controller type='usb' index='0' model='ich9-ehci1'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x7'/>
    </controller>
    <controller type='usb' index='0' model='ich9-uhci1'>
      <master startport='0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0' multifunction='on'/>
    </controller>
    <controller type='usb' index='0' model='ich9-uhci2'>
      <master startport='2'/>
          <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x1'/>
        </controller>
        <controller type='usb' index='0' model='ich9-uhci3'>
          <master startport='4'/>
          <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x2'/>
        </controller>
        <controller type='pci' index='0' model='pci-root'/>
        <controller type='ide' index='0'>
          <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
        </controller>
        <controller type='virtio-serial' index='0'>
          <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
        </controller>
        <interface type='bridge'>
          <mac address='52:54:00:de:c7:b6'/>
          <source bridge='br0'/>
          <model type='virtio'/>
          <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
        </interface>
        <serial type='pty'>
          <target type='isa-serial' port='0'>
            <model name='isa-serial'/>
          </target>
        </serial>
        <console type='pty'>
          <target type='serial' port='0'/>
        </console>
        <channel type='spicevmc'>
          <target type='virtio' name='com.redhat.spice.0'/>
          <address type='virtio-serial' controller='0' bus='0' port='1'/>
        </channel>
        <input type='tablet' bus='usb'>
          <address type='usb' bus='0' port='1'/>
        </input>
        <input type='mouse' bus='ps2'/>
        <input type='keyboard' bus='ps2'/>
        <graphics type='spice' autoport='yes'>
          <listen type='address'/>
        </graphics>
        <sound model='ich6'>
          <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
        </sound>
        <video>
          <model type='qxl' ram='65536' vram='65536' vgamem='16384' heads='1' primary='yes'/>
          <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
        </video>
    <redirdev bus='usb' type='spicevmc'>
      <address type='usb' bus='0' port='2'/>
    </redirdev>
    <redirdev bus='usb' type='spicevmc'>
      <address type='usb' bus='0' port='3'/>
    </redirdev>
    <memballoon model='virtio'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x08' function='0x0'/>
    </memballoon>
  </devices>
</domain>

After to eno1..I lose ssh access. I tried uying any string besides eno1 and same results.. example "bridge_ports mycatisbadass6969". Im guessing that the bridge_ports area is the culprit. Any suggestions?

LAPTOP Ubuntu 18.04 desktop

Ifconfig of laptop

eno1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.1.2  netmask 255.255.255.0  broadcast 192.168.1.255
        inet6 fe80::eb74:44f9:ec1e:5c64  prefixlen 64  scopeid 0x20<link>
        ether ac:22:0b:50:ae:ea  txqueuelen 1000  (Ethernet)
        RX packets 1350919  bytes 1948697230 (1.9 GB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 328633  bytes 28035898 (28.0 MB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
        device interrupt 20  memory 0xf7b00000-f7b20000  

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 6029  bytes 566246 (566.2 KB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 6029  bytes 566246 (566.2 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

virbr0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        inet 192.168.122.1  netmask 255.255.255.0  broadcast 192.168.122.255
        ether 52:54:00:a3:f6:29  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

/etc/network/interfaces

auto lo
iface lo inet loopback

VM Ubuntu18.04 server

ens3: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.100.147  netmask 255.255.255.0  broadcast 192.168.100.255
        inet6 fe80::5054:ff:fede:c7b6  prefixlen 64  scopeid 0x20<link>
        ether 52:54:00:de:c7:b6  txqueuelen 1000  (Ethernet)
        RX packets 278  bytes 24506 (24.5 KB)
        RX errors 0  dropped 119  overruns 0  frame 0
        TX packets 169  bytes 17083 (17.0 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 284  bytes 21556 (21.5 KB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 284  bytes 21556 (21.5 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

I changed

<interface type='network'>
  <source network='default'/>
</interface>

to

 <interface type='bridge'>
  <source bridge='br0'/>
</interface>

has adapter lo..ens3 adapter

Also I have restarted the network interfaces thousands of times while tinkering with sudo /etc/inint.d/network restart

Edit...I find running this below lets me use adapter. Still cant ssh directly to vm

sudo ip addr flush dev br0 
sudo ip addr flush dev eno1
  • Use bridge_ports eno1. You will also need to modify your /etc/libvirt/qemu/vm-name.xml file to use the bridge, as per this answer. – Doug Smythies Jun 16 at 14:51
  • when I do that I lose ssh connection and all connection on server to network. If i use anything but that even wsadffasdfdsa as an example it works but without bridge – Edziu Eames Jun 16 at 15:54
  • Which version of Ubuntu? Did you edit the .xml file? (show us the before and after relevant section of the .xml file.) Did you restart everything. Did you assign the VM a different IP address? Show us both its ifconfig output and its /etc/network/interfaces file (if there is one, more recent version of Ubuntu don't use it anymore, but use netplan instead). – Doug Smythies Jun 16 at 22:27
  • All os's..laptop..server..and vm are ubuntu 18.04. The laptop has a gui.. – Edziu Eames Jun 17 at 0:07
  • Updated question – Edziu Eames Jun 17 at 0:16

Your Answer

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

Browse other questions tagged or ask your own question.