Install

Prev Next

Installation of the Packetscope2 LXC Container is as follows

Step 1) Download the LXC

Download the latest LXC from the Container download directory

https://static.fmad.io/container.html#pscope2

Step 2) Untarball

copy the tarball to

/opt/fmadio/lxc

This will require sudo access

then extract the LXC as follows

tar xfzv pscope2-20250221-0855.tar.gz

Example output

root@fmadio100v2-228U:/mnt/store0/lxc/lib/lxc# tar xfzv pscope2-20250221-0855.tar.gz
pscope2-20250221-0855/
pscope2-20250221-0855/fmadiocli-start.lua
pscope2-20250221-0855/log/
pscope2-20250221-0855/log/clickhouse/
pscope2-20250221-0855/log/clickhouse/clickhouse-server.err.log
pscope2-20250221-0855/log/clickhouse/stdout.log
pscope2-20250221-0855/log/clickhouse/clickhouse-server.log
pscope2-20250221-0855/log/clickhouse/stderr.log
pscope2-20250221-0855/log/omclickhouse-log/
pscope2-20250221-0855/log/omclickhouse-log/omclickhouse-syslog
pscope2-20250221-0855/log/pscope2/
pscope2-20250221-0855/log/grafana/
pscope2-20250221-0855/log/grafana/grafana.log
pscope2-20250221-0855/log/remote/
pscope2-20250221-0855/log/remote/fmadio20v3-333-ubuntu22/
pscope2-20250221-0855/log/remote/fmadio20v3-333-ubuntu22/keyboard-setup.sh.log
pscope2-20250221-0855/log/remote/fmadio20v3-333-ubuntu22/cron.log
pscope2-20250221-0855/log/remote/fmadio20v3-333-ubuntu22/systemd-sysctl.log
pscope2-20250221-0855/log/remote/fmadio20v3-333-ubuntu22/networkd-dispatcher.log
pscope2-20250221-0855/log/remote/fmadio20v3-333-ubuntu22/systemd-logind.log
pscope2-20250221-0855/log/remote/fmadio20v3-333-ubuntu22/rsyslogd.log
.
.
pscope2-20250221-0855/rootfs/opt/fmadio/app/pscope2/bin/
pscope2-20250221-0855/rootfs/opt/fmadio/app/pscope2/bin/ingest.lua
pscope2-20250221-0855/rootfs/opt/fmadio/app/pscope2/bin/pscope2.lua
pscope2-20250221-0855/rootfs/opt/fmadio/app/pscope2/bin/pcap2json2
pscope2-20250221-0855/rootfs/opt/fmadio/app/pscope2/etc/
pscope2-20250221-0855/rootfs/run/
pscope2-20250221-0855/rootfs/srv/
pscope2-20250221-0855/rootfs/sbin
pscope2-20250221-0855/fmadiocli-add.lua
root@fmadio100v2-228U:/mnt/store0/lxc/lib/lxc#

Step 3) Install the LXC

Install the LXC as follows. Note this is in the pscope2-YYYYMMDD-HHMMSS directory. All operations require running as root

cd pscope2-20250221-0855

then run the install script (as root)

 ./install.lua

Example output

root@fmadio100v2-228U:/mnt/store0/lxc/lib/lxc/pscope2-20250329-1217# ./install.lua
fmad fmadlua Sep  7 2024 (/opt/fmadio/bin/fmadiolua --nocal ./install.lua )
Disable cycle calibration
man0 imported

man0 ipv4 addr    [nil]
man0 ipv4 netmask [nil]
man0 ipv4 gw      [nil]
man0 ipv4 dns     [nil]
lxcname           [nil]
lxcbuild          [nil]
nat            [y]
fmad fmadlua Sep  7 2024 (/opt/fmadio/bin/fmadiolua --nocal /opt/fmadio/bin/fmadiocli version )
Disable cycle calibration
done 0.004944Sec 0.000082Min
-----------------------------------------------
[Sat Mar 29 20:49:41 2025] CmdLine [version]
[Sat Mar 29 20:49:41 2025] Cmd [version]

