Link to home
Start Free TrialLog in
Avatar of Jay Lepore
Jay Lepore

asked on

KVM Virtual Machine's - Can't get ping each other or host

We have Virtual Machines operating within the KVM environment.  We setup one as a dev server running apache etc and the other as a Windows development environment.

The two environments are setup and running fine.  However, they cannot ping (see) each other.  I am wondering if there is a clear solution to this.

This is what is happening.

From Host:
      Cannot ping either of 2 VM's (one linux, one windows)

From Either of the VM's:
      Cannot ping host
      Cannot ping each other

From other network machines (for instance my laptop from within my company network)
      Successfully ping host at 192.168.0.64
      Successfully ping VM1 (Linux) 192.168.0.43
      Successfully ping VM2 (Windows) 192.168.0.84

What sayeth the group ?

Jay Lepore
CompuMatter
Avatar of Member_2_6582184
Member_2_6582184
Flag of Germany image

Please elaborate on your network setup:
1) Are the virtual NiCs assigned to a bridge?
2) Do they have more then one virtual NIC each?
3) can they ping anything else in their subnet?

On the Linux machine, post the output of:
ifconfig

Open in new window

And the output from Windows's :
ipconfig /all

Open in new window

Avatar of Jay Lepore
Jay Lepore

ASKER

This is new territory to me but I pay attention and will be able to resolve with guidance.

The answers are:

1) 'what is a virtual NIC' and how would I assign them to a bridge ;-)  
2) see response 1)
3) They seem to be able to ping everything else in their subnet

They can also ping the Internet normally.

The results of ifconfig / ipconfig are:

-------------------------------------
LINUX VM
-------------------------------------
jay@staging:~$ ifconfig
eth0      Link encap:Ethernet  HWaddr 52:54:00:8e:ef:a8  
          inet addr:192.168.0.43  Bcast:192.168.0.255  Mask:255.255.255.0
          inet6 addr: fe80::5054:ff:fe8e:efa8/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:16289 errors:0 dropped:199 overruns:0 frame:0
          TX packets:4806 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:8438459 (8.4 MB)  TX bytes:442562 (442.5 KB)

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:1218 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1218 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:405561 (405.5 KB)  TX bytes:405561 (405.5 KB)

jay@staging:~$


-------------------------------------
WINDOWS VM
-------------------------------------
Windows IP Configuration

   Host Name . . . . . . . . . . . . : Jay-PC
   Primary Dns Suffix  . . . . . . . :
   Node Type . . . . . . . . . . . . : Hybrid
   IP Routing Enabled. . . . . . . . : No
   WINS Proxy Enabled. . . . . . . . : No

Ethernet adapter Local Area Connection:

   Connection-specific DNS Suffix  . :
   Description . . . . . . . . . . . : Realtek RTL8139C+ Fast Ethernet NIC
   Physical Address. . . . . . . . . : 52-54-00-6F-09-4D
   DHCP Enabled. . . . . . . . . . . : Yes
   Autoconfiguration Enabled . . . . : Yes
   Link-local IPv6 Address . . . . . :
fe80::24b7:c441:7a3b:a956%11(Preferred)
   IPv4 Address. . . . . . . . . . . : 192.168.0.84(Preferred)
   Subnet Mask . . . . . . . . . . . : 255.255.255.0
   Lease Obtained. . . . . . . . . . : Tuesday, October 22, 2013 3:08:10
PM
   Lease Expires . . . . . . . . . . : Wednesday, October 23, 2013 3:08:09
PM
   Default Gateway . . . . . . . . . : 192.168.0.1
   DHCP Server . . . . . . . . . . . : 192.168.0.1
   DHCPv6 IAID . . . . . . . . . . . : 240276480
   DHCPv6 Client DUID. . . . . . . . :
00-01-00-01-19-F6-B3-EC-52-54-00-6F-09-4D
   DNS Servers . . . . . . . . . . . : 192.168.0.1
   NetBIOS over Tcpip. . . . . . . . : Enabled

