LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Virtualization and Cloud (https://www.linuxquestions.org/questions/linux-virtualization-and-cloud-90/)
-   -   KVM Virtual network (https://www.linuxquestions.org/questions/linux-virtualization-and-cloud-90/kvm-virtual-network-924828/)

mmajidi 01-20-2012 11:33 AM

KVM Virtual network
 
I have done all of the necessary set up on my KVM virtual network using Centos 6.2 as host and Centos 6.2.

I have defined a network bridge on the host machine.

Here is what I have on the host machine
ifconfig -a
br0 Link encap:Ethernet HWaddr 00:24:81:A9:BF:84
inet addr:192.168.2.249 Bcast:192.168.2.255 Mask:255.255.255.0
inet6 addr: fe80::224:81ff:fea9:bf84/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:270021 errors:0 dropped:0 overruns:0 frame:0
TX packets:129622 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:17402797 (16.5 MiB) TX bytes:469214669 (447.4 MiB)

eth0 Link encap:Ethernet HWaddr 00:24:81:A9:BF:84
inet6 addr: fe80::224:81ff:fea9:bf84/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:270287 errors:0 dropped:0 overruns:0 frame:0
TX packets:378486 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:22280387 (21.2 MiB) TX bytes:484320429 (461.8 MiB)
Interrupt:16

eth1 Link encap:Ethernet HWaddr 00:24:81:A9:BF:85
BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)
Interrupt:17

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:16436 Metric:1
RX packets:259997 errors:0 dropped:0 overruns:0 frame:0
TX packets:259997 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:473368575 (451.4 MiB) TX bytes:473368575 (451.4 MiB)

macvtap0 Link encap:Ethernet HWaddr 52:54:00:5B:6C:B3
inet6 addr: fe80::5054:ff:fe5b:6cb3/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:6 overruns:0 carrier:0
collisions:0 txqueuelen:500
RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)

tap0 Link encap:Ethernet HWaddr 8A:2D:7F:26:42:EB
BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:500
RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)

tap1 Link encap:Ethernet HWaddr 5E:AF:32:B2:AF:A9
BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:500
RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)

virbr0 Link encap:Ethernet HWaddr 52:54:00:E9:F5:F6
inet addr:192.168.100.1 Bcast:192.168.100.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:269 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:0 (0.0 b) TX bytes:15831 (15.4 KiB)

virbr0-nic Link encap:Ethernet HWaddr 52:54:00:E9:F5:F6
BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:500
RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)

mmajidi 01-20-2012 11:35 AM

KVM Virtual Network
 
Please help... thank you

[/U]
Quote:

Originally Posted by mmajidi (Post 4579958)
I have done all of the necessary set up on my KVM virtual network using Centos 6.2 as host and Centos 6.2.

I have defined a network bridge on the host machine.

Here is what I have on the host machine
ifconfig -a
br0 Link encap:Ethernet HWaddr 00:24:81:A9:BF:84
inet addr:192.168.2.249 Bcast:192.168.2.255 Mask:255.255.255.0
inet6 addr: fe80::224:81ff:fea9:bf84/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:270021 errors:0 dropped:0 overruns:0 frame:0
TX packets:129622 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:17402797 (16.5 MiB) TX bytes:469214669 (447.4 MiB)

eth0 Link encap:Ethernet HWaddr 00:24:81:A9:BF:84
inet6 addr: fe80::224:81ff:fea9:bf84/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:270287 errors:0 dropped:0 overruns:0 frame:0
TX packets:378486 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:22280387 (21.2 MiB) TX bytes:484320429 (461.8 MiB)
Interrupt:16

eth1 Link encap:Ethernet HWaddr 00:24:81:A9:BF:85
BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)
Interrupt:17

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:16436 Metric:1
RX packets:259997 errors:0 dropped:0 overruns:0 frame:0
TX packets:259997 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:473368575 (451.4 MiB) TX bytes:473368575 (451.4 MiB)

macvtap0 Link encap:Ethernet HWaddr 52:54:00:5B:6C:B3
inet6 addr: fe80::5054:ff:fe5b:6cb3/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:6 overruns:0 carrier:0
collisions:0 txqueuelen:500
RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)

tap0 Link encap:Ethernet HWaddr 8A:2D:7F:26:42:EB
BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:500
RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)

tap1 Link encap:Ethernet HWaddr 5E:AF:32:B2:AF:A9
BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:500
RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)

virbr0 Link encap:Ethernet HWaddr 52:54:00:E9:F5:F6
inet addr:192.168.100.1 Bcast:192.168.100.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:269 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:0 (0.0 b) TX bytes:15831 (15.4 KiB)

virbr0-nic Link encap:Ethernet HWaddr 52:54:00:E9:F5:F6
BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:500
RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)


lithos 01-20-2012 01:31 PM

What help do you want ?

Specify the trouble you have :
- you can not connect to KVM machine
- you can not ping / reach it
- you can not 'browse' something you have installed in KVM ?

what
what
what ...

Define your problem, provide / write the steps or link what have you done (you followed a how to or something)
then write where is your problem for which you want help.

Good luck

mmajidi 01-20-2012 02:15 PM

network problem on guest
 
