`
cloudtech
  • 浏览: 4613697 次
  • 性别: Icon_minigender_1
  • 来自: 武汉
文章分类
社区版块
存档分类
最新评论

Bridged Networking with Virt-Manager 0.8.3

 
阅读更多

Bridged Networking with Virt-Manager 0.8.3

Bridged networking configuration with virt-manager 0.8.3 has become much simpler compared to earlier versions. The recent release of virt-manager 0.8.3 now adds GUI support for bridged networking, bonding and bridging vlans. In this post I’ll outline the procedure for bridged networking since this will be the most popular use of this new GUI feature. I’ll do a follow up post on bridging vlans which will be more popular within a data center environment. One additional note is that at the time of this writing, this new GUI functionality only supports Red Hat based network configuration files so only distributions such as Fedora and CentOS will be supported by this procedure.

Let me start by saying that when the current release of virt-manager was released a couple of weeks ago, I was looking forward to using the new “interface support”. Then I was disappointed to find the GUI kept reporting the message “Libvirt connection does not have interface support”. I researched the feature set, looked at the code and it seemed I had all the pre-requisites for this feature but this message was the only thing that showed up for me. So right now I’m sitting in a hotel ( accompanying my wife to a conference she’s attending ) writing up this post on how I stumbled upon getting this feature to work. It happened like this. Got to the hotel, booted up my laptop (which runs Fedora 12 now ), connected the hotel provided network cable from my laptop to the socket at side of table. As it turns out this socket was a dead one and I couldn’t understand why I wasn’t getting a connection. So I tried restarting my network service a few times and still nothing. Then I spotted another network wall socket at the back of the table and tried that and it worked. Next I started up virt-manager and configured a new virtual network to NAT my KVM windows guest to the Ethernet interface. I just happened to take a peek at the “Network Interfaces” tab under Edit->Host Details on my virt-manager main window and lo and behold my host interfaces were listed!! I played around with different sequences of starting up network services and virt-manager and only one works for me which is:

  1. If virt-manager is running, close and exit virt-manager. Make sure you exit and don’t just close the main window.
  2. Restart network service.
  3. Start up virt-manager.

You’ll now be able to see your host interfaces listed under Edit->Host Details->Network Interfaces. If you have a different experience with this feature please post a comment as I’m curious about this bug. This may not be the case for remote connections. So once you’ve got your physical host interface listed you will be able to configure bridged networking using the following procedure.

Create bridge and add interface(s) to it

First thing you need to do is create a new bridge and attach your host interface(s) to it. Virt-manager calls your host interfaces “slave interfaces” which is an accurate term to describe what happens. If you have a single Ethernet interface on your host and add this to your new bridge, your host will not have access to your Ethernet interface anymore as it is now uses your new bridge like a gateway. You create a new bridge by clicking on the plus sign at the bottom of the “Network Interfaces” tab.

You’ll get a two step dialog as shown below with a drop down list of options for interface types to create. The first and default in the list is “bridge” which is what you want to create.

After selecting next, virt-manager will name the new bridge that will be created using the convention of brX where X starts at 0 and increments everytime you create a new bridge unless using hotplug mode. You can override this name if you want. You’ll also see a list of of interfaces to add to your new bridge.

If you think you’ll need to add more interfaces then choose hotplug as the start mode. You can also select activate now if you want your bridge to be enabled immediately however this will momentarily disrupt the network interfaces on your host as it goes through the initiation process. The default option of none for start mode and “activate now” option unchecked is so that you don’t unwillingly bring down your network. Click finish and you’re done. If you’ve configured bridged networking before using previous versions of virt-manager as described in this post , you’d have to agree that this is much more automated. Kudos to the virt-manager, libvirt and netcf developers for bringing network configurations this far along.

Start up your newly created bridge

Your new bridge will not be started by default if you used the default options when creating your new bridge. To start up your new bridge, select it in the “Network Interfaces” tab and click the “play” button which is shown in the image below.

You’ll now notice that your bridge is not greyed out anymore. You’ll also notice that if you select any of your physical interfaces attached to your bridge, it will show the status of “In use by: br0”.

Assign physical interface to your guest

The final step in this procedure is assigning your physical interface to your guest. To do this, open up a guest console within virt-manager and click the “Add hardware” button. Next, Select Hardware type of Network and click “Forward”. Virt-manager will now show an option to use your host interface connected to the bridge you just created as shown below. Select this.

Click “Forward” then Finish and you’re all done. At this point you’ll be able to access your guest machine from your local network like any other host on your network. Give this procedure and try and see how it works for you if you’re running a Red Hat based distro. As always, feel free to post questions or comments.

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics