This document is based on:
- Tux4u®/Penguin Suite: PS-wheezy
- PS-app: emu-lxc 1.0.4
More info:
LXC Introduction: LXC Networking scenarios
## /etc/network/interfaces # The primary network interface #allow-hotplug eth0 # auto eth0 # iface eth0 inet dhcp # LXC eth0 bridge auto br0=br0-bridge iface br0-bridge inet static address 192.168.1.101 netmask 255.255.255.0 network 192.168.1.0 broadcast 192.168.1.255 gateway 192.168.1.254 dns-nameservers 192.168.1.254 dns-search mydom.com bridge_ports eth0 bridge_fd 0 bridge_maxwait 0
This config file preconfigures a new LXC Container with a Virtual Ethernet device:
lxc.network.type = veth lxc.network.flags = up lxc.network.link = br0
# lxc-create -n Container_name -f /etc/lxc/veth-br0.conf -t debian
The “debian” template script creates a full functional Debian system for the LXC Container. This Debian system is capable of configuring it own network.
By default the Debian Container configures its “eth0” interface using DHCP.
If you need a fixed IP-address configuration:
Edit “etc/network/interfaces” and comment out the “eth0” lines:
## /etc/network/interfaces auto lo iface lo inet loopback ## Comment out when using a fixed IP-address # auto eth0 # iface eth0 inet dhcp
Define a fixed IP configuration in the Container's “config” file:
## /var/lib/lxc/Container_name/config lxc.network.ipv4 = 192.168.1.102/24 lxc.network.ipv4.gateway = 192.168.1.254
Start the Container in deamon mode (-d): 1)
# lxc-start -n Container_name -d
Copyright © 2014 Integrated Services; Tux4u.nl
Author: Marjan Waldorp; lxc/lxc-simplebridge 2014-09-01