Tunnel adapter isatap.{3E4746A0-86FD-449C-978C-F423EF8A49AE}:

   Media State . . . . . . . . . . . : Media disconnected
   Connection-specific DNS Suffix  . :
   Description . . . . . . . . . . . : Microsoft ISATAP Adapter
   Physical Address. . . . . . . . . : 00-00-00-00-00-00-00-E0
   DHCP Enabled. . . . . . . . . . . : No
   Autoconfiguration Enabled . . . . : Yes

Tunnel adapter Local Area Connection* 11:

   Connection-specific DNS Suffix  . :
   Description . . . . . . . . . . . : Teredo Tunneling Pseudo-Interface
   Physical Address. . . . . . . . . : 00-00-00-00-00-00-00-E0
   DHCP Enabled. . . . . . . . . . . : No
   Autoconfiguration Enabled . . . . : Yes
   IPv6 Address. . . . . . . . . . . :
2001:0:5ef5:79fd:2c2d:20e2:3f57:ffab(Preferred)
   Link-local IPv6 Address . . . . . :
fe80::2c2d:20e2:3f57:ffab%13(Preferred)
   Default Gateway . . . . . . . . . : ::
   NetBIOS over Tcpip. . . . . . . . : Disabled


Thank you.

Jay Lepore
CompuMatter
Also, here is a screen shot of the two VM's network settings that might also be of value
User generated image
Hello Jay,
thanks for the config - picture.
The problem is you are using 'macvtap' as network device for the VMs. best practice is to bridge one interface of your hypervisor host.
Now, this is important: I think from your last posts you are running Debian/Ubuntu?
If so, I think it is best to define static (system) interfaces with a bride. Image this bride lie a switch, where you plug in your VMs.

I do give you a hint how to create a persistent bridge with /etc/network/interfaces and your system eth0 interface. Replace eth0 with your main network interface on your KVM host (from the picture, it should be eth0 anyway). In this config, there should also be your system eth0 defined. It is not desirable to let any network connections on the KVM host be handled by NetworkManager.

So, open a terminal:
$ sudo gedit /etc/network/interfaces
# add these lines:
# Bridge between eth0
auto br0
iface br0 inet static
  pre-up ip link set eth0 down
  pre-up brctl addbr br0
  pre-up brctl addif br0 eth0
  pre-up ip addr flush dev eth0
  post-down ip link set eth0 down
  post-down ip link set br0 down
  post-down brctl delif br0 eth0
  post-down brctl delbr br0
# save the file
# restart network
$ sudo /etc/init.d/networking restart
# check if the interface is there and up: 
$ ifconfig

Open in new window


Now, in VirtManager, assign this bridge to the network connections of the VMs and restart them. They should now behave like any other computer on your network.

Please also see this guide on how to create a bridge:
https://help.ubuntu.com/community/NetworkConnectionBridge
Note 1: there is also function in VM Manager, in Edit/Connection Details/Network connections/ + Button. It did not work stable the last time I tried (RedHad) - but do not know if it works better now.
Note 2: I did not assign an IP to the bridge. Though you can do this, it is best practice not to assign one.
I had inserted these commands in /etc/network/interfaces but restarting the network generated these errors:

root@vmhost:/etc/network# sudo /etc/init.d/networking restart

 * Running /etc/init.d/networking restart is deprecated because it may not enable again some interfaces
 * Reconfiguring network interfaces...                                                                                                       Ignoring unknown interface eth0=eth0.
Missing required variable: address
Missing required configuration variables for interface br0/inet.
Failed to bring up br0.
Sorry, my bad! Please change 'static' to 'manual' and restart network again:
....
iface br0 inet manual
...

Open in new window

I hope this works :)
After performing the latest suggestion above, I found I could no longer SSH into the host machine.

When I did a hands on host reboot and ifconfig, this is what it showed me:

User generated image
ASKER CERTIFIED SOLUTION
Avatar of Member_2_6582184
Member_2_6582184
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial