Make LXC aware of custom bridge

This commit is contained in:
Guillaume J. Charmes 2013-04-03 15:05:03 -07:00
parent 90a6e310fe
commit d9a9bfc9c7
2 changed files with 3 additions and 1 deletions

View File

@ -135,6 +135,7 @@ type NetworkSettings struct {
IpAddress string
IpPrefixLen int
Gateway string
Bridge string
PortMapping map[string]string
}
@ -491,6 +492,7 @@ func (container *Container) allocateNetwork() error {
}
}
container.network = iface
container.NetworkSettings.Bridge = container.runtime.networkManager.bridgeIface
container.NetworkSettings.IpAddress = iface.IPNet.IP.String()
container.NetworkSettings.IpPrefixLen, _ = iface.IPNet.Mask.Size()
container.NetworkSettings.Gateway = iface.Gateway.String()

View File

@ -16,7 +16,7 @@ lxc.utsname = {{.Id}}
# network configuration
lxc.network.type = veth
lxc.network.flags = up
lxc.network.link = lxcbr0
lxc.network.link = {{.NetworkSettings.Bridge}}
lxc.network.name = eth0
lxc.network.mtu = 1500
lxc.network.ipv4 = {{.NetworkSettings.IpAddress}}/{{.NetworkSettings.IpPrefixLen}}