LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 04-27-2013, 07:21 PM   #1
rootaccess
Member
 
Registered: Mar 2012
Posts: 311

Rep: Reputation: Disabled
accessing a KVM guest from outside the host


I have two machines, a laptop on 192.168.1.82 and a desktop which is the host for KVM setup on 192.168.1.98. There is 1 guest running which is a centos minimal addressed at 192.168.122.100. All OS's are centos here.

I'm trying to ssh from the laptop (which has no connection to the host whatsoever besides being on the same subnet) to the KVM guest at 192.168.122.100. There already is a default bridge created on the host machine of course. Its called virbr0 and the subnet is 192.168.122.0

I tried to ssh into the guest from the laptop and fail

[03:10 PM][root@ibm network-scripts]# ssh root@192.168.122.100
ssh: connect to host 192.168.122.100 port 22: No route to host

I tried to create a bridge on the laptop machine. Here are the 2 files in /etc/sysconfig/network-scripts that I have edited to reflect that. I did name this bridge br0 instead of virbr0 because I dont think it really matters

this is ifcfg-br0
DEVICE=br0
BOOTPROTO=dhcp
ONBOOT=yes
TYPE=Bridge

And ifcfg-eth0
DEVICE=eth0
IPADDR=192.168.1.82
NETMASK=255.255.255.0
GATEWAY=192.168.1.254
ONBOOT=yes
NM_CONTROLLED=no
DNS1=192.168.1.254
BRIDGE=br0

This is the output after restarting the network

[05:15 PM][root@ibm network-scripts]# service network restart
Shutting down interface br0: [ OK ]
Shutting down interface eth0: [ OK ]
Shutting down loopback interface: [ OK ]
Bringing up loopback interface: [ OK ]
Bringing up interface eth0: [ OK ]
Bringing up interface br0:
Determining IP information for br0... done.
[ OK ]


[05:18 PM][root@ibm network-scripts]# ssh root@192.168.122.100
ssh: connect to host 192.168.122.100 port 22: No route to host

Am I supposed to setup masquerading and ip forwarding on the host machine to allow the network to traverse outside the host? I guess I just want to understand HOW I am supposed to get in from outside the host. Thanks.

Last edited by rootaccess; 04-27-2013 at 07:23 PM.
 
Old 04-27-2013, 08:37 PM   #2
marafa
LQ Newbie
 
Registered: Sep 2008
Posts: 26

Rep: Reputation: 1
you need to research macvtap.

you will also need to understand whether you want 1 or 2 nics.
1 for the guest to be accessible from the host but not the outside network and
1 for the guest to be accessible from the outside network but not the host (via the network coz u can reach it via console)
 
Old 04-27-2013, 11:29 PM   #3
rootaccess
Member
 
Registered: Mar 2012
Posts: 311

Original Poster
Rep: Reputation: Disabled
Thanks but I followed this tutorial and it helped immensely
http://www.techotopia.com/index.php/...idge_Interface

Apparently, by default, VMs are created under a NAT bridge that is only accessible via the host. The host is basically set up with virbr0 which is the bridge defining access to the VMs. In this configuration, VMs are not accessible from outside the host. What has to be done is a regular bridge set up on the host machine. The VMs themselves also need to be configured to bridge under the newly created bridge on the host machine and NOT the default NAT bridge known as virbr0 and set up with the default 192.168.122.1 network.
 
1 members found this post helpful.
  


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



Similar Threads
Thread Thread Starter Forum Replies Last Post
KVM guest cannot access host thehemi Linux - Virtualization and Cloud 8 03-28-2012 04:36 AM
ubuntu move kvm guest from one host to another thllgo Linux - Software 1 04-18-2011 06:12 PM
KVM Guest to Host Bridge Hijacking F14 goatboyx Linux - Virtualization and Cloud 2 03-05-2011 02:09 PM
Share between Qemu-Kvm host and guest Alexvader General 1 06-13-2010 03:07 PM
Has anyone attempted running OS/2 guest under KVM (or other host)? kaza Linux - Virtualization and Cloud 3 05-16-2010 02:53 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

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