[libvirt-users] Static DHCP assignments to VMs connected to bridge

Sam Varshavchik mrsam at courier-mta.com
Mon Jan 29 01:33:32 UTC 2018


Dagmawi Biru writes:

> « HTML content follows »
>
> Hello libvirt-users,
>
>
> Given the following setup:
> ---
> [Rest of network/dhcp server] ------[ physical interface] ------ [ bridge]   
> <----> |  <--->  [ VM ]
>
>
>
>
>
>
> I have an interface configured in my Domain XML like so:
> ---
> <interface type="bridge">
>     <source bridge="br20">
> </interface>
>
>
>
>
>
>
> Bridge "br20" is connected to an external network that has a DHCP server.  
> However, I want to set it so the interface for this VM has a static IP served  
> to it, either by a locally running DHCP server or via some sort of static IP  
> assignment in the XML configuration. Is this possible?

I have a DHCP server running on my LAN that defines a static mapping for my  
client VMs.

If you already have a DHCP server on my LAN, and you have your client VMs  
correctly bridged, and your DHCP server sees them, then it's a simple matter  
of configuring your DHCP server.

Looking at my domain XML configuration, what I have is:

    <interface type='bridge'>
      <mac address='52:54:00:1d:a4:c2'/>
      <source bridge='vnet0'/>
      <model type='rtl8139'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
    </interface>

Then, I just assign a static IP address mapping for this MAC address, on my  
LAN's DHCP server.

If you don't have a DHCP server, you simply have to have your client VM  
configured, in the client, with a fixed IP address. The client VM sees a  
network port, and it is up to the client VM to set it up. libvirt is out of  
the picture here.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 801 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvirt-users/attachments/20180128/c877f6d5/attachment.sig>


More information about the libvirt-users mailing list