My guest OS has static IP address and I can ping it with no issue. However when I ping the host IP address, I get the unreachable message stating that the IP address cannot be reached. I get the same error when I ping the gateway.

When I ping www.yahoo.com, I get the unknown host name.

I have seup a bridge and my guest os has a static IP address assigned to it.

Is there anyone who can help me?

mmajidi 01-22-2012 11:05 AM

got it resolved
 
I ended up reinstalling the KVM and the guest OS again. I went to virt-manager (I am using kvm and cents as host os), deleted the guest OS (my guest OS is Centos 6.2), remove the KVM, libvirt and then reinstall it the whole thing again.

Once I installed everything again and installed my guest OS (Centos 6.2.), everything worked fine.

I will put my exact steps on the forum later.

tallship 01-26-2012 02:41 PM

Quote:

Originally Posted by mmajidi (Post 4581362)

I will put my exact steps on the forum later.

I would like to see that, and you might want to mark the thread as solved too when you post those steps here.

Kindest regards,

.

mmajidi 01-27-2012 11:44 PM

[SOLVED]how I solved it
 
In summary, here are the issue that I run into and this how I solved.

My goal was to install KVM on top of Centos 6.0 and I wanted to install multiple Centos 6.0 guest OS. My configuration for host OS is Centos 6.0 and the guest OSs are Centos 6.0.

I am running KVM under root.

Do the following on the host machine

a) You need to have a later model processor, with virtualization support, for KVM to work properly. This can be checked by examining the /proc/cpuinfo file:

egrep '(vmx|svm)' --color=always /proc/cpuinfo
If you get back results with vmx, then you have an Intel processor. If you get back results with svm, then you have an AMD processor. If you receive a null return, then your processor is not built for hardware supported full virtualization. The xen approach, used in the CentOS 5 series, supports para virtualization.

b) The KVM package for CentOS is available in the extras repository for versions prior to CentOS 5.4. You may install KVM with:
yum install kvm kmod-kvm

c) You probably want to also install QEMU, which is available in the base CentOS repositories, because many of its provided commands can be useful in managing a VM.
yum install qemu

d) The next step is to modprobe the kvm module for your architecture. If it's an Intel processor:
modprobe kvm-intel
If it's an AMD processor:
modprobe kvm-amd
If all goes well, you should have a kvm module loaded on your system by now. You can verify this by running:
/sbin/lsmod | grep kvm

e) If you want the guest to appear as another host on the LAN, visible to the rest of the network, you will have to use bridged networking. There are many QEMU howtos around, but most are out of date, as it has changed since the 2.6.18 kernel.
Here we describe a simple method that works. Many howtos talk of making a qemu-ifup script that lives in /etc. Unfortunately, most of the howtos seem to be outdated, as none of the suggested scripts found in there worked. Below we will present a script that creates the bridge and tap interfaces with appropriate commands.
First you will need bridge-utils, available from the base repo:
yum install bridge-utils

You'll also need tunctl.
This is now available from the RPMForge repository, so, once the repo is enabled, can easily be installed with

yum install tunctl

You will also want to edit your /etc/udev/rules.d/90-kvm-rules. When you installed the rpm, the created file reads:

KERNEL=="kvm", NAME="%k", GROUP="kvm", MODE="0660" In theory, adding the line:

KERNEL=="tun", NAME="net/%k", GROUP="kvm", MODE="0660" should give /dev/net/tun proper permissions. In practice, this doesn't seem to be the case, and though it is a kludge, one can simply add lines like

make usre you logged on as root and issue the following command

brctl addbr br0

copy ifcfg-etho in (/etc/sysconfig/network-scripts) to br0-eth0 in (/etc/sysconfig/network-scripts)

this is a sample ifcfg-br0 file (this is just a sample, make sure that the setting matches your network configuration

DEVICE=br0
TYPE=Bridge
ONBOOT=yes
DELAY=0
BOOTPROTO=none
IPADDR=192.168.1.249
NETMASK=255.255.255.0
GATEWAY=192.168.1.1
DNS1=43.123.45.67
DNS2=43.123.89.21

this is a sample ifcfg-eth0
DEVICE=eth0
HWADDR=66:13:12:b9:xf:83
ONBOOT=yes
BOOTPROTO=none
TYPE=Ethernet
BRIDGE=br0

After setting the files, do service network restart

After the above command, enter ifconfig and you will see bro and etho in the output.

Now you created the bridge

f) Install virt-manager using yum install virt-manager

g) get the iso image for centos (this may take a long time to get).

The netinstall.iso does not work for me. I ended up using the full iso file for installation.

cd /tmp

You can get te right iso image for your system. This image is for Centos 64 bits.

wget mirror.net.cen.ct.gov/centos/6.2/isos/x86_64/CentOS-6.2-x86_64-bin-DVD1.iso


Now you are ready to install the guest OS. Start virt-manager & from the host OS. You will find instruction on how to use virt-manager. I am repeating the steps for the virt-manager.
However I will give some pointers.

-- When selecting the ISO image, make sure you point to the ISO file that you down load.
--- The network should be the bridge network
--- When you get to the time zone screen, just leave it as default


All times are GMT -5. The time now is 12:46 AM.