====== Set up the discovery tool avahi under an LXC container ======
===== Goal =====
Install the discovery tool avahi directly on the router. With the help of the LXC Container function, the avahi tool can be used on the router to display the FMS data with itxpt.
===== Prerequisites =====
* NetModule Wireless Router with wireless connection
* NetModule Software [[https://share.netmodule.com/public/system-software/4.8/4.8.0.103/|4.8.0.103]] or newer
* A license is required for the LXC container
* Not available for legacy products NB1600, NB2700, NB3700, NB3710
===== - Set up the LXC Contianer =====
Activate the LXC container on the router
{{:pictures:lxc_aktiv.png?800|}}
In the second step the image of the LXC container in this case Debian.
{{:pictures:lxc_install.png?800|}}
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 / [[https://jenkins.linuxcontainers.org/view/Images/job/image-debian/|Link]]
The "''armhf''" tab is important here
Here you can get a Debina image for ''buster, bullseye or bookworm''.
{{:pictures:lxc_jenkins.png?800|}}
If you click on the circle with the green rakes, you will be taken to the software. What else is important is that the circle and rakes must be green.
{{:pictures:lxc_link.png?800|}}
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-debian/architecture=armhf,release=bookworm,variant=default/lastSuccessfulBuild/artifact/rootfs.tar.xz''
When the "Apply" button is pressed, Debian will be installed.
===== - Test LXC installation and set up further =====
Under the console you can first check whether the installation has been carried out.
~ $ cd /mnt/storage0/lxc/guest0
/mnt/storage0/lxc/guest0 $ ls
bin dev home media opt root sbin sys usr
boot etc lib mnt proc run srv tmp var
/mnt/storage0/lxc/guest0 $
This file must be available under this directory structur
~ $ lxc-info guest0
Name: guest0
State: RUNNING
PID: 20493
CPU use: 1.49 seconds
BlkIO use: 20.00 KiB
Memory use: 7.22 MiB
KMem use: 1.20 MiB
~ $
The LXC container is set up and already started.
Set up the LXC container further. A network interface is enabled here.
{{:pictures:lxc_netzwerk.png?800|}}
The container has now also been assigned an IP address.
~ $ 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.
{{:pictures:lxc_ip_adresse.png?800|}}
Log in to the LXC container and test whether it can access the Internet.
~ $ 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.
===== - Set up the avahi tool =====
If you have logged in to the LXC container with the command.
$ lxc-attach guest0
root@LXCNAME:~#
You can install the avahi-utils via the packe manager apt-get.
root@LXCNAME:~# apt-get install avahi-utils
You can use the avahi tool completely under the console.
The avahi-browse program will display the multicast DNS addresses on the router.
root@LXCNAME:~# avahi-browse -a
+ eth0 IPv4 NB2800 SSH Remote Terminal local
+ eth0 IPv4 NB2800_00112B022DD1._inventory _itxpt_http._tcp local
+ eth0 IPv4 NB2800_00112B022DD1._fmstoip-rem _itxpt_http._tcp local
+ eth0 IPv4 NB2800_00112B022DD1._fmstoip-get _itxpt_http._tcp local
+ eth0 IPv4 NB2800_00112B022DD1._fmstoip-add _itxpt_http._tcp local
+ eth0 IPv4 NB2800_00112B022DD1._time _sntp._udp local
+ eth0 IPv4 NB2800_00112B022DD1._gnss_location _itxpt_multicast._udp local
+ eth0 IPv4 NB2800_00112B022DD1._fmstoip _itxpt_multicast._udp local
+ eth0 IPv4 NB2800 SFTP File Transfer local
The -r option resolves the name _itxpt_multicast._udp to an IP.
root@LXCNAME:~# avahi-browse -r _itxpt_multicast._udp
+ eth0 IPv4 NB2800_00112B022DD1._gnss_location _itxpt_multicast._udp local
+ eth0 IPv4 NB2800_00112B022DD1._fmstoip _itxpt_multicast._udp local
= eth0 IPv4 NB2800_00112B022DD1._gnss_location _itxpt_multicast._udp local
hostname = [NB2800.local]
address = [192.168.1.1]
port = [14005]
txt = ["multicast=239.255.42.21" "version=1" "txtversion=1"]
= eth0 IPv4 NB2800_00112B022DD1._fmstoip _itxpt_multicast._udp local
hostname = [NB2800.local]
address = [192.168.1.1]
port = [15015]
txt = ["multicast=239.255.42.21" "version=1" "txtversion=1"]
A service program mreceive is also required for receiving multicast traffic.
===== - Set up the mreceive tool =====
Additional programs are required for the installation of the mreceive utility program.
root@LXCNAME:~# apt-get install git
root@LXCNAME:~# git clone https://github.com/troglobit/mtool
root@LXCNAME:~# cd mtools/
root@LXCNAME:~/mtools# apt-get install make
root@LXCNAME:~/mtools# apt-get install gcc
Once you have completed this preparation, you can execute the mreceive utility program with the "make" command.
root@LXCNAME:~/mtools# make
CC msend.o
LINK msend
CC mreceive.o
LINK mreceive
root@LXCNAME:~/mtools#
Now you only have to change the file on the right and you can use the utility program.
root@LXCNAME:~/mtools# chmod 775 mreceive
To test the mreceive utility program, I have the GNSS multicast traffic output as an XML frame.
root@LXCNAME:~/mtools# ./mreceive -g 239.255.42.21 -p 14005
Now receiving from multicast group: 239.255.42.21
Receive msg 1 from 192.168.1.1:60913: $GNGNS,,,,,,NN,,,,,,*53$GPVTG,,T,,M,,N,,K,N*2C$GP
GSA,A,1,,,,,,,,,,,,,,,*1E$GNGSA,A,1,,,,,,,,,,,,,,,*00$GPGGA,,,,,,0,,,,,,,,*66$GPRMC,,V,,,,,,,,,,N*53
Data>0N
Latitude>0E
Longitude>02024-06-10
Date>0NotValid
SignalQuality>1
NumberOfSatellites>0
HorizontalDilutionOfPrecision>0
VerticalDilutionOfPrecision>0
TrackDegreeTrue>MixedGNSSTypes
GNSSType>WGS84
GNSSLocationDelivery>
* [[app-notes:fmstoip-itxpt|How to set up the FMStoIP]]