Can't get Virtual Network Setup in KVM
Jim
mickeyboa at sbcglobal.net
Mon May 3 22:02:45 UTC 2010
1. Installing KVM, In these instructions under # 1 have been completed,
Network setup is problem.
Fedora 12 KVM Host:
First check if your CPU supports hardware virtualization - if this is
the case, the command
egrep '(vmx|svm)' --color=always /proc/cpuinfo
should display something, e.g. like this:
[root at server1 ~]# egrep '(vmx|svm)' --color=always /proc/cpuinfo
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge
mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall
nx mmxext fxsr_opt rdtscp lm 3dnowext 3dnow rep_good nopl pni cx16
lahf_lm cmp_legacy svm extapic cr8_legacy 3dnowprefetch
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge
mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall
nx mmxext fxsr_opt rdtscp lm 3dnowext 3dnow rep_good nopl pni cx16
lahf_lm cmp_legacy svm extapic cr8_legacy 3dnowprefetch
[root at server1 ~]#
If nothing is displayed, then your processor doesn't support hardware
virtualization, and you must stop here.
To install KVM and virtinst (a tool to create virtual machines), we run
yum install kvm qemu libvirt python-virtinst
Then start the libvirt daemon:
/etc/init.d/libvirtd start
To check if KVM has successfully been installed, run
virsh -c qemu:///system list
It should display something like this:
[root at server1 ~]# virsh -c qemu:///system list
Id Name State
----------------------------------
[root at server1 ~]#
If it displays an error instead, then something went wrong.
Next we need to set up a network bridge on our server so that our
virtual machines can be accessed from other hosts as if they were
physical systems in the network.
To do this, we install the package bridge-utils...
yum install bridge-utils
2. Trying to setup a Virtual Network using KVM .
No network connection, Network Manager is OFF.
The /etc/sysconfig/network scripts br0, eth0 are shown below.
I can't get a "virbro" in ifconfig.
The Network Configuration shows br0 is Active and eth0 is Inactive .
3. The setup instructions are below with ifcfg-br0, ifcfg-eth0 and the
ifconfig output.
Next we need to set up a network bridge on our server so that our
virtual machines can be accessed from other hosts as if they were
physical systems in the network.
To do this, we install the package bridge-utils...
yum install bridge-utils
... and configure a bridge.
I disable Fedora's NetworkManager and enable "normal" networking.
NetworkManager is good for desktops where network connections can change
(e.g. LAN vs. WLAN), but on a server you usually don't change network
connections:
chkconfig NetworkManager off
chkconfig --levels 35 network on
/etc/init.d/network restart
Check your /etc/resolv.conf if it lists all nameservers that you've
previously configured:
cat /etc/resolv.conf
If nameservers are missing, run
system-config-network
and add the missing nameservers again.
Nameservers are in /etc/resolv.conf.
To configure the bridge, create the file
/etc/sysconfig/network-scripts/ifcfg-br0 (please use the BOOTPROTO, DNS1
(plus any other DNS settings, if any), GATEWAY, IPADDR, NETMASK and
SEARCH values from the /etc/sysconfig/network-scripts/ifcfg-eth0 file):
vi /etc/sysconfig/network-scripts/ifcfg-br0
VICE=br0
TYPE=Bridge
BOOTPROTO=static
DNS1=127.0.0.1
DNS2=172.16.0.1
GATEWAY=172.16.0.1
IPADDR=172.16.1.101
NETMASK=255.255.255.0
ONBOOT=yes
IPV6INIT=no
USERCTL=no
Modify /etc/sysconfig/network-scripts/ifcfg-eth0 as follows (comment
out BOOTPROTO, DNS1 (and all other DNS servers, if any), GATEWAY,
IPADDR, NETMASK, and SEARCH and add BRIDGE=br0):
vi /etc/sysconfig/network-scripts/ifcfg-eth0
# Networking Interface
# Realtek Semiconductor Co., Ltd. RTL8111/8168B PCI Express Gigabit
Ethernet controller
DEVICE=eth0
HWADDR=6C:F0:49:06:47:CB
TYPE=Ethernet
#BOOTPROTO=none
#NAME="System eth0"
UUID=5fb06bd0-0bb0-7ffb-45f1-d6edd65f3e03
ONBOOT=yes
#PEERROUTES=yes
NM_CONTROLLED=no
IPV6INIT=no
USERCTL=no
BRIDGE=br0
Then reboot the system:
reboot
After the reboot, run
ifconfig
It should now show the network bridge (br0):
[root at server1 ~]# ifconfig
br0 Link encap:Ethernet HWaddr 6C:F0:49:06:47:CB
inet addr:172.16.1.101 Bcast:172.16.1.255 Mask:255.255.255.0
inet6 addr: fe80::6ef0:49ff:fe06:47cb/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:201 errors:0 dropped:0 overruns:0 frame:0
TX packets:33 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:18276 (17.8 KiB) TX bytes:5621 (5.4 KiB)
eth0 Link encap:Ethernet HWaddr 6C:F0:49:06:47:CB
inet6 addr: fe80::6ef0:49ff:fe06:47cb/64 Scope:Link
UP BROADCAST RUNNING PROMISC MULTICAST MTU:1500 Metric:1
RX packets:325 errors:0 dropped:0 overruns:0 frame:0
TX packets:38 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:33650 (32.8 KiB) TX bytes:3252 (3.1 KiB)
Interrupt:27 Base address:0xa000
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:540 errors:0 dropped:0 overruns:0 frame:0
TX packets:540 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:34648 (33.8 KiB) TX bytes:34648 (33.8 KiB)
But i'm not getting a;
virbr0
More information about the users
mailing list