Grace has an LTE cellular link to the outside world, along with a Vesper XB-8000 AIS Class B transponder that I purchased from Milltech Marine, my favorite AIS shop. Using a Raspberry Pi B on board, and aisdispatcher software, you’re able to gather real-time AIS data from the XB-8000, but sending it out to multiple locations will use double, triple or even more data on a limited LTE connection….
Using my skills from my day job at a big networking company, and my systems administration background, I set to try to reduce the amount of data I was sending out of my LTE connection.
Grace’s connection is provided by a Peplink MAX BR1 router which has an integrated LTE modem, dual SIM cards, two LTE antennas, one WiFi antenna, and a GPS antenna. In addition, it has two LAN ports and a WAN port, and has a great wiring block for 10V-30V DC input power.
I’ve had tons of Internet devices on the boat for the last 10 years, including the Ubiquiti Bullet, WirieAP, Mikrotik router, AT&T and Verizon MiFi’s, plus many more. None have worked as perfectly as the Peplink — so perfectly that I’ve had it running for over a year, and have two bigger systems at home and at a remote vacation home, all connected together via VPN’s.
Peplink has a ton of features in such a small box. You get very powerful radios, along with dual SIM support in case you need to switch providers or deal with data limits. On top of that, they have a very secure and feature full network stack, VPN server, and options to deal with various types of Internet connections.
I have a WiFi booster device connected to the WAN port of the Peplink, but the WiFi networks nearby my marina aren’t that great. When they are working, I don’t worry about the data I’m using. Most of the time, I use the LTE connection as you see above in the screen shot.
I’m sending my AIS data to a minimum of 4 different sources including MarineTraffic, AIShub, and more — you can see what data I contribute on Services — and sending all of those would blow through my monthly 40GB LTE data limit.
AIS network diagram from Grace
The diagram above is a simplified view of my Boat and Home networks, showing the relevant AIS pieces.
- grace – a Raspberry Pi B connected to the boat network, using a network connection to communicate with the Vesper XB-8000 “vesper”.
- boat – Pepwave MAX BR1 router providing local WiFi network and connecting to AT&T LTE for internet connectivity. Firewall, DHCP, VPN, and other services are also here.
- vesper – the AIS Class B transponder, reachable via WiFi on the local boat network.
- home – Pepwave Balance One router at home, connected to my local ISP with a 1 gigabit ethernet connection. Similar network services to the boat router run here.
- ais – a Raspberry Pi B connected to the home network that is receiving all of the AIS data from grace.
The Raspberry Pi B is responsible for connecting over the local network on the boat to the XB-8000 using aisdispatcher software. You can use this software to connect to a remote TCP port, read the AIS data, and send it off to different AIS servers. I’m using the following command to grab the data off of the Vesper:
aisdispatcher -t -h vesper -p 39150 -H ais:6666 -v -D 60
To dissect the above:
-t TCP client mode
-h vesper remote host to get data from (the XB-8000)
-p 39150 TCP port to connect to on the XB-8000
-H ais:6666 remote host to send translated data to (home server)
-v dispatch VDM (AIS) messages only
-D 60 downsample 60 seconds
Step 1 – Downsampling / Reducing Messages
The first step to reduce the data is to use aisdispatcher to down sample the amount of data being sent out. That’s the
-D 60 setting above. It reduces the frequency of updates for systems who aren’t updating their position that often, but still sends valid frequent updates.
The second part of reducing data is to only send AIS related VDM messages, which is option
-v. Vesper not only sends out AIS messages, but GPS updates from it’s attached GPS, and NMEA 2000 bus data for all other devices, which isn’t useful to send off the boat over the limited data connection.
Step 2 – Sending off Boat … The VPN
The second thing I chose to do was to send only one copy of the data off the boat, and have a remote server receive it (the “ais” system at home), and then send it along to 4 other destinations.
The key to making this work is the Pepwave PepVPN connection between the boat and home. The boat’s IP address changes constantly, and the LTE connection can go up and down, so having a more stable connection at home is key. I do not have a static IP address at home, but I do use DNS-o-matic to register my current IP address as a DNS entry so that the boat can always look to connect to “home” and will always find the most current address.
Pepwave’s VPN is one of the easiest and most reliable VPN solutions I’ve ever used. I have used OpenVPN for other needs, and much prefer that for system-to-system connections, but for network-to-network connections, PepVPN has impressed me continually at the options and flexibility it has. Combine that with failover from LTE to WiFi, and in the case of my home connection, multiple LAN ports, and it provides a very redundant setup.
Step 3 – Sending to Multiple Locations
Now that the VPN is established, we can send the data from “grace” to “ais” securely, one time, and let the “ais” system send it out elsewhere.
This is done via the
-H ais:6666 command from the boat system, which is sending a single stream of the data from the boat to home.
The “ais” server is running the following command:
perl udp.pl 6666 | aisdispatcher-x86_64 -i -H marinetraffic:1234,aishub:1234....
Breaking the above down:
perl udp.pl 6666
A custom perl script that listens for UDP traffic on port 6666 and then sends it via the pipe command to the next one below. This port matches the boat’s setting sending out the parsed and downsampled traffic to port 666 on “ais”.
aisdispatcher-x86_64 -i -H marinetraffic:1234,aishub:1234....
This is the same aisdispatcher software used on the boat, but is not translating anything since it already was done on the boat. It simply accepts the input from the boat single stream, and splits it into 4 different streams (or more) out to various services. Since my bandwidth at home is much faster and not capped, it’s much better to send that out from here.
The perl script looks like this, found somewhere on the Internet and modified a bit to simplify. It simply waits for UDP traffic on the port number specified and grabs it off the network.
#!/usr/bin/perl## udp.pl - listen on UDP port and dump out whatever has been receiveduse strict;use warnings;use Socket;die "Usage: udp.pl <port>" if (!defined($ARGV));socket(UDP, PF_INET, SOCK_DGRAM, getprotobyname("udp"));bind(UDP, sockaddr_in($ARGV, INADDR_ANY));print $_ while (<UDP>);
Even if your routers do not have a VPN functionality, chances are you can use 3rd party firmware like ASUSwrt merlin, OpenWRT, DD-WRT or Tomato to add it. Or you can look at both Pepwave and Ubiquiti, who offer products only slightly more expensive that are basically consumer-professional or prosumer grade. These products often have robust features and configuration that will help with a VPN, and also great remote and monitoring features a home router just wouldn’t have.
Even without routers that support this, you could set up an OpenVPN tunnel between two Raspberry Pi systems just like above with simple configuration.
The best piece of this is being able to get the data off the boat, share it with others, and send it out to many different locations without using up my cell plan data on the boat.