LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   How do i establish connection between host and guest in KVM (https://www.linuxquestions.org/questions/linux-newbie-8/how-do-i-establish-connection-between-host-and-guest-in-kvm-4175481370/)

Jerico91 10-19-2013 02:08 AM

How do i establish connection between host and guest in KVM
 
Hi Guys,

How do i establish connection between host and guest in KVM?

druuna 10-19-2013 02:43 AM

Quote:

Originally Posted by Jerico91 (Post 5048467)
How do i establish connection between host and guest in KVM?

Do you have a specific problem you run into?

If KVM is set up correctly you should be able to reach the guest from the host by using the guest's ip number and vice versa.

Example:
Code:

# guest IP -> 172.16.122.60
# host ip -> 10.0.100.12

# from host to guest:
ssh username@172.16.122.60

# from guest to host:
ssh username@10.0.100.12

If this doesn't work then have a look at your firewall to see what is and isn't allowed.

Jerico91 10-19-2013 03:48 AM

i have configured bridge network on my host and i've selected my guest to use that bridge network but when i switch to guest i cant see and network device except the loopback.

druuna 10-19-2013 04:02 AM

Quote:

Originally Posted by Jerico91 (Post 5048498)
i have configured bridge network on my host and i've selected my guest to use that bridge network but when i switch to guest i cant see and network device except the loopback.

Did you set up (or activate) a valid network configuration on the guest?

If you run ifconfig on the guest and you only see the loopback device then there's no way you can connect from or to the guest.

How to set this up correctly depends on the distro that's being run as guest.

Jerico91 10-19-2013 06:47 AM

I see only loopback when i run ifconfig in guest
I'm using RHEL 6.0 and i've selected bridge network while installing guest machine.

druuna 10-19-2013 07:32 AM

Quote:

Originally Posted by Jerico91 (Post 5048566)
I see only loopback when i run ifconfig in guest
I'm using RHEL 6.0

It looks like you still need to set up your network in your guest.

Make sure your guest has a network interface (NIC) assigned to it (ifconfig -a should show an eth0 entry.

Then use the system-config-network tool. Or, if you prefer, you can set it up manually: RHEL/CentOS 6 Networking

Doug G 10-19-2013 12:41 PM

Also you may need to set up a network bridge on host and use the bridge as your network in the kvm vm. By default a new vm will use it's own NAT subnet that's not accessible from the host subnet.

Jerico91 10-20-2013 02:59 AM

@druuna

when i did ifconfig -a i can see eth0 and i configured it to dhcp
now i'm able to communicate between host and guest, but its getting ip from mu ISP's dhcp server like my host

When i setup static ip on host and guest I'm not able to access host from guest or vice versa
i need static ip to be configured as when I'm configuring anything the ip would be changed every time.

druuna 10-20-2013 04:50 AM

Quote:

Originally Posted by Jerico91 (Post 5048915)
when i did ifconfig -a i can see eth0 and i configured it to dhcp
now i'm able to communicate between host and guest, but its getting ip from mu ISP's dhcp server like my host

When i setup static ip on host and guest I'm not able to access host from guest or vice versa
i need static ip to be configured as when I'm configuring anything the ip would be changed every time.

Is there a specific reason why you choose to use BRIDGED/ROUTED instead of the default and easier to set up NAT?

Jerico91 10-20-2013 11:24 AM

initially it was not working with NAT not sure why
now i removed the machine and reinstalled and selected NAT its working fine with static ip now

Thnx


All times are GMT -5. The time now is 11:03 AM.