被派来沈阳出差搭建网络,以下是环境:

AD+辅AD(同时包含exchange2010)

--->   DELL R620

--->   2个cpu,每个6核,每核2个超线程,共24个cpu

--->   64G内存

--->   4个300G 和 2个600G SAS 15K 硬盘

方案:

物理机R620安装RHEL 6.3,使用KVM安装windows 2008 R2

使用KVM心得:

1. 使用clone后,需要使用newsid.exe将系统sid更新

2. exchange最好不要使用克隆,虽然能安装好,但是初始化的时候,无法成功。

3.  KVM真的非常节省资源,安装的域控和exchang在启动的时候会用到50多G,但是稳定下来后,即使是高峰期,加上RHEL实用的,总共也就是用到12G左右,CPU不查过5%,嚯嚯,还剩50G呢,又可以省10台服务器的钱了。

4.安装虚拟机后,必须安装redhat提供的virtio驱动,否则网络IO和磁盘IO会很低,网络最多只支持到100M,无法再提升,安装后可以支持到10G。

 

 

配置
 kvm虚拟机网络问为三种:a)虚拟网络'default':NAT (默认方式,支持虚拟机上网但不支持互访) b)主机设备 vnet0(根据使劲情况而定):macvtap (支持互访) c)主机设备 vent0 (桥接'br0') (bridge方式,可以使用虚拟机成为网络中具有独立IP的主机)
bridge方式介绍:
[root@sykvm ~]# brctl show [S1] 
bridge name    bridge id     STP enabled   interfaces
br0     8000.d4ae52b16e12 no     em1 [S2] 
br1     8000.d4ae52b16e13 no     em2
br3     8000.d4ae52b16e14 no     em3
br4     8000.d4ae52b16e15 no     em4
virbr0 8000.525400002e60 yes    virbr0-nic
 
 
[root@sykvm ~]# brctl show
bridge name    bridge id     STP enabled   interfaces
br0     8000.d4ae52b16e12 no     em1
                         vnet0
[S3] br1     8000.d4ae52b16e13 no     em2
                         vnet2
br3     8000.d4ae52b16e14 no     em3
                         vnet1
br4     8000.d4ae52b16e15 no     em4
                         vnet3
virbr0      8000.525400002e60 yes    virbr0-nic
 
 
[root@sykvm ~]# cd /etc/sysconfig/network-scripts/[S4] 
 
[root@sykvm network-scripts]# ls
 
ifcfg-br0 ifcfg-lo      ifdown-ppp     ifup-ippp    ifup-sit
ifcfg-br1 ifdown        ifdown-routes ifup-ipv6    ifup-tunnel
ifcfg-br3 ifdown-bnep ifdown-sit      ifup-isdn    ifup-wireless
ifcfg-br4 ifdown-eth    ifdown-tunnel ifup-plip    init.ipv6-global
ifcfg-em1 [S5]  ifdown-ippp ifup            ifup-plusb   net.hotplug
ifcfg-em2 ifdown-ipv6 ifup-aliases    ifup-post    network-functions
ifcfg-em3 ifdown-isdn ifup-bnep       ifup-ppp     network-functions-ipv6
ifcfg-em4 ifdown-post ifup-eth        ifup-routes
 
 
[root@sykvm network-scripts]# cat ifcfg-br0 [S6] 
DEVICE=br0 [S7] 
TYPE=Bridge [S8] 
BOOTPROTO=none [S9] 
ONBOOT=yes [S10] 
IPADDR=192.168.162.100 [S11] 
NETMASK=255.255.255.0 [S12] 
 
 
 
 
 
