配置 KVM 的橋接

2021-06-28 06:55:31 字數 1257 閱讀 7644

使用如下命令 建立 橋接需要 的 橋:

[root@s14 ~]# brctl addbr br0

[root@s14 ~]# brctl addif br0 em2

[root@s14 ~]# ifconfig up br0

[root@s14 ~]# ifconfig 

br0 

up如果主機環境中沒有dhcp使用如下3條命令

[root@s14 ~]# ifconfig em2 0.0.0..0

[root@s14 ~]# ifconfig br0 172.16.90.14 netmask 255.255.255.0

[root@s14 ~]# route add default gw 172.16.72.1

否則直接使用如下命令

[root@s14 ~]# dhclient br0

em2 替換為本機的物理網絡卡,br0為最後建好的橋

另外需要在虛擬機器中關閉libvertd(如果有開啟的話):

shell> /etc/init.d/libvirtd stop

shell> chkconfig libvirtd off

配置虛擬機器的網路配置檔案:

shell> 

vi /etc/sysconfig/network-scripts/ifcfg-eth0

內容為:

device="eth0"

bootproto="dhcp"

hwaddr="52:54:00:59:c9:47" 

[替換為原配置檔案中的值]

nm_controlled="no"

onboot="yes"

type="ethernet"

uuid="cd704b25-343a-410c-a0dc-22d7b6f76e00" [替換為原配置檔案中的值]

device="eth0"

bootproto="static"

hwaddr="c8:1f:66:de:79:22" 

[替換為原配置檔案中的值]

ipv6init="no"

nm_controlled="yes"

onboot="yes"

type="ethernet"

uuid="e30d42e8-42ad-4e11-91e3-0f0f9e7c8d33" [替換為原配置檔案中的值]

ipaddr=172.16.90.12

netmask=255.255.255.0

gateway=172.16.90.1

kvm配置橋接網絡卡

1.編輯需要橋接的網絡卡檔案 cd etc sysconfig network scripts ifcfg eth0 vim ifcfg eth0 新增以下這行 bridge br0 2.拷貝 etc sysconfig network scripts ifcfg eth0 ifcf br0 dev...

如何給kvm配置橋接

首先檢視自己宿主機的用的是哪個網絡卡我的是enp0s25 進入 etc sysconfig network scripts 建立橋接網絡卡br0 vim ifcfg br0 內容如下 type bridge name br0 橋接網絡卡名 device br0 與網絡卡名相同 onboot yes ...

kvm橋接方案

下面介紹配置kvm橋接網路的方法 特別注意,大部分不能橋接無線網絡卡。只能橋接pci網絡卡。安裝橋接工具 sudo apt get install bridge utils 安裝建立tap介面的工具 sudo apt get install uml utilities 編輯網路介面配置檔案 sudo...