redhat 6.4配置kvm

[1] Install some packages first.
[root@dlp ~]# yum -y install qemu-kvm libvirt python-virtinst bridge-utils
[root@dlp ~]# lsmod | grep kvm   # make sure modules are loaded
kvm_intel46589 0
kvm 292815 1 kvm_intel
[root@dlp ~]# /etc/rc.d/init.d/libvirtd start
Starting libvirtd daemon: [ OK ]
[root@dlp ~]# /etc/rc.d/init.d/messagebus start
Starting system message bus: [ OK ]
[root@dlp ~]# chkconfig libvirtd on
[root@dlp ~]# chkconfig messagebus on


[2] Configure Bridge networking for KVM virtual machine.
[root@dlp ~]# mv /etc/sysconfig/network-scripts/ifcfg-eth0 /etc/sysconfig/network-scripts/ifcfg-br0
[root@dlp ~]# vi /etc/sysconfig/network-scripts/ifcfg-br0
# change
DEVICE=br0
HWADDR=00:0C:29:5F:03:42
# change
TYPE=Bridge
UUID=c1539085-73d7-4455-ac82-88f26464458a
ONBOOT=yes
NM_CONTROLLED=yes
BOOTPROTO=none
IPADDR=10.0.0.30
NETMASK=255.255.255.0
GATEWAY=10.0.0.1
DNS1=10.0.0.1
IPV6INIT=no
USERCTL=no
[root@dlp ~]# vi /etc/sysconfig/network-scripts/ifcfg-eth0
# create new
DEVICE=eth0
TYPE=Ethernet
ONBOOT=yes
BRIDGE=br0

[3]service NetworkManager stop

[root@dlp ~]# /etc/rc.d/init.d/network restart
Shutting down interface br0:                               [  OK  ]
Shutting down interface eth0:                              [  OK  ]
Shutting down loopback interface:                          [  OK  ]
Bringing up loopback interface:                            [  OK  ]
Bringing up interface eth0:                                [  OK  ]
Bringing up interface br0:  Determining if ip address 10.0.0.30 is already in use for device br0...
                                                           [  OK  ]

[root@dlp ~]# ifconfig
br0       Link encap:Ethernet  HWaddr 00:0C:29:5F:03:38
          inet addr:10.0.0.30  Bcast:10.0.0.255  Mask:255.255.255.0
          inet6 addr: fe80::20c:29ff:fe5f:338/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:65 errors:0 dropped:0 overruns:0 frame:0
          TX packets:71 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:4370 (4.2 KiB)  TX bytes:13742 (13.4 KiB)

eth0      Link encap:Ethernet  HWaddr 00:0C:29:5F:03:38
          inet6 addr: fe80::20c:29ff:fe5f:338/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:38727 errors:0 dropped:0 overruns:0 frame:0
          TX packets:20836 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:52608947 (50.1 MiB)  TX bytes:1867883 (1.7 MiB)

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:2 errors:0 dropped:0 overruns:0 frame:0
          TX packets:2 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:1152 (1.1 KiB)  TX bytes:1152 (1.1 KiB)

virbr0    Link encap:Ethernet  HWaddr 52:54:00:73:7E:F3
          inet addr:192.168.122.1  Bcast:192.168.122.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:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)

你可能感兴趣的:(redhat)