LinuxQuestions.org
Visit Jeremy's Blog.
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 04-23-2010, 03:36 PM   #1
Cotun
Member
 
Registered: Jan 2009
Location: UK
Distribution: Debian Stable and Unstable
Posts: 61

Rep: Reputation: 21
KVM guest networking user-mode difficulties


Hi everybody

I've been trying to setup a Debian Lenny virtual machine inside KVM and I'm having significant trouble with the bridging mode of networking when KVM is run as a user. There are no problems when KVM is run as root, so clearly this is some kind of permissions issue. However, I can't figure out where it is and hoped somebody here might know. I've done this before without difficulty, so I can't understand why it no longer works.

I've been following this as a guide using the "public bridging" method. I'm running Debian Lenny on the host too with the 2.6.30 kernel. The guest virtual machine must be accessible from the local network.

http://www.linux-kvm.org/page/Networking

The tun kernel module is loaded and seems to works properly. I've set the group permission of the /dev/net/tun device to "tun" and added that group to my user account. The permissions are 660, although 666 also doesn't work. The /etc/qemu-ifup script I've used is the same as shown in the above guide and is executable for all users. I've confirmed that /sbin/ip, /usr/sbin/brctl and /usr/sbin/tunctl are all installed and seem to be working. I've also added sudo introductions for each of these to run under the current user account, although it doesn't even ask for a password to access them. The contents of my /etc/network/interfaces is:

Code:
auto br0
iface br0 inet static
        address 192.168.0.2
        network 192.168.0.0
        netmask 255.255.255.0
        broadcast 192.168.0.255
        gateway 192.168.0.50
        bridge_ports eth1
        bridge_fd 1
        bridge_hello 1
        bridge_stp off
br0 does have an IP address and eth1 does not. The bridge has been working properly for some time.

No matter what I do permissions-wise, I cannot get rid of this problem.

Code:
#kvm -net nic -net tap,script=/etc/qemu-ifup
warning: could not configure /dev/net/tun: no virtual network emulation
Does anybody know what I could be missing?

Thanks

Cotun
 
Old 04-24-2010, 11:03 AM   #2
Chuck56
Member
 
Registered: Dec 2006
Location: Colorado, USA
Distribution: Slackware
Posts: 930

Rep: Reputation: 479Reputation: 479Reputation: 479Reputation: 479Reputation: 479
I usually identify the specific tap interface:

Code:
-net tap,ifname=tap0,script=/etc/qemu-ifup
 
Old 04-25-2010, 11:57 AM   #3
Cotun
Member
 
Registered: Jan 2009
Location: UK
Distribution: Debian Stable and Unstable
Posts: 61

Original Poster
Rep: Reputation: 21
Yes, I tried that originally, it has no effect. I can't understand what the problem is.
 
Old 04-28-2010, 01:02 PM   #4
HasC
Member
 
Registered: Oct 2009
Location: South America - Paraguay
Distribution: Debian 5 - Slackware 13.1 - Arch - Some others linuxes/*BSDs through KVM and Xen
Posts: 329

Rep: Reputation: 55
What about doing everything by hand?
Code:
root# brctl addbr switch0
root# for IFACE in $(seq 10 15); do
    >    tunctl -t tap"$IFACE" -u $(id -u youruser)
    >    brctl addif switch0 tap"$IFACE"
    >    ifconfig tap"$IFACE"promisc up
    > done
root# brctl addif switch0 eth1
root# ifconfig eth1 promisc up
root# ifconfig switch0 192.168.0.2 up
There you have your virtual networking, with some TAPs to play with.

EDIT: Later, when you start your VMs, use:
Code:
qemu -net tap,ifname=tapX,script=no,downscript=no
Don't use /etc/qemu-ifup

Last edited by HasC; 04-28-2010 at 01:06 PM.
 
1 members found this post helpful.
Old 05-01-2010, 04:50 PM   #5
Cotun
Member
 
Registered: Jan 2009
Location: UK
Distribution: Debian Stable and Unstable
Posts: 61

Original Poster
Rep: Reputation: 21
Thanks for your response. It's amazing how you never think of the obvious until it's suggested to you

Setting it up manually worked fine. Although the TUN/TAP networking seems horribly slow for some reason, at about 10% of the real network capacity. It doesn't appear to be bottlenecked by CPU or disk throughput.

For the benefit of others reading this thread, I didn't have to follow all the stages suggested by others as I already had a bridge setup configured. So I basically did the following to configure one tap interface.

Code:
root# tunctl -t tap0 -u <username>
root# brctl addif br0 tap0
root# ifconfig tap0 up
I added this to my rc.local file and now it configures it on every boot-up. I removed the promisc parameter from the ifconfig line as I found it wasn't needed and made no difference to performance. I also can't be sure of this, but I think using the promisc flag may introduce a security implication as the guest virtual machine may receive transmissions meant for the real host, i.e allowing packet sniffing on the virtual machine. But I have no idea if this is really a possible scenario or not.

For running KVM, I used this

Code:
kvm -net nic,macaddr=<address> -net tap,ifname=tap0,script=no,downscript=no
Thanks to both of you for your help
 
Old 05-01-2010, 06:52 PM   #6
Gerard Lally
Senior Member
 
Registered: Sep 2009
Location: Leinster, IE
Distribution: Slackware, NetBSD
Posts: 2,177

Rep: Reputation: 1761Reputation: 1761Reputation: 1761Reputation: 1761Reputation: 1761Reputation: 1761Reputation: 1761Reputation: 1761Reputation: 1761Reputation: 1761Reputation: 1761
Quote:
Originally Posted by Cotun View Post
Setting it up manually worked fine. Although the TUN/TAP networking seems horribly slow for some reason, at about 10% of the real network capacity. It doesn't appear to be bottlenecked by CPU or disk throughput.
Try setting the following for improved network speed:

kvm -net nic,macaddr=<address>,model=e1000
 
1 members found this post helpful.
Old 05-02-2010, 09:37 AM   #7
HasC
Member
 
Registered: Oct 2009
Location: South America - Paraguay
Distribution: Debian 5 - Slackware 13.1 - Arch - Some others linuxes/*BSDs through KVM and Xen
Posts: 329

Rep: Reputation: 55
Quote:
Originally Posted by gezley View Post
Try setting the following for improved network speed:

kvm -net nic,macaddr=<address>,model=e1000
Or model=virtio, if the guests' are Linux
 
1 members found this post helpful.
Old 05-03-2010, 05:22 PM   #8
Cotun
Member
 
Registered: Jan 2009
Location: UK
Distribution: Debian Stable and Unstable
Posts: 61

Original Poster
Rep: Reputation: 21
Thanks to both of you for your network model suggestions, I had no idea that existed. The performance has now picked up nicely
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
KVM: Mouse under Windows Guest performs way better than under Centos Guest martdj Linux - Virtualization and Cloud 3 03-29-2010 04:20 AM
KVM Guest Crashes after 1 to 3 days Sander88 Linux - Virtualization and Cloud 5 03-18-2010 10:23 AM
LXer: Install Guest additions and run fullscreen mode on VirtualBox Guest OS | Linux LXer Syndicated Linux News 0 01-17-2010 05:30 PM
User-mode Linux Networking Issue billyjones26@gmail.com Linux - Software 1 05-20-2009 12:53 PM
Linux Single User Mode + Networking ALInux Linux - General 2 08-11-2007 08:48 AM

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

All times are GMT -5. The time now is 10:18 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