In previous posts you can find instructions on how to configure
bridged networking when managing your kvm guests by command line.
However for many users experimenting with kvm, the virt-manager GUI tool
is the preferred method of managing kvm guests in which case bridged
networking configuration might pose a challenge. If you fall into the
camp of users who prefer virt-manager and have ever wondered how to
configure bridged networking , you’ll be able to use bridged networking
with virt-manager after reading this post.
1. Configure your bridge
Your libvirt installation will provide default bridges for use with
xen, qemu and other types of domains. For qemu/kvm, the default bridge
should be called vnet0 and you can verify this by issuing the following
command on your system.
# brctl show
不同的机器可能有些差异,可能只显示一个virbr0,灵活处理就行了,可以自己新建一个vnet0,之后就可以完全按照下面的方法来进行了。
bridge name bridge id STP enabled interfaces
pan0 8000.000000000000 no
virbr0 8000.000000000000 yes
vnet0 8000.000000000000 yes
Th first thing you
need to do is add a network script for your vnet0 bridge. On Fedora this
script will be located under /etc/sysconfig/network-scripts/ but may
differ for other linux distributions. So go ahead and create a new
script at /etc/sysconfig/network-scripts/ifcfg-vnet0 as root user and
edit the contents so that it looks like the following.
DEVICE=vnet0
TYPE=Bridge
BOOTPROTO=dhcp
ONBOOT=yes
This completes set up of your vnet0 bridge.
2. Add your physical interface to the bridge
The next step is to add the physical interface that your kvm guest
will be sharing to the vnet0 bridge configured above. For this post,
we’ll assume that you’ll be using eth0 so to add eth0 to vnet0 bridge,
issue the following command.
# brctl addif vnet0 eth0
You can verify that your eth0 was added to the vnet0 bridge
issuing the brctl show command. Your output should look similar to the
following.
# brctl show
bridge name bridge id STP enabled interfaces
pan0 8000.000000000000 no
virbr0 8000.000000000000 yes
vnet0 8000.0019b97ec863 yes eth0
Now
you need to configure your network script for eth0. You will already
have a script for eth0, but you’ll need to modify it by adding one line
as BRIDGE=vnet0 so that it looks similar to the following script.
# Broadcom Corporation BCM4401-B0 100Base-TX
DEVICE=eth0
BRIDGE=vnet0
BOOTPROTO=dhcp
HWADDR=00:19:b9:7e:c8:63
ONBOOT=yes
TYPE=Ethernet
USERCTL=no
IPV6INIT=no
PEERDNS=yes
NM_CONTROLLED=no
…
…
3. Restart your network services
In order for all the network script modifications to take effect, you
need to restart your network services. Your command may differ
slightly but for most linux distributions the following command will
restart your network services.
# /etc/rc.d/init.d/network restart
Shutting down interface vnet0: [ OK ]
Shutting down interface eth0: [ OK ]
Shutting down loopback interface: [ OK ]
Bringing up loopback interface: [ OK ]
Bringing up interface eth0: [ OK ]
Bringing up interface vnet0:
Determining IP information for vnet0... done.
[ OK ]
My experience is that the dhcp on the bridge device
usually takes a little longer than the other scripts so don’t worry if
the line that says “determining ip information for vnet0” sits there for
a min or two. Once this script completes, you’re finished with your
system network configurations. Now, onto actually using bridged
networking with virt-manager.
4. Configure Bridged Networking in Virt-Manager
Now comes the easy part. Configure your kvm guest in virt-manager as
you normally would. When you get to the part that asks about your
network type, choose to share with a physical device and you will be
able to select the eth0 on bridge vnet0. Below is a screenshot of what
you should see. You don’t need to specify a specific mac address unless
you need to for some kind of static mapping.
Boot up your kvm guest which will be now connected to your local
network. Your brctl show command will now show your kvm guest network
added to your vnet0 bridge. Below is a sample output.
# brctl show
bridge name bridge id STP enabled interfaces
pan0 8000.000000000000 no
virbr0 8000.000000000000 yes
vnet0 8000.0019b97ec863 yes eth0
vnet1
分享到:
相关推荐
VMware中bridged、NAT和host-only.区别
Synthesis and Characterizations of Strongly Phosphorescent Copper(I) Halide Complexes with Bridged Bis[2-(diphenylphosphino)phenyl]ether Ligand
bridged、host-only和NAT的技术.pdf
VMWare虚拟机bridged、host-only和NAT网络模式的区别和用法
理解VMWare的三种网络连接模式(bridged、NAT、host-only)
理解VMWare的三种网络连接模式(bridged、NAT、host-only).pdf
节点红色贡献家庭套件桥接 您需要设置方面的帮助吗? 加入我们的Discord服务器(单击下面的徽标)! :warning: 警告 :warning: 升级之前,请确保您使用的是最新版本的和最新的LTS版本的 从版本0.X升级到1.X是一项...
网络连接,有此三种类型(我从中文搞成专业的英文,呵呵):NAT,Bridged Adapter ,Host-only Adapter。 那就是这三种模式,决定啦你的虚拟机之间是否可以通信,虚拟机与主机之间是否可以通信,同时也缓解啦IP4的...
We propose a two-cascaded, constant-resistance, symmetrical bridged-T amplitude equalizer for a high-speed visible light communication (VLC) system. With the pre-equalization circuit, the -3 dB ...
IEEE Standard for Local and metropolitan area networks Virtual Bridged Local Area Networks-Amend.4-Provider Bridges
这个文档是我上网搜到的各种相关文献的总结版,但是其中的内容都经过本人的验证过,而且非常准确,不明白大家一起交流936061832@qq.com
Crystal Structure and Properties of a New 2, 2'-Ortho(metaxylene) E-Bridged Stilbenophane Crystal Structure and Properties of a New 2,2’-Ortho(metaxylene) E-Bridged Stilbenophane Maryam Mirza-...
ISO IEC IEEE 8802-11:2020 AMENDMENT 4:Enhancements for transit links within bridged network - 完整英文电子版(98页).pdf
(即将推出) (@ bridged.xyz / remote-ui) 扑 子包 动态动作 安装 服务器端 # install with yarn yarn add @bridged.xyz/remote-ui-core # install with npm npm install @bridged.xyz/remote-ui-core ...
Crystal Structure and Properties of a New 2, 2'-Ortho(metaxylene) E-Bridged Stilbenophane Crystal Structure and Properties of a New 2,2’-Ortho(metaxylene) E-Bridged Stilbenophane Maryam Mirza-...
VMware 網路設定介紹 Bridged Networking Network Address Translation (NAT) Host Only Networking Custom Networking Configurations
IOS 10 Programming Fundamentals with Swift: Swift, Xcode, and Cocoa Basics by Matt Neuburg English | ISBN: 1491970073 | 2016 | PDF | 518 pages | 7 MB Move into iOS development by getting a firm ...