[libvirt-users] assign static external IP to container

Gao feng gaofeng at cn.fujitsu.com
Fri Dec 13 05:18:26 UTC 2013


On 12/13/2013 12:33 PM, scar wrote:
> Gao feng @ 12/11/2013 01:49 AM:
>> I have a machine running libvirt lxc,
>> on this machine(host), the network configure looks like this
>> eth0 is the physical nic, virbr0 is the bridge libvirt created, and vnet0
>> is the veth device created for libvirt lxc container. you can see, the eth0
>> is a port of virbr0, and the ip is assigned on virbr0.
>>
>> [snip]
>>
>> And in container
>>
>> I change the ip of eth0 to 192.168.122.33 and add a route rule
>> ip route add default via 192.168.122.1 dev eth0
>>
>> then the container can access the outside.
>>
>> I think it should work even you change the 192.168.x.x to the
>> global ip.
> 
> arrg thank you but this is all so confusing to me ><
> 
> this is what my ifconfig and brctl show looks like on host machine:
> http://pastebin.com/9f1HzXi5
> 
> i want to use 67.180.246.123 for the container
> 

I saw there are two bridge br0 and virbr0 in your host.
which bridge the libvirt uses?  what's result of #virsh net-list ?

I think you may setup the wrong bridge. try to set ip for virbr0 and
make eth0 as a port of virbr0.




More information about the libvirt-users mailing list