LXC Container with Bridged Network from Host
LXC HOST: UBUNTU Server 13.04
GNU/Linux 3.8.0-25-generic x86_64
UPDATE & UPGRADE 1ST!!
sudo apt-get update -f
sudo apt-get upgrade
Install LXC and OpenSSH Server
(sever editions can skip silliness & build a bridge)
GNU/Linux 3.8.0-25-generic x86_64
UPDATE & UPGRADE 1ST!!
sudo apt-get update -f
sudo apt-get upgrade
Install LXC and OpenSSH Server
sudo apt-get install lxc openssh-serverDisable & Stop Network Manager
(sever editions can skip silliness & build a bridge)
sudo service network-manager stopBridge Interfaces & Assign Static IP
sudo nano /etc/NetworkManager/NetworkManager.conf
managed=true
sudo nano /etc/network/interfacesBounce Interfaces & Restart Network Services
iface eth0 inet manual
auto br0
iface br0 inet static
address 192.168.27.18
network 192.168.27.0
netmask 255.255.255.0
broadcast 192.168.27.255
gateway 192.168.27.1
bridge_ports eth0
bridge_fd 9
bridge_hello 2
bridge_maxage 12
bridge_stp off
dns-nameservers 192.168.27.1 8.8.8.8 8.8.4.4
sudo ifdown eth0Edit Default LXC Config & Create a new container
sudo ifup br0
sudo service networking restart
sudo nano /etc/lxc/default.confStart Container (get IP, test, & shutdown)
lxc.network.link=br0
sudo lxc-create -t ubuntu -n zap00
sudo lxc-start -n zap00Start Container (daemon mode)
Login: ubuntu
Password: ubuntu
ubuntu@zap00:~$ ifconfig eth0
eth0 Link encap:Ethernet HWaddr 00:16:3e:be:52:14
inet addr:192.168.27.19 Bcast:192.168.27.255 Mask:255.255.255.0
inet6 addr: fe80::216:3eff:febe:5214/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:2313 errors:0 dropped:0 overruns:0 frame:0
TX packets:118 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:341585 (341.5 KB) TX bytes:16671 (16.6 KB)
ubuntu@zap00:~$ ping www.google.com
PING www.google.com (173.194.75.99) 56(84) bytes of data.
64 bytes from ve-in-f99.1e100.net (173.194.75.99): icmp_req=1 ttl=250 time=20.1 ms
ubuntu@zap00:~$ sudo shutdown -h now
billreed@macbook:~$ sudo lxc-start -d -n zap00ZAP00 Container Host: SSH into the container
billreed@macbook:~$ ssh ubuntu@192.168.27.19Quick Install of Webmin (just for fun... why not?)
ubuntu@192.168.27.19's password: ubuntu
ubuntu@zap01:~$ _
sudo apt-get install perl libnet-ssleay-perl openssl libauthen-pam-perl libpam-runtime libio-pty-perl apt-show-versions python wget
wget http://prdownloads.sourceforge.net/webadmin/webmin_1.690_all.deb
sudo dpkg -i webmin_1.690_all.debNow you can access https://192.168.27.19:10000/ from another computer on the same network.
Comments
Post a Comment