[fedora-virt] bridged guest networking in f12 with netcf

Cole Robinson crobinso at redhat.com
Mon Nov 16 13:05:26 UTC 2009


On 11/15/2009 04:10 PM, Dale Bewley wrote:
> Hello all,
> 
> I started a blog post about experimenting with netcf and configuring a guest to share the same subnet as the host. It turned into something a bit longer and more rambling of course.
> 
> * http://tofu.org/drupal/node/86
> 
> At any rate I ran into a few issues while using:
>  virt-manager-0.8.0-7.fc12.noarch
>  netcf-0.1.4-1.fc12.x86_64
>  libvirt-0.7.1-15.fc12.x86_64
> 
> = Virt-manager =
> I mentioned this one on the virt-tools list already. Virt-manager describes a routed network as a NAT network.
> 

Fixed now, as mentioned on virt-tools.

> = Bridge =
> Another issue was an error while using virsh iface-define. 
> 
> Given br0.xml:
> <interface type='bridge' name='br0'>
>   <start mode='onboot'/>
>   <protocol family='ipv4'>
>     <ip address='10.10.10.158' prefix='24'/>
>     <route gateway='10.10.10.254'/>
>   </protocol>
>   <bridge>
>     <interface type='ethernet' name='eth0'>
>       <mac address='00:24:E8:30:20:E7'/>
>     </interface>
>   </bridge>
> </interface>
> 
> [root at tofu2 network-scripts]# virsh iface-define br0.xml
> error: Failed to define interface from br0.xml
> error: invalid argument in virGetInterface
> 
> It did work however.
> 

There were several bug fixes in this code in libvirt recently, so hopefully a
later version will address that error.

> [root at tofu2 network-scripts]# cat ifcfg-eth0
> DEVICE=eth0
> HWADDR=00:24:E8:30:20:E7
> ONBOOT=yes
> BRIDGE=br0
> TYPE=Ethernet
> BOOTPROTO=dhcp
> PEERDNS=yes
> PEERROUTES=yes
> NAME="System eth0"
> UUID=5fb06bd0-0bb0-7ffb-45f1-d6edd65f3e03
> 
> [root at tofu2 network-scripts]# cat ifcfg-br0
> DEVICE=br0
> ONBOOT=yes
> TYPE=Bridge
> BOOTPROTO=none
> IPADDR=10.10.10.158
> NETMASK=255.255.255.0
> GATEWAY=10.10.10.254
> 
> But now eth0 is missing from iface-list
> 
> [root at tofu2 network-scripts]# virsh iface-list
> Name                 State      MAC Address
> --------------------------------------------
> lo                   active     00:00:00:00:00:00
> 
> Presumably, that's because from the libvirt / netcf perspective (which is just looking at the ifcfg files) I have replaced it with the br0 interface. However, br0 is not started, so presumably that's why it isn't listed either. After a 'service network restart' things look sane again.
> 
> [root at tofu2 network-scripts]# virsh iface-list
> Name                 State      MAC Address
> --------------------------------------------
> br0                  active     00:24:e8:30:20:e7
> lo                   active     00:00:00:00:00:00
> 
> 

Probably want to try iface-list --all here, should list inactive interfaces.

> = Network =
> And finally, after creating this bridge, it would be nice to create a network which utilizes it as follows. That fails the way I attempted to do it.
> 
> [root at tofu2 ~]# cat net-bridged.xml 
> <network>
>   <name>bridged</name>
>   <forward mode='route'/>
>   <bridge name='br0' />
> </network>
> 

Physical device bridges are referenced directly in the VM xml, not via the
virtual network XML. Example interface device block to add to your VM:

      <interface type='bridge'>
        <source bridge='br0'/>
        <mac address="11:22:33:44:55:66"/>
      </interface>

- Cole




More information about the virt mailing list