# libvirt vnc | kvm vnc

## m@o

hey there!

i set up a virtual machine using libvirt. now i have the problem of connecting it to the internet before i can actually configure it correctly.

i have a subnet which i will use to bridge the traffic between mutliple vservers.

to get this done i tried to do this:

```
kvm -S -M pc -m 500 -smp 2 -name testvm01 -uuid 45e7c8f5-bee3-bbff-ccdd-afb18a338905 -monitor pty -boot c -drive file=,if=ide,media=cdrom,index=2 -drive file=/dev/vg/vm01,if=virtio,index=0,boot=on -net nic,macaddr=43:bb:27:34:81:66 -net tap,ifname=qtap0,script=no,downscript=no -serial none -parallel none -usb -vnc 127.0.0.1:0 -k en-us
```

the command for this i took from the libvirt log and changed the two -net parameters to match my demands.

the thing is: i do not know how to configure libvirt to do this in the config filesi do not see any VNC data, can connect though, when i start up the machine by hand like this

can anyone help me here? why does VNC do not return anything in manual kvm mode? how can i configure libvirt with these network settings?

----------

## VinzC

What puzzles me is that

```
-vnc 127.0.0.1:0
```

which means you could connect VNC only from the host machine where KVM is running, i.e. you wouldn't be able to connect remotely to the running virtual machine. I'm not sure that would fix your issue but try using the IP address of the host.

----------

## m@o

well that is NOT the problem  :Smile: 

i do of course use:

```
ssh -L 8888:localhost:5900 user@myhost
```

and connected to localhost:8888 this DID work with the started machine in virsh. and did NOT work with the machine started in kvm.

----------

## radegand

Hi,

I had similar problem when I was specifying mac address at the command line for kvm which resulted in kernel complaining about receiving packets with same source and destination address  :Very Happy:  See 'dmesg' or /var/log/kern.log if that's the case. Try removing the mac parameter and see what happens. My networking parameters go like this:

```
-net nic,vlan=0 -net tap,vlan=0,ifname=tap0,script=no,downscript=no
```

Also make sure that iptables on your host OS are not blocking any traffic...I've done it at least once!  :Wink: 

----------

## m@o

these settings did not work  :Sad: 

i don't get why VNC would work when i start kvm out of virsh and why it wouldn't when started manually...

has anybody a hint how i could try to configure my needed network in the libvirt config files?

----------

## radegand

...so your guest OS doesn't get any networking at all? have you tried using -curses instead of vnc to see what happens during boot of your guest? or running dhcpcd manually from within the guest along with tcpdump on host and guest too see what's going on? Also bear in mind that I'm using tap0 as my interface name while you seem to be using qtap0...

are all the interfaces up? br0 and qtap0? 

Good luck!   :Smile:  What can I say...it definitely works for me!   :Wink: 

----------

## bbgermany

Hi,

have you tried a different display? :0 should be reserved for the local X-server and if run it on 127.0.0.1, you wont be able to connect from another machine!

you should add :99 for example for testing and connect via "vncviewer localhost:99"

bb

----------

## m@o

as mentioned above: this is the command as libvirt uses it (found in the logs).

and with libvirt it works! what seems odd is that a connection seems to work, but there is simply nothing displayed...

----------

## m@o

 *radegand wrote:*   

> ...so your guest OS doesn't get any networking at all? have you tried using -curses instead of vnc to see what happens during boot of your guest? or running dhcpcd manually from within the guest along with tcpdump on host and guest too see what's going on? Also bear in mind that I'm using tap0 as my interface name while you seem to be using qtap0...
> 
> are all the interfaces up? br0 and qtap0? 
> 
> 

 

yes interfaces are up. and vnc delivers an image on boot (when booting from libvirt). so i see everything.

i will look closer into it a little later next month. unfortunately (not for me for the server) i have a vacation coming up.

----------

## bbgermany

The virtual machines can be configured via virt-manager. It takes a bit to puzzle out howto configure libvirtd for this, but then its easy to start, stop and configure the virtual machines via a nice gui.

bb

----------

## m@o

 *bbgermany wrote:*   

> The virtual machines can be configured via virt-manager. It takes a bit to puzzle out howto configure libvirtd for this, but then its easy to start, stop and configure the virtual machines via a nice gui.

 

is there anything like this without X dependencies?

----------

## bbgermany

virt-manager can run on your remote machine, so you dont need to install it on the local system where you have the virtual machines installed. 

bb

----------

## m@o

okay that is a little better.

what do i use then when i have a mac system as admin tool of my choice?

----------

