Wednesday, June 19, 2019

Winlink On Your Browser

Recently the profile of Winlink has increased around the Section quite a bit. The addition of the CMEN Winlink network to the existing VHF relays and the myriad of HF relays has made Winlink a significant contributor to moving text via radio.

For those not familiar with Winlink, it is basically radio email.  You compose a message in an email-like client. You then connect to a mail server and off your message goes. The interesting thing is that you can connect to the mail server by Internet, but also by radio. There are hundreds of HF servers around, but even easier, there are now dozens of VHF and UHF servers around Michigan.
Connections

You connect your computer to the radio using a TNC. Most modern programs don't require a lot of smarts in the TNC, so there is little advantage to an expensive TNC over a cheap one.

The most common program is Winlink Express.  But this requires leaving your computer connected to the TNC, which may or may not be convenient, or switching to a dedicated computer. Again, not as convenient as it might be.

Of course, these days, everything we do seems to involve a Raspberry Pi. This is a really cheap computer we can dedicate to a task.  Better yet, there is a cheap TNC available for the Raspberry Pi called a TNC-Pi.  And to top it off, there is a Winlink client called pat that will present itself as a web page.  So if you put a Pi with a TNC-Pi on  your LAN, you can send and receive Winlink messages over VHF or UHF from any web browser on your LAN.

I will detail below how to make this work for you.  You will need a Pi, and a TNC-Pi.  I am using a Raspberry Pi model 3B+ and a TNC-Pi 2.  Older TNC-Pi models will be the same, and older Pi models should be virtually identical. You will also need a keyboard, mouse and display, but once the system is configured these are no longer needed. I am assuming that you will connect the Pi into your LAN ver a normal Ethernet, so you will also need an Ethernet cable. For newer Pi models you could also use WiFi, but I won't go into setting up WiFi.

I tend to find an unusual keyboard annoying, so once the first few setup steps are done, I use SSH from my regular computer.  Linux and Mac have built in SSH clients. I found that MobaXterm is a very nice SSH client for Windows. You could also use PuTTY, but it is somewhat limited. I understand that the PowerShell in Windows 10 has an SSH client, but have not tried that.

So, start by getting your TNC-Pi built and tested. Go through the steps outlined in the TNC-Pi manual to set up and test ax25-tools on your Pi.

One change I made to W2FS's instructions; I named my port wl2k instead of 1. I find that I tend to overlook 1 on some commands, and that field is a text field, so if you have named your TNC-Pi Suzie, then you could call the port Suzie.

axports
Of course, your kissattach command will look slightly different:

kissattach command

You should now be able to do the axcall command outlined in the TNC-Pi documents replacing 1 with your preferred name.

pat


Now that you have your TNC-Pi installed and tested, time to get on with making the Winlink client work.  Download and install the .deb package from
https://github.com/la5nta/pat/releases/download/v0.6.1/pat_0.6.1_linux_armhf.deb
 following the instructions at
https://github.com/la5nta/pat/wiki/Install-FAQ

You are going to want your web interface to be available all the time. To make that happen, you are going to want to have a dedicated user on the Raspberry Pi. I chose the creative user name winlink.  You will not want to log on to this user once pat is set up.

Log on to the user and type
        pat config
You will enter the editor with the configuration file.  Once you have run pat for the first time, you may instead prefer to edit ~/.wl2k/config.json with your favorite editor.

You need to tell pat what relays you will be connecting to.

Part of config.json
You will obviously need to enter your call.  If you got your Winlink account a while ago, the call and password will need to be in upper case even if you originally provided it in mixed or lower case.

The "http_addr" is significant. In most cases you will probably be using an IP address assigned by your router. You can use ifconfig to determine this number.

ifconfig
In this example, your "http_addr" line might look like:
    "http_addr": "192.68.0.38:8080",
Depending on your router, you maybe able to cause the router to assign a specific address to the Pi's MAC address, shown as "ether" above. This number is unique to every device.

Depending on your LAN, you might be able to assign a friendlier name to that address.  In my case, I called it "pat01".  This name or address must match what address you give your browser.  In this case, you might expect I could connect with 192.68.0.38 but in fact, pat won't answer to that address, even though it is the Pi's address.

The aliases are optional, but they will appear in the (select alias)  menu when you connect.  For an RMS you can reach directly, the format is:
If you need to use a digipeater
You may add multiple digipeaters, but you are likely to get timeouts with more than one.

Once you have saved the config file, type
    pat http
and return to your "normal" computer, leaving pat running on the Pi.

