I am using LXC (Linux Containers) to host an http server within a VirtualBox setup, but the simple LXC specific bridge I created does not have an IP address, so it cannot be reached even in the Ubuntu OS running on VirtualBox. (I don't need to reach the server from the real host OS, but I am mentioning it for completeness)
I tried two methods, first is editing /etc/network/interfaces:
auto lxcbr0
iface lxcbr0 inet dhcp
bridge_ports eth0
bridge_stp off
bridge_fd 0
bridge_maxwait 0
There is no special setting for LXC.
Second one is use brctl:
sudo brctl addbr lxcbr0
sudo brctl addif lxcbr0 eth0
sudo ip link set dev lxcbr0 up
In the first method, for LXC, ifconfig shows:
eth0 Link encap:Ethernet HWaddr 00:16:3e:e7:2c:8f
inet addr:10.0.2.26 Bcast:10.0.2.255 Mask:255.255.255.0
inet6 addr: fe80::216:3eff:fee7:2c8f/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:42 errors:0 dropped:0 overruns:0 frame:0
TX packets:29 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:6146 (6.1 KB) TX bytes:2666 (2.6 KB)
But at host, there is no :
lxcbr0 Link encap:Ethernet HWaddr 08:00:27:2b:85:76
inet6 addr: fe80::a00:27ff:fe2b:8576/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:168 errors:0 dropped:0 overruns:0 frame:0
TX packets:56 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:9826 (9.8 KB) TX bytes:8968 (8.9 KB)
vethFEBAAO Link encap:Ethernet HWaddr fe:5c:88:b0:88:3b
inet6 addr: fe80::fc5c:88ff:feb0:883b/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:33 errors:0 dropped:0 overruns:0 frame:0
TX packets:51 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:3026 (3.0 KB) TX bytes:7041 (7.0 KB)
There is no IPv4 address for the bridge at host side. The second method has similar problem as well.
What am I missing?