Multiple virtual servers (LXC containers) possible?


#62

@Leonardo

this is what I did (hopefully I remember all the steps)

  1. Set the root password in container (use lxc-attach)

  2. Configure the lxc config file like:

    lxc.network.type = veth
    lxc.network.link = br-servers
    lxc.network.flags = up
    lxc.network.name = eth1
    lxc.network.hwaddr=00:16:3e:f8:7a:bc
    `
    br-servers is name of my VLAN for LXC server - you can use the standard br-lan. Important thing is to change the network.name to eth1 as WAN in TO maps to eth1. The MAC address is added to assign the same IP address

  3. Configure IP address for WAN interface (probably via DHCP from TO) in /srv/lxc//rootfs/etc/config/network - something like:

    config interface 'wan’
    option ifname 'eth1’
    option proto 'dhcp’
    option macaddr ‘00:16:3e:f8:7a:bc’
    `

  4. Configure firewall to open port 80 so that you can get to it. Something like this in /srv/lxc//rootfs/etc/config/firewall:

    config rule
    option src 'wan’
    option dest_port '80’
    option target 'ACCEPT’
    option proto ‘tcp’
    `

Then you should be able to access the Foris/Luci on the IP address assigned to the WAN interface from your LAN.


#63

The Wan interface is down in the Lxc image. It won’t get an ip. In the initial Turris setup, the wan is configured using the web interface.
It doesn’t work out of the box like other containers.
It has its own bridge with the same range of the host Omnia too.


#64

I wanted to try your suggestion, but, unfortunately, there is no lxc-execute in /usr/bin (or elsewhere) on Turris Omnia :frowning:


#65

It is not installed by default but opkg install lxc-execute should install it.


#66

Tried it, to no avail:

root@turris:~# opkg install lxc-execute
Unknown package ‘lxc-execute’.
Collected errors:

  • opkg_install_cmd: Cannot install package lxc-execute.

#67

Did you try opkg update first and then install?

It should work. Package: “lxc-execute” is in TurrisOS repo.


#68

Thanks for hint! Seems to work :wink:

root@turris:~# opkg update
root@turris:~# opkg install lxc-execute
Installing lxc-execute (1.1.5-9) to root…
Downloading https://repo.turris.cz/omnia/packages//packages/lxc-execute_1.1.5-9_mvebu.ipk
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 3998 100 3998 0 0 55510 0 --:–:-- --:–:-- --:–:-- 57114
Configuring lxc-execute.

SFSG

Anyhow, need to investigate little bit more :frowning: (at first, container seems not to be running :wink:

  • lxc-execute -n KontUb apt-get update
    lxc-execute: execute.c: execute_start: 67 Failed to find an lxc-init or init.lxc
    lxc-execute: sync.c: __sync_wait: 51 invalid sequence number 1. expected 4
    lxc-execute: start.c: __lxc_start: 1192 failed to spawn ‘KontUb’

  • lxc-execute -n KontUb apt-get upgrade
    lxc-execute: execute.c: execute_start: 67 Failed to find an lxc-init or init.lxc
    lxc-execute: sync.c: __sync_wait: 51 invalid sequence number 1. expected 4
    lxc-execute: start.c: __lxc_start: 1192 failed to spawn 'KontUb’
    lxc-execute: cgfs.c: cgroup_rmdir: 207 Resource busy - cgroup_rmdir: failed to delete /sys/fs/cgroup/lxc/KontUb

:wink:


#69

I have tried mksquashfs on LXC rootfs, but I couldn’t mount it… dmesg wrote:
squashfs: SQUASHFS error: Filesystem uses "zlib" compression. This is not supported
but I installed kmod-lib-zlib and zlib. So i tried another compression where I found openwrt support. But nothing fine. Do you have any idea?