[root@sykvm network-scripts]# cat ifcfg-br1
DEVICE=br1
TYPE=Bridge
BOOTPROTO=none
ONBOOT=yes
IPADDR=192.168.162.101
NETMASK=255.255.255.0
 
 
[root@sykvm network-scripts]# cat ifcfg-br3
DEVICE=br3
TYPE=Bridge
BOOTPROTO=none
ONBOOT=yes
IPADDR=192.168.162.103
NETMASK=255.255.255.0
 
 
[root@sykvm network-scripts]# cat ifcfg-br4
DEVICE=br4
TYPE=Bridge
BOOTPROTO=none
ONBOOT=yes
IPADDR=192.168.162.104
NETMASK=255.255.255.0
 
 
[root@sykvm network-scripts]# cat ifcfg-em1
DEVICE="em1"
BOOTPROTO="none"
NM_CONTROLLED="yes"
ONBOOT="yes"
TYPE="Ethernet"
USERCTL=no
BRIDGE=br0 [S13] 
 
 
 
[root@sykvm network-scripts]# cat ifcfg-em2
DEVICE="em2"
BOOTPROTO="none"
NM_CONTROLLED="yes"
ONBOOT="yes"
TYPE="Ethernet"
BRIDGE=br1
IPV6INIT=no
USERCTL=no
 
 
[root@sykvm network-scripts]# cat ifcfg-em3
DEVICE="em3"
BOOTPROTO="none"
NM_CONTROLLED="yes"
ONBOOT="yes"
TYPE="Ethernet"
BRIDGE=br3
USERCTL=no
IPV6INIT=no
 
 
[root@sykvm network-scripts]# cat ifcfg-em4
DEVICE="em4"
BOOTPROTO="none"
NM_CONTROLLED="yes"
ONBOOT="yes"
TYPE="Ethernet"
IPV6INIT=no
USERCTL=no
BRIDGE=br4
 
 
 
 
[root@sykvm network-scripts]# ifconfig
br0       Link encap:Ethernet HWaddr D4:AE:52:B1:6E:12 
         
inet addr:192.168.162.100 Bcast:192.168.162.255 Mask:255.255.255.0
        
inet6 addr: fe80::d6ae:52ff:feb1:6e12/64 Scope:Link
         
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
          
RX packets:22736 errors:0 dropped:0 overruns:0 frame:0
         
TX packets:66 errors:0 dropped:0 overruns:0 carrier:0
 collisions:0 txqueuelen:0
         
RX bytes:1069831 (1.0 MiB) 
TX bytes:7053 (6.8 KiB)
 
 
br1       Link encap:Ethernet HWaddr D4:AE:52:B1:6E:13 
          inet addr:192.168.162.101 Bcast:192.168.162.255 Mask:255.255.255.0
          inet6 addr: fe80::d6ae:52ff:feb1:6e13/64 Scope:Link
          UP BROADCAST RUNNING [S14]  MULTICAST MTU:1500 Metric:1
          RX packets:22668 errors:0 dropped:0 overruns:0 frame:0
          TX packets:67 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:1066703 (1.0 MiB) TX bytes:7118 (6.9 KiB)
 
 
br3       Link encap:Ethernet HWaddr D4:AE:52:B1:6E:14  
          inet addr:192.168.162.103 Bcast:192.168.162.255 Mask:255.255.255.0
          inet6 addr: fe80::d6ae:52ff:feb1:6e14/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
          RX packets:22552 errors:0 dropped:0 overruns:0 frame:0
          TX packets:66 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:1060149 (1.0 MiB) TX bytes:7072 (6.9 KiB)
 
 
br4       Link encap:Ethernet HWaddr D4:AE:52:B1:6E:15 
          inet addr:192.168.162.104 Bcast:192.168.162.255 Mask:255.255.255.0
          inet6 addr: fe80::d6ae:52ff:feb1:6e15/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
          RX packets:22455 errors:0 dropped:0 overruns:0 frame:0
          TX packets:66 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:1054467 (1.0 MiB) TX bytes:7091 (6.9 KiB)
 
em1       Link encap:Ethernet HWaddr D4:AE:52:B1:6E:12 
          inet6 addr: fe80::d6ae:52ff:feb1:6e12/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
          RX packets:23783 errors:0 dropped:0 overruns:0 frame:0
          TX packets:497 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:1654087 (1.5 MiB) TX bytes:56517 (55.1 KiB)
          Interrupt:35
 
em2       Link encap:Ethernet HWaddr D4:AE:52:B1:6E:13 
          inet6 addr: fe80::d6ae:52ff:feb1:6e13/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
          RX packets:23650 errors:0 dropped:0 overruns:0 frame:0
          TX packets:479 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:1625841 (1.5 MiB) TX bytes:51093 (49.8 KiB)
          Interrupt:38
 
em3       Link encap:Ethernet HWaddr D4:AE:52:B1:6E:14 
          inet6 addr: fe80::d6ae:52ff:feb1:6e14/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
          RX packets:23963 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1223 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:1778019 (1.6 MiB) TX bytes:245009 (239.2 KiB)
          Interrupt:34
 
em4       Link encap:Ethernet HWaddr D4:AE:52:B1:6E:15 
          inet6 addr: fe80::d6ae:52ff:feb1:6e15/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
          RX packets:24014 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1302 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:1788353 (1.7 MiB) TX bytes:266937 (260.6 KiB)
          Interrupt:36
 
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:42434 errors:0 dropped:0 overruns:0 frame:0
          TX packets:42434 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:40431550 (38.5 MiB) TX bytes:40431550 (38.5 MiB)
 
virbr0     Link encap:Ethernet HWaddr 52:54:00:00:2E:60 
          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:30 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:0 (0.0 b) TX bytes:4246 (4.1 KiB)
 
vnet0     Link encap:Ethernet HWaddr FE:54:00:0D:74:DD 
          inet6 addr: fe80::fc54:ff:fe0d:74dd/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
          RX packets:419 errors:0 dropped:0 overruns:0 frame:0
          TX packets:21331 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:500
          RX bytes:46092 (45.0 KiB) TX bytes:1337493 (1.2 MiB)
 
vnet1     Link encap:Ethernet HWaddr FE:54:00:B3:E3:C5 
          inet6 addr: fe80::fc54:ff:feb3:e3c5/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
          RX packets:1161 errors:0 dropped:0 overruns:0 frame:0
          TX packets:21514 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:500
          RX bytes:235004 (229.4 KiB) TX bytes:1458593 (1.3 MiB)
 
vnet2     Link encap:Ethernet HWaddr FE:54:00:78:DF:C6 
          inet6 addr: fe80::fc54:ff:fe78:dfc6/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
          RX packets:408 errors:0 dropped:0 overruns:0 frame:0
          TX packets:21000 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:500
          RX bytes:42282 (41.2 KiB) TX bytes:1296831 (1.2 MiB)
 
vnet3     Link encap:Ethernet HWaddr FE:54:00:24:65:0C 
          inet6 addr: fe80::fc54:ff:fe24:650c/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
          RX packets:1247 errors:0 dropped:0 overruns:0 frame:0
          TX packets:21366 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:500
          RX bytes:257634 (251.5 KiB) TX bytes:1456195 (1.3 MiB)
 
注意:
1. IP配置在桥接器上,物理网卡em1~4,不需要配置IP。
2. ls命令用于查看目录,类似dir
3. 所有桥接器,物理网卡都必须处于RUNNING状态
4. 每个虚拟机开机后,都会生成一个虚拟网卡vnetX,可以选着每个vnet桥接到哪个桥接器上。(后文有图)
 
 [S1]查看桥接器配置,
 [S2]表示em1桥接到br0上,
即表示,em1接上了br0这台交换机上。
 [S3]将IP配置好后,将虚拟机的虚拟网卡vnet0也接到br0上,这样,em1和vnet0就可以通信了,虚拟机和外界就能互访。
 [S4]网络配置文件所在的目录
 [S5]网卡的配置都是以ifcfg开头的
 [S6]查看br0的网卡配置
 [S7]设备名
 [S8]网络类型为桥接
 [S9]启动协议
 [S10]开机是否自启动
 [S11]IP地址
 [S12]掩码
 [S13]将该网卡桥接到br0上
 [S14]表示网卡正常运行,若无,先检查网线是否插好,再检查是否手动关闭了该网卡,最后检查配置是否正确。