LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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 10-20-2009, 09:56 AM   #1
opaltoad
LQ Newbie
 
Registered: Jun 2006
Posts: 7

Rep: Reputation: 1
Host to Guest and vice versa networking


How do i connect to my guests from the host...or anywhere else for that matter?

I've started running KVM on my PC, which has 2 NICs installed.
The guest is bridged, using virtio, to eth0 and the host is set to use eth1 for normal internet activity.

So far everything seems to be working correctly, i.e they can all connect to the internet. Now I've disabled the firewalls on the guests and allowed all connections for eth0 on the host but I can't/don't know how to connect to the services running on them(sendmail and apache). Netstat on the guests show that the correct ports are open.

Am I meant to be connecting to the IP assigned to eth0?
 
Old 10-20-2009, 03:08 PM   #2
manwichmakesameal
Member
 
Registered: Aug 2006
Distribution: Slackware
Posts: 804

Rep: Reputation: 109Reputation: 109
I use VirtualBox, so I'm not sure how much applies to you but here goes. I have 2 nic's on my desktop. One for the host system, one for the VM's. I have a script (that I don't have access to right now) that runs at boot and creates a bridge adapter. I know I probably don't need to do that but, oh well. So I end up with 3 interfaces: eth0, eth1 and br0. In VBox, I have my VM's use the br0 adapter and my network is set up with static ip's. Now, my VM's can access anything on the network just like any other machine and my host machine can access all the vm services as well.

Code:
#!/bin/sh

# This script is for starting our bridge interface for our
# virtual machines

/sbin/modprobe tun

# First, set up eth1
ifconfig eth1 up
ifconfig eth1 0.0.0.0

# Create our bridge and add the interfaces
brctl addbr br0
brctl addif br0 eth1

# Bring interface br0 up
ifconfig br0 up

# Create tun devices for vbox and add them to the bridge
echo "Creating VirtualBox tun devices..."
VBoxAddIF vbox0 $USER br0 &>/dev/null

Last edited by manwichmakesameal; 10-20-2009 at 08:06 PM. Reason: added script
 
Old 10-21-2009, 09:10 AM   #3
opaltoad
LQ Newbie
 
Registered: Jun 2006
Posts: 7

Original Poster
Rep: Reputation: 1
I haven't had a chance to check my initialization scripts yet, but it sounds like our setups are similar, as I also get the 3rd interface, virbr0.

What I can't get my head around is:
Wireshark shows that all outgoing traffic from the guest goes through 192.168.0.10 on the LAN(which is assigned to eth0). Incoming traffic does the same, but only because the connection was initiated by the guest.
So if I tried to open a connection to 192.168.0.10 on port 80 from another PC on the network, it tries to connect to the host and not the guest which is the one running the apache service.
Is this where tun/tap comes into play?
 
Old 10-22-2009, 05:11 PM   #4
manwichmakesameal
Member
 
Registered: Aug 2006
Distribution: Slackware
Posts: 804

Rep: Reputation: 109Reputation: 109
I am by no means an expert, but I think that is what the tun module is for. Check here. It seems to be kind of old, but should still apply.
 
  


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
Networking - bridging - VM-guest/host jonaskellens Linux - Networking 1 06-29-2009 06:20 AM
networking between host and guest divyashree Linux - Networking 3 03-06-2009 10:04 AM
Ubuntu Host Virtualbox guest Networking weirdness ddales Linux - Networking 0 01-20-2008 03:24 PM
can't ping or browse by host name of my Fedora 5 server from WinXP and vice versa edeaux Linux - Networking 2 08-22-2006 07:04 AM
Networking - Host hangs during transfer to Guest linuxfond Linux - Networking 1 03-30-2004 06:36 AM

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

All times are GMT -5. The time now is 11:08 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration