[lxc-users] make a nginx webserver in a lxc container available to the local wireless lan

Mark Constable markc at renta.net
Tue Dec 8 12:06:04 UTC 2015


On 08/12/15 18:07, Eldon Kuzhyelil wrote:
> Okay i am now doing doing it with ethernet. So basically i am trying to
>  setup a webserver in my lxc container and my system is connected to router
>  via ethernet cable.I want the web page to be visible from my another system
>  connected to this LAN. What i have done right now is this
>
> vi /etc/network/interfaces
>
> auto lo
> iface lo inet loopback

Slightly altered from the link I posted before...

auto eth0
iface eth0 inet manual

auto lxcbr0
iface lxcbr0 inet static
    address 192.168.0.2
    netmask 255.255.255.0
    gateway 192.168.0.1
    dns-nameserver 192.168.0.2
    bridge_ports eth0

And if you have multiple bridges on your LAN network then add...

    bridge_stp on

The above presumes you have disabled lxc starting it's own lxcbr0 bridge, and
NetworkManager, on your laptop and running a dedicated dnsmasq on 192.168.0.2
to provide DNS and DHCP for your containers (which may also involve disabling
the DHCP server on your router). With this approach you can use a single
/etc/dnsmasq.conf config file to control both DNS and DHCP assignments for
your entire local LAN network including containers on any LAN server (as long
as 192.168.0.2 is visible) plus a bonus external DNS cache for the entire LAN
if every machine or container uses 192.168.0.2 as its nameserver.



More information about the lxc-users mailing list