Force an LXC container to use its own IP address
- by emma sculateur
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>