Force an LXC container to use its own IP address

Posted by emma sculateur on Server Fault See other posts from Server Fault or by emma sculateur
Published on 2014-06-02T21:03:26Z Indexed on 2014/06/02 21:30 UTC
Read the original article Hit count: 331

Sorry if this question has already been asked. I could not find it, I have this setup :

+---------------------------------------------------------------------------------------------+
|HOST                                                                                         |
|                                                                                             |
| +-------------------------------------------------+                                         |
| | UBUNTU-VM                                       |                                         |
| |                                                 |                                         |
| | +-------------------+                           |                                         |
| | |UBUNTU-LXC         |                           |                   +------------------+  |
| | |       10.0.0.3/24 |  10.0.0.1/24              |                   |OTHER VM          |  |
| | |               eth0-----lxcbr0----------eth0-----------br0----------eth0              |  |
| | |                   |           192.168.100.2/24|  192.168.100.1/24 |192.168.100.3/24  |  |
| | +-------------------+                           |                   +------------------+  |
| +-------------------------------------------------+                                         |
+---------------------------------------------------------------------------------------------+

When I ping 192.168.100.3 from my UBUNTU-LXC, the source IP address is automatically changed to 192.168.100.2 by UBUNTU-VM. It's like having a NAT, whereas I really want my UBUNTU-LXC to talk with it own IP address. Is there any way to do this ?

Edit : these info may be relevant :

  • I am using KVM +libvirt to set up my VMs
  • Here is how I create my interface in UBUNTU-VM

:

<interface type='bridge'>                                                    
  <mac address='52:54:00:cb:aa:74'/>                                         
  <source bridge='br0'/>                                                     
  <model type='e1000'/>                                                      
 <address type='pci' domain='0x0000' bus='0x00' slot='0x09' function='0x0'/>
</interface>                                                                 

© Server Fault or respective owner

Related posts about ip

Related posts about kvm-virtualization