lost and found ( for me ? )

Ubuntu LXC : use bridge network

small tips.
# lxc-version
lxc version: 0.9.0

# tail -1 /etc/lsb-release
DISTRIB_DESCRIPTION="Ubuntu 13.04"

# uname -ri
3.8.0-25-generic x86_64

make a bridge network and associate that bridge (br0) with a physical link(eth0).

physical link : eth0
bridge network I made : br0
auto eth0
iface eth0 inet manual

auto br0
iface br0 inet static
       address 192.168.100.15
       netmask 255.255.255.0
       network 192.168.100.0
       gateway 192.168.100.254
       bridge_ports eth0
       bridge_stp off
       bridge_fd 0
       bridge_maxwait 0

restart network
# /etc/init.d/networking restart

edit existing containers configuration(/var/lib/lxc/< container name>/config ) to have those containers use the bridge network br0 which is associated with eth0.

container name : ubuntu-cn1
# less /var/lib/lxc/ubuntu-cn1/config
# Template used to create this container: ubuntu
# Template script checksum (SHA-1): 6f468a9a658112f6420fb39d2ab90a80fd43cd22

lxc.network.type = veth
lxc.network.hwaddr = MAC address
#lxc.network.link = lxcbr0
lxc.network.link = br0

edit LXC’s config ( default.conf ) to have containers which I build next time use bridge network.
# less /etc/lxc/default.conf
lxc.network.type = veth
#lxc.network.link = lxcbr0
lxc.network.link = br0
lxc.network.flags = up

2 comments:

  1. What are various purposes for which we can use bridge network?

    Thanks
    Silvester Norman

    Change Mac Address

    ReplyDelete
  2. containers are visable from outside a LXC host when using bridge device(br0).
    ( container's IP addresses are the same network of the the LXC host network)

    Thanks
    Shigehiro

    ReplyDelete

Note: Only a member of this blog may post a comment.