[Lxc-users] LXC Container: Network Configuration
Patrick Kevin McCaffrey
pkm at uwm.edu
Wed Nov 30 01:27:42 UTC 2011
Alright, I've been struggling with LXC for several days now. I can't seem to get a container configured properly. I originally was trying to set up a few Ubuntu Oneiric containers, but am now just trying to get a Debian template container set up using the lxc-debian script that comes with lxc.
The container runs, and I can log in to it via SSH from the host machine.
The host machine also runs as my router, as it has a 4 port ethernet card (four subnets, DHCP running on each). However, I cannot SSH into my container from another computer on the local network -- it is only accessible via the host machine. If I try to SSH from another machine, it says "no route to host." Additionally, the container does not have internet access. If I try to ping, use wget or apt, I get connection errors. I'm assuming these two problems are related.
I've got my local network set up using Shorewall, and it works reasonably well for everything else (the entire local network is on the "local" zone, which is completely open). The host's etc/network/interfaces file sets up the five ethernet interfaces (eth0-eth3 with static IPs and eth4 with DHCP from the cable modem) as well as the bridge for lxc. The following is my bridge entry:
#bridge for LXC
iface br0 inet static
address 192.168.80.1
netmask 255.255.255.0
broadcast 192.168.80.255
network 192.168.80.0
bridge_ports eth1
I had some other options designated, but have been playing with my configurations to see if I can get a better result.
Also, what is the correct method to bring up my bridge? It seems like when I run /etc/init.d/netwokring restart, it will come up as it should sometimes, but sometimes gives me problems, like "eth1 is not a slave of br0."
The container appears to run as it should, but I really need it to have proper networking to fulfil my needs. Any ideas?
Pat
More information about the lxc-users
mailing list