-----------------------------------------------
fmadiocliPresent = true
pscope2-20250329-1217
rm config
mkdir /opt/fmadio/lxc/pscope2-20250329-1217/data/ -p
mkdir /opt/fmadio/lxc/pscope2-20250329-1217/log/ -p
----------------------
IP     : nil
CIDR   : nil
GW     : nil
DNS    : nil
Nat    : y
/opt/fmadio/bin/fmadiocli "config ring add lxc_pscope2"
fmad fmadlua Sep  7 2024 (/opt/fmadio/bin/fmadiolua --nocal /opt/fmadio/bin/fmadiocli config ring add lxc_pscope2 )
Disable cycle calibration
[Sat Mar 29 20:49:41 2025] CmdLine [config ring add lxc_pscope2]
[Sat Mar 29 20:49:41 2025] Cmd [config ring add lxc_pscope2]
[Sat Mar 29 20:49:41 2025]**ERROR** Ring named [lxc_pscope2] already exists
[Sat Mar 29 20:49:41 2025]
[Sat Mar 29 20:49:41 2025] Example Usage:
[Sat Mar 29 20:49:41 2025] > config ring add <ring name>            : creates the  ring
[Sat Mar 29 20:49:41 2025]
done 0.019156Sec 0.000319Min
rm /opt/fmadio/lxc/pscope2-20250329-1217/rootfs/etc/resolv.conf
touch /opt/fmadio/lxc/pscope2-20250329-1217/rootfs/etc/resolv.conf
echo fmadio100v2-228U-pscope2 > /opt/fmadio/lxc/pscope2-20250329-1217/rootfs/etc/hostname
echo 127.0.0.1 fmadio100v2-228U-pscope2 >> /opt/fmadio/lxc/pscope2-20250329-1217/rootfs/etc/hosts
/opt/fmadio/bin/fmadiocli "config lxc add pscope2-20250329-1217"
fmad fmadlua Sep  7 2024 (/opt/fmadio/bin/fmadiolua --nocal /opt/fmadio/bin/fmadiocli config lxc add pscope2-20250329-1217 )
Disable cycle calibration
[Sat Mar 29 20:49:41 2025] CmdLine [config lxc add pscope2-20250329-1217]
[Sat Mar 29 20:49:41 2025] Cmd [config lxc add pscope2-20250329-1217]
[Sat Mar 29 20:49:41 2025] Added container [pscope2-20250329-1217] to the configuration
done 0.119002Sec 0.001983Min
./host_files/plugin_reload.lua ./host_files/fmadio_pscope2_basic_20250101_0000.tcz
fmad fmadlua Sep  7 2024 (/opt/fmadio/bin/fmadiolua ./host_files/plugin_reload.lua ./host_files/fmadio_pscope2_basic_20250101_0000.tcz )
calibrating...
0 : 2095073498           2.0951 cycles/nsec offset:4.927 Mhz
Cycles/Sec 2095073498.0000 Std:       0 cycle std(  0.00000000) Target:2.10 Ghz
Sat Mar 29 20:49:42 2025 Plugin Load
Loading Plugin [./host_files/fmadio_pscope2_basic_20250101_0000.tcz]
MD5: b39bca65a939a042bfc478df7e72e5cd  ./host_files/fmadio_pscope2_basic_20250101_0000.tcz
reloading pscope2  [basic]
Copying new firmware [./host_files/fmadio_pscope2_basic_20250101_0000.tcz] -> /mnt/system/tce/optional/fmadio_pscope2_basic.tcz
Cmd [sudo cp -v ./host_files/fmadio_pscope2_basic_20250101_0000.tcz /mnt/system/tce/optional/fmadio_pscope2_basic.tcz]
Inserting into boot list
Cmd [echo "fmadio_pscope2_basic.tcz" >> /mnt/system/tce/onboot.lst]
Cmd [cp  /mnt/system/tce/onboot.lst /mnt/system/tce/onboot.lst.bak]
Cmd [cat /mnt/system/tce/onboot.lst.bak | grep -v analytics > /mnt/system/tce/onboot.lst]
Killing programs
Cmd [sudo /usr/local/bin/umount /tmp/tcloop/fmadio_pscope2_basic]
umount: /tmp/tcloop/fmadio_pscope2_basic: not found
Cmd [sudo mkdir -p /tmp/tcloop/fmadio_pscope2_basic]
Cmd [sudo /usr/local/bin/mount /mnt/system/tce/optional/fmadio_pscope2_basic.tcz /tmp/tcloop/fmadio_pscope2_basic -t squashfs -o loop,ro]
Cmd [yes | sudo cp -ais /tmp/tcloop/fmadio_pscope2_basic/* / 2>/dev/null ]
-----------------------------------------------
Updated:
                                  -> pscope2 basic
                                  -> 113
                                  -> Sat Mar 29 20:10:36 2025
-----------------------------------------------
*****************************************************************
*** A System reboot is REQUIRED. Please restart (sudo reboot) ***
*****************************************************************
done 0.089359Sec 0.001489Min
done
done 1.264733Sec 0.021079Min
root@fmadio100v2-228U:/mnt/store0/lxc/lib/lxc/pscope2-20250329-1217#

NOTE: ensure the host binaries have been installed correctly, as highlighted below. If it area looks black run the install command again

Step 4) Copy the pscope2 target.lua

Copy the target to lua file from

sudo cp /opt/fmadio/etc_ro/target.lua.pscope2 /opt/fmadio/etc/target.lua

This allows the updated API endpoints to function correctly.

Step 5) Start the Container

Use the lxc-start command to start the LXC container

 sudo lxc-start -n pscope2-20250221-0855

Example output:

fmadio@fmadio100v2-228U:/opt/fmadio/lxc$ sudo lxc-start -n pscope2-20250221-0855
fmadio@fmadio100v2-228U:/opt/fmadio/lxc$

NOTE: After the 1st install of the LXC Container. The system will automatically reboot itself. This is expected behavior and only occurs after the first install.

Step 6) Attach to container and check status

Attach to the lxc using lxc-attach command

sudo lxc-attach -n pscope2-20250221-0855

Example output

fmadio@fmadio100v2-228U:/opt/fmadio/lxc$ sudo lxc-attach -n pscope2-20250221-0855
root@fmadio100v2-228U-pscope2:/#

Confirm status is operational using SystemD utilities

systemctl status fmadio-pscope2.service

Example output

root@fmadio100v2-228U-pscope2:/# systemctl status fmadio-pscope2.service
* fmadio-pscope2.service - FMADIO Packetscope2
     Loaded: loaded (/etc/systemd/system/fmadio-pscope2.service; enabled; vendor preset: enabled)
    Drop-In: /run/systemd/system/service.d
             `-zzz-lxc-service.conf
     Active: active (running) since Fri 2025-02-21 10:42:08 UTC; 1min 40s ago
   Main PID: 137 (pscope2.lua)
     CGroup: /system.slice/fmadio-pscope2.service
             |-137 /usr/bin/bash /opt/fmadio/app/pscope2/bin/pscope2.lua
             |-140 /opt/fmadio/bin/fmadio2pcap -i /opt/fmadio/queue/lxc_pscope2
             |-141 /opt/fmadio/app/pscope2/bin/pcap2json2 -v --json-flow --decode-gtpc --decode-gtpu
             `-142 /usr/bin/luajit /opt/fmadio/app/pscope2/bin/ingest.lua

Feb 21 10:43:39 fmadio100v2-228U-pscope2 pscope2.lua[142]: [Fri Feb 21 10:43:39 2025] flushing (         0) Total:0.000M
Feb 21 10:43:40 fmadio100v2-228U-pscope2 pscope2.lua[142]: [Fri Feb 21 10:43:40 2025] flushing (         0) Total:0.000M
Feb 21 10:43:41 fmadio100v2-228U-pscope2 pscope2.lua[142]: [Fri Feb 21 10:43:41 2025] flushing (         0) Total:0.000M
Feb 21 10:43:42 fmadio100v2-228U-pscope2 pscope2.lua[142]: [Fri Feb 21 10:43:42 2025] flushing (         0) Total:0.000M
Feb 21 10:43:43 fmadio100v2-228U-pscope2 pscope2.lua[142]: [Fri Feb 21 10:43:43 2025] flushing (         0) Total:0.000M
Feb 21 10:43:44 fmadio100v2-228U-pscope2 pscope2.lua[142]: [Fri Feb 21 10:43:44 2025] flushing (         0) Total:0.000M
Feb 21 10:43:45 fmadio100v2-228U-pscope2 pscope2.lua[142]: [Fri Feb 21 10:43:45 2025] flushing (         0) Total:0.000M
Feb 21 10:43:46 fmadio100v2-228U-pscope2 pscope2.lua[142]: [Fri Feb 21 10:43:46 2025] flushing (         0) Total:0.000M
Feb 21 10:43:47 fmadio100v2-228U-pscope2 pscope2.lua[142]: [Fri Feb 21 10:43:47 2025] flushing (         0) Total:0.000M
Feb 21 10:43:48 fmadio100v2-228U-pscope2 pscope2.lua[142]: [Fri Feb 21 10:43:48 2025] flushing (         0) Total:0.000M
root@fmadio100v2-228U-pscope2:/#

Optional 7) configure IP Forwarding (one time only)

(One time only)

By default the LXC / Grafana runs on the private 192.168.255.0/24 subnet, which is not accessible externally.

To access PacketScope2 Grafana interface update the iptables rules in

/opt/fmadio/etc/

Create / modify the file

iptables.conf

Replace the contents with below

# Generated by iptables-save v1.6.1 on Tue Nov 28 15:30:44 2023
*nat
:PREROUTING ACCEPT [307:49051]
:INPUT ACCEPT [3:156]
:OUTPUT ACCEPT [112:11328]
:POSTROUTING ACCEPT [110:11210]

# fshark rdp port
-A PREROUTING -p tcp -m tcp --dport 3389 -j DNAT --to-destination 192.168.255.11:3389

# pscope2
-A PREROUTING -p tcp -m tcp --dport 3050 -j DNAT --to-destination 192.168.255.50:3000

-A POSTROUTING -o man0 -j MASQUERADE
-A POSTROUTING -o man10 -j MASQUERADE
COMMIT
# Completed on Tue Nov 28 15:30:44 2023
# Generated by iptables-save v1.6.1 on Tue Nov 28 15:30:44 2023
*filter
:INPUT ACCEPT [15028:3079580]
:FORWARD ACCEPT [1651:509287]
:OUTPUT ACCEPT [14446:4545136]
COMMIT
# Completed on Tue Nov 28 15:30:44 2023

Then reload the IPtables rules using the command

sudo iptables-restore < /opt/fmadio/etc/iptables.conf

Example output as follows

fmadio@fmadio100v2-228U:/opt/fmadio/etc$ sudo iptables-restore /opt/fmadio/etc/iptables.conf
fmadio@fmadio100v2-228U:/opt/fmadio/etc$

Confirm Grafana can be access on HTTPS port 3050 example below