Using pat


Open your web browser, and type the address in the "http_addr" line into the web browser's address bar.  You should see something like:

pat - nothing in inbox

If you do not have a Winlink account, leave the password blank, and then simply connect and not send a message. Then connect again and you will receive a message with your Winlink password. Put that password in your configuration.

Now, to prove we have a working pat, let's send ourselves a Winmail message using the Internet.  Click on Action, then Compose...



You will see the compose a message dialog:

 Put your call into the To: box and formulate a dummy message.  Click on Post to post the message to the Outbox.

Next, select Connect... from the Action menu. The sending dialog will appear:

Choose telnet from the (select alias) menu then click Connect. You will see some activity in the black area at the bottom of the window. It should end up something like:

Any messages in your Outbox will be sent to the server.

Now connect again, and your message should be seen in the Inbox.

Setting pat to start automatically


Now that we have it working, we would like it to start on boot so that we never have to actually log in to the Pi.

If you haven't already, stop pat (with Cntl-C).

Then add the following two lines to the bottom of ~/.bashrc:

    sudo kissattach /dev/serial0 wl2k 10.1.1.1
    /usr/bin/pat http 


where wl2k is your port name.  If you have an assigned 44.x IP address you may choose that instead of 10.1.1.1, but since it isn't used in the case, it won't matter. It could be handy, tho, if you log on to the Pi and want to work with a node that supports the Internet Protocol.

At this point you may wish to log off and log back on again to be sure pat starts automatically.  You will need to stop pat in order to log off.

Assuming you installed the default Raspbian distribution, you can do the next steps logged on as the pi user, which is logged on the the graphical console by default.

Edit /etc/systemd/logind.conf. Uncomment the first two lines after [Login] and change both 6 to 5:

    [Login]
    NAutoVTs=5
    ReserveVT=5
    #KillUserProcesses=no

         ...

Now, cd to /lib/systemd/system/

Copy getty@.service to  pat-winlink.service

    sudo cp getty@.service pat-winlink.service


Edit pat-winlink.service as follows:

Change
     Description=Getty on %I
to
     Description=Winlink client on tty6

Change
     ExecStart=-/sbin/agetty --noclear %I $TERM
to
     ExecStart=-/sbin/agetty --noclear tty6 38400 -a winlink
where winlink is the user code you chose to run pat.

At the bottom of the file change
   [Install]
   WantedBy=getty.target
   DefaultInstance=tty1

to
      [Install]
       Alias=getty.target.wants/pat-winlink.service

Now you need to let the system know you have messed with these files:
    systemctl daemon-reload

If you have logged off your winlink user, you should now be able to start pat by typing:
    sudo systemctl start pat-winlink
and cause it to start automatically with:
    sudo systemctl enable pat-winlink

You can (and should) check the status of pat with:
     sudo systemctl status pat-winlink

the result should be something like:
pat service status

pat should now start whenever the Pi is rebooted.

Finding an RMS

If you go to https://winlink.org/RMSChannels you will get a map of RMSs. With the TNC-Pi you will only be able to connect to packet RMSs, so click on the Packet button and zoom the map to the appropriate area:

If you then click on one of the markers, you can see detail about that RMS:

Turn your radio to the desired frequency, put the callsign into the target: box on the connect dialog, and you should be able to send and receive messages over the radio.

If you use an ordinary email address instead of just a callsign, the message will be delivered over email.  You can be reached by email at (your call)@winlink.org if the sender has received a Winlink message from you in the past few months.

1 comment:

  1. W8FSM added the following:
    If you have AMPR or any IP connection.. Mi6 add these as well..

    "connect_aliases": {
    "telnet": "telnet://{mycall}:CMSTelnet@cms.winlink.org:8772/wl2k",
    "fenton-rms": "telnet://{mycall}:CMSTelnet@fenton-rms.mi6wan.net:8772/wl2k",
    "grandrapids-rms": "telnet://{mycall}:CMSTelnet@grandrapids-rms.mi6wan.net:8772/wl2k",
    "mayville-rms": "telnet://{mycall}:CMSTelnet@mayville-rms.mi6wan.net:8772/wl2k",
    "saginaw-rms": "telnet://{mycall}:CMSTelnet@saginaw-rms.mi6wan.net:8772/wl2k",
    "lansing-rms": "telnet://{mycall}:CMSTelnet@lansing-rms.mi6wan.net:8772/wl2k"
    },

    ReplyDelete

Note: Only a member of this blog may post a comment.