LinuxQuestions.org
View the Most Wanted LQ Wiki articles.
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 07-09-2013, 08:49 AM   #1
decenter
Member
 
Registered: Sep 2011
Distribution: Ubuntu 12.04.4 LTS
Posts: 136

Rep: Reputation: 17
Cant ping Host and VM vice versa [KVM]


Hello,

I have installed KVM in Linux Deepin desktop 12.12. I created Cent OS VM and assigned static private IP to it. I can ping to internet and other local computer's IP address from the VM, but I can't ping my host (my PC where I installed KVM) IP. My host IP has separate static IP. Also I cannot ping to VM from the host.

The connection type for VM is bridged. Screenshot: http://i.imgur.com/jpneLRl.png?1

Any idea?

Thanks.
 
Old 07-09-2013, 09:05 AM   #2
asimba
Member
 
Registered: Mar 2005
Location: 127.0.0.0
Distribution: Red Hat / Fedora
Posts: 349

Rep: Reputation: 42
Are they on same net
 
Old 07-09-2013, 09:07 AM   #3
decenter
Member
 
Registered: Sep 2011
Distribution: Ubuntu 12.04.4 LTS
Posts: 136

Original Poster
Rep: Reputation: 17
Hello,

Yes, they are on the same subnet. Infact the other local computers are also in the same subnet.
 
Old 07-09-2013, 09:49 AM   #4
asimba
Member
 
Registered: Mar 2005
Location: 127.0.0.0
Distribution: Red Hat / Fedora
Posts: 349

Rep: Reputation: 42
May I have IP's for both please (Virtual MAchine and Host)
 
Old 07-10-2013, 03:02 AM   #5
decenter
Member
 
Registered: Sep 2011
Distribution: Ubuntu 12.04.4 LTS
Posts: 136

Original Poster
Rep: Reputation: 17
Hello,

Sure.

Host IP : 192.168.20.181

VM IP : 192.168.20.201

I can ping other local computers around. One of its IP is 192.168.20.167
 
Old 07-17-2013, 03:34 AM   #6
gradinaruvasile
Member
 
Registered: Apr 2010
Location: Cluj, Romania
Distribution: Debian Testing
Posts: 515

Rep: Reputation: 102Reputation: 102
I think this question was asked many times around here.

It will not work like this.

The (only?) way to have full network transparency with kvm is to use a pre defined bridge on the host - one working method ( i use it too) is to transfer the physical (say eth0) devices config to a bridge (br0) then use that bridge as a shared device in kvm/virt-manager.
For example i have:

Code:
$ brctl show
bridge name	bridge id		STP enabled	interfaces
br0		8000.94de80008b0c	no		eth0
							vnet0
vnet0 is a device created by kvm attached to my running vm. eth0 has no configuration - everything it had is transferred to br0. Every vm will have its own vnetX device when started - the IP address etc is controlled from within the vm.
Attached Images
File Type: jpg br.jpg (76.7 KB, 5 views)
 
Old 07-17-2013, 07:28 AM   #7
Chuck56
Member
 
Registered: Dec 2006
Location: Colorado
Distribution: Slackware
Posts: 421

Rep: Reputation: 58
Quote:
Originally Posted by gradinaruvasile View Post
I think this question was asked many times around here.

It will not work like this.

The (only?) way to have full network transparency with kvm is to use a pre defined bridge on the host - one working method ( i use it too) is to transfer the physical (say eth0) devices config to a bridge (br0) then use that bridge as a shared device in kvm/virt-manager.
It can work. When using macvtap for the VMs then use macvlan for the host. Then VM & host can "see" each other similar to the BR/TAP bridging method.

Code:
# as root - add macvlan to eth
ip addr flush eth0
ip link add link eth0 dev mvl0 type macvlan mode bridge
ip link set mvl0 addr 00:00:00:02:01:81 up
ip addr add 192.168.20.181 dev mvl0
ip route add default via 192.168.20.1 dev mvl0
# show the interfaces
ip addr
# show the routes
ip route
 
Old 07-17-2013, 07:37 AM   #8
gradinaruvasile
Member
 
Registered: Apr 2010
Location: Cluj, Romania
Distribution: Debian Testing
Posts: 515

Rep: Reputation: 102Reputation: 102
Thats basically the same, correct me if its not. Does it persist after reboot?
 
Old 07-17-2013, 07:44 AM   #9
Chuck56
Member
 
Registered: Dec 2006
Location: Colorado
Distribution: Slackware
Posts: 421

Rep: Reputation: 58
Quote:
Originally Posted by gradinaruvasile View Post
Thats basically the same, correct me if its not. Does it persist after reboot?
No persistence after reboot. You could script it to run on start up.
 
Old 07-17-2013, 07:53 AM   #10
gradinaruvasile
Member
 
Registered: Apr 2010
Location: Cluj, Romania
Distribution: Debian Testing
Posts: 515

Rep: Reputation: 102Reputation: 102
Does it have any tangible advantages over the standard bridging method?
 
Old 07-17-2013, 09:14 PM   #11
Chuck56
Member
 
Registered: Dec 2006
Location: Colorado
Distribution: Slackware
Posts: 421

Rep: Reputation: 58
Quote:
Originally Posted by gradinaruvasile View Post
Does it have any tangible advantages over the standard bridging method?
The upsides are numerous. Using macvtap/macvlan simplifies networking by decoupling the tap and the bridge. You can start a macvtap and gain network access with the VM without starting the macvlan for the host. You only need the macvlan if you need the VM and the host to see each other. The cli is simplified using route2 commands as a single tool to manipulate the macvtap, macvlans and default route. You don't have to use separate cli tools like brctl for the bridge and tunctl for the tap and route for the default route. The modules for macvtap, macvlan & tun modules are automatically loaded as dependencies of the vhost_net module used for virtio networks.

A downside is that qemu doesn't directly support macvtap yet so you have to use file descriptors for network access. That's handled for you if you use libvirt and requires a bit more effort if you use the cli. There may be other downsides but they don't jump out at me at the moment.
 
  


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
how do we access files of host OS in VMware when guest OS is Ubuntu and vice versa? shrutimore Linux - Virtualization and Cloud 2 08-31-2011 08:46 PM
Host to Guest and vice versa networking opaltoad Linux - Virtualization and Cloud 3 10-22-2009 04:11 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 06:04 AM
m1 can ping m2, but not vice versa cmacklin Linux - Networking 4 10-31-2004 08:01 PM
Ping from Debian to WinME (vice versa) failed :( Elijah Linux - Networking 6 08-24-2003 12:40 AM


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

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration