為linux下的kvm添加bridge網卡 vmware是windows下使用的虛擬機器,安裝好後,系統中會自動添加vmnet0,vmnet1,vmnet8這幾個網卡,分別對應bridge,host-only,nat這三種網路模式。
kvm是linux下使用的虛擬機器,安裝kvm選擇網路時預設只有nat網路可以選擇,而bridge模式不可以選擇,原因是沒有相應的bridge網卡。想讓kvm使用bridge網路的話,就要在系統中添加bridge網卡,下面是添加步驟: # cd /etc/sysconfig/network-scripts/# cp ifcfg-eth0 ifcfg-eth0.bak# cp ifcfg-eth0 ifcfg-bridge --準備將網卡eth0橋接到bridge網路上去# cat ifcfg-eth0DEVICE=eth0BOOTPROTO=noneHWADDR=00:0c:29:80:85:4aNM_CONTROLLED=noONBOOT=yesTYPE=EthernetUUID="f977c574-43a0-4e17-93d0-832b4e41f016"IPADDR=192.168.1.102NETMASK=255.255.255.0IPV6INIT=noUSERCTL=noifcfg-bridge 這個檔案對比ifcfg-eth0進行修改,所以先cat一下,注意修改地方 # vi ifcfg-bridge DEVICE=bridge --修改名字BOOTPROTO=none#HWADDR=00:0c:29:80:85:4a --注釋或刪除此行NM_CONTROLLED=noONBOOT=yesTYPE=Bridge --修改bridge網路類型#UUID="f977c574-43a0-4e17-93d0-832b4e41f016" --注釋或刪除此行IPADDR=192.168.1.102NETMASK=255.255.255.0IPV6INIT=noUSERCTL=no....................................................# vi ifcfg-eth0DEVICE=eth0BOOTPROTO=noneHWADDR=00:0c:29:80:85:4aNM_CONTROLLED=yesONBOOT=yesTYPE=EthernetUUID="f977c574-43a0-4e17-93d0-832b4e41f016"IPADDR=192.168.1.102NETMASK=255.255.255.0IPV6INIT=noUSERCTL=noBRIDGE=bridge --添加這行 # sevice network restart # ip a 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue state UNKNOWN link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 inet 127.0.0.1/8 scope host lo inet6 ::1/128 scope host valid_lft forever preferred_lft forever2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000 link/ether 00:0c:29:80:85:4a brd ff:ff:ff:ff:ff:ff inet6 fe80::20c:29ff:fe80:854a/64 scope link valid_lft forever preferred_lft forever3: bridge: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UNKNOWN link/ether 00:0c:29:80:85:4a brd ff:ff:ff:ff:ff:ff inet 192.168.1.102/24 brd 192.168.1.255 scope global bridge inet6 fe80::20c:29ff:fe80:854a/64 scope link valid_lft forever preferred_lft forever linux下birdge網路添加成功,下面安裝kvm時就可以選擇bridge網路組建區域網路了。