LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 05-20-2012, 10:25 AM   #1
kfritz
Member
 
Registered: Aug 2006
Distribution: Slackware, OpenBSD, CentOS, Ubuntu
Posts: 99

Rep: Reputation: 31
VDE and KVM -- guests and host all on same subnet


I've been using AlienBOB's excellent writeup for VDE configuration, and it works great, but I'd like the guests on the same subnet as the host, rather than on a separate subnet and nat'd. So far I've tried:

1. Bridging tap0 and eth0. This gets my guest on the subnet of eth0, but I cannot get from host to guest or any other PC on lan to my host.

2. Adding a second tap (tap1) using slackbuild tunctl, to add to the bridge. Cannot get tap1 running.

3. Specifying multiple tap interfaces in vde_switch. That just doesn't seem to work at all.

Does anyone have a similar setup working using vde?
 
Old 05-20-2012, 11:17 AM   #2
allend
LQ 5k Club
 
Registered: Oct 2003
Location: Melbourne
Distribution: Slackware64-15.0
Posts: 6,371

Rep: Reputation: 2748Reputation: 2748Reputation: 2748Reputation: 2748Reputation: 2748Reputation: 2748Reputation: 2748Reputation: 2748Reputation: 2748Reputation: 2748Reputation: 2748
As I understand it, VDE requires a tap interface. As this is a virtual network interface device, then it needs to be on a separate subnet to your physical network interface, akin to having two physical network interface devices.
Quote:
1. Bridging tap0 and eth0. This gets my guest on the subnet of eth0, but I cannot get from host to guest or any other PC on lan to my host.
This is what I do, but I have no problems with host/guest/otherPC communications. Do you have DNSMasq setup correctly? Can you communicate by specifying IP addresses?
 
Old 05-20-2012, 12:45 PM   #3
kfritz
Member
 
Registered: Aug 2006
Distribution: Slackware, OpenBSD, CentOS, Ubuntu
Posts: 99

Original Poster
Rep: Reputation: 31
Let me be more specific...

My "real" LAN is 192.168.1.x, and eth0 is plugged into this. If I configure VDE with a tap interface of 172.16.1.1, and run DNSMasq, turn on IP forwarding, turn on NAT or not, it all works just fine. However, I need to have some of my guests on the 192.168.1.x network, because the apps I'm testing want local broadcast and discovery with some real devices on this network.

I'm trying to just bridge the vde switch to my real lan. Is this possible?
 
Old 05-20-2012, 12:59 PM   #4
Alien Bob
Slackware Contributor
 
Registered: Sep 2005
Location: Eindhoven, The Netherlands
Distribution: Slackware
Posts: 8,559

Rep: Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106
I use a modification to rc.inet1 and rc.inet1.conf which allows for the configuration of a network bridge of your ethernet card and the tap interface used by VDE.

See http://connie.slackware.com/~alien/rc_scripts/bridging/ for the patch, example use inside rc.inet1.conf can be found there as well.
My own server where I run several VM's in parallel I have the following lines in my rc.inet1.conf - all it does at boot is to setup a bridge and add my eth0 network interface to the bridge. The tap interface does not get added until later when it is actually needed. You see that I commented out the eth0 configuration:
Code:
# Config information for eth0:
#IPADDR[0]="192.168.0.1"
#NETMASK[0]="255.255.255.0"
#USE_DHCP[0]=""
#DHCP_HOSTNAME[0]=""

# Config information for br0:
IFNAME[1]="br0"
BRNICS[1]="eth0"
IPADDR[1]="192.168.0.1"
NETMASK[1]="255.255.255.0"
USE_DHCP[1]=""
DHCP_HOSTNAME[1]=""
Setting up the tap interface so that multiple virtual machines can be made part of the network subnet of the host, is not hard. If you use my rc.vdenetwork script then that script takes care of adding the tap interface to the bridge when the vde_switch is created.

Add a call to my rc.vdenetwork script to rc.local like with these lines:

Code:
# Start the VDE network layer:
if [ -x /etc/rc.d/rc.vdenetwork ]; then
  echo "Starting VDE:  /etc/rc.d/rc.vdenetwork start"
  /etc/rc.d/rc.vdenetwork start
fi
Inside rc.vdenetwork, you have to set
Code:
NETWORKTYPE="bridge"
to use the bridge. Also, check the variable assignment TAP_DEV=kvm0 because that means the tap interface is going to be created with the name "kvm0" instead of the default "tap0".

When at last you start qemu, you have to add these parameters so that it uses this kvm0 tap interface (and your qemu package has to be compiled with vde support, like my own packages for qemu and qemu-kvm):

Code:
-net vde,sock=/var/run/kvm0.ctl,vlan=0 -net nic,model=virtio,vlan=0
Note that I specified a "virtio" network interface which gives the VM a very fast and efficient network card (supported in Slackware of course) but you can also use a normal network card (a "e1000" card is the default if you do not specify a name).

Eric
 
1 members found this post helpful.
Old 05-20-2012, 01:24 PM   #5
kfritz
Member
 
Registered: Aug 2006
Distribution: Slackware, OpenBSD, CentOS, Ubuntu
Posts: 99

Original Poster
Rep: Reputation: 31
Thanks, I'll give that patch a try later today ... my geeking time has expired for now.

So it looks like I need to bind the host IP address to the bridge interface? I did not try that...
 
Old 05-21-2012, 10:18 PM   #6
kfritz
Member
 
Registered: Aug 2006
Distribution: Slackware, OpenBSD, CentOS, Ubuntu
Posts: 99

Original Poster
Rep: Reputation: 31
Eric: I followed your suggestions and everything works great. The only thing that didn't work for me was having the br0 interface pick up its address from DHCP -- it just timed out. That's OK, I had a permanent lease anyway, so I configured it static.

Thanks!!

Kent.
 
  


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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Centos KVM and guests IP thunder11 Linux - Networking 0 11-29-2011 07:56 AM
KVM with VDE Networking Question dman777 Linux - Virtualization and Cloud 0 09-27-2011 02:01 AM
KVM: How to set up a private network between guests and the host kenneho Linux - Virtualization and Cloud 1 01-17-2010 11:19 AM
Can't Ping Linux KVM from Other Machines on Host Subnet newmanium2001 Linux - Networking 5 05-19-2009 08:01 AM
LXer: Create a LAN for Virtual Servers with KVM and VDE LXer Syndicated Linux News 0 11-12-2008 03:40 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 04:28 PM.

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