Samba on an LXC container with external USB storage

Goal

The wiki shows how to install a Samba server on an LXC container running under the Alpine OS. In addition, external storage is set up via the USB port for the container and made available for use by the Samba client.

Prerequisites

  • NetModule Wireless Router with wireless connection
  • NetModule Software 5.0.0.101 or newer
  • Not available for legacy products NB1600, NB2700, NB3700, NB3710

The wiki was tested with router software 5.0.0.101 and the LXC container with alpine armhf 3.23


1. Set up the LXC Contianer

Activate the LXC container on the router

In the second step the image of the LXC container in this case a alpine 3.23.

The easiest way to do this is to install the whole thing over the Internet. However, the router requires a mobile connection to the Internet.

From a Jenkins server you get the current image for the container

* Jenkins Server Page image-alpine default / Link

The “armhf” tab is important here

Here you can get a alpine image for 3.21, 3.22, 3.23 or newer.

The image is the “rootfs.tar.xz” which is required. With a right click you can copy the link.

It would be structured like this:

https://jenkins.linuxcontainers.org/view/Images/job/image-alpine/architecture=armhf,release=3.23,variant=default/3550/artifact/rootfs.tar.xz

When the “Apply” button is pressed, Debian will be installed.

Set up the LXC container further. A network interface is enabled here.

The container has now also been assigned an IP address.

USER
~ $ lxc-info guest0 Name: guest0 State: RUNNING PID: 2255 IP: 192.168.1.149 CPU use: 1.57 seconds BlkIO use: 4.00 KiB Memory use: 6.29 MiB KMem use: 1.18 MiB Link: virt0 TX bytes: 2.28 KiB RX bytes: 853 bytes Total bytes: 3.11 KiB ~ $

Always assign a fixed IP address for the LXC container via the DHCP server.

Log in to the LXC container and test whether it can access the Internet.

USER
~ $ lxc-attach guest0 root@LXCNAME:~# ping heise.de PING heise.de (193.99.144.80) 56(84) bytes of data. 64 bytes from redirector.heise.de (193.99.144.80): icmp_seq=1 ttl=244 time=42.4 ms 64 bytes from redirector.heise.de (193.99.144.80): icmp_seq=2 ttl=244 time=31.0 ms 64 bytes from redirector.heise.de (193.99.144.80): icmp_seq=3 ttl=244 time=27.1 ms — heise.de ping statistics — 3 packets transmitted, 3 received, 0% packet loss, time 2005ms rtt min/avg/max/mdev = 27.116/33.504/42.432/6.505 ms root@LXCNAME:~#

The container is installed and set up. Now you can set up further tools on the container.


2. Adjust the LXC config so that the USB port can be used in the container.

Enable USB administration on the router