• Stars
    star
    104
  • Rank 319,626 (Top 7 %)
  • Language
    C
  • License
    MIT License
  • Created almost 4 years ago
  • Updated 11 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Attach TNC devices as network interfaces

TNC Attach

Attach KISS TNC devices as network interfaces in Linux. This program allows you to attach TNCs or any KISS-compatible device as a network interface. This program does not need any kernel modules, and has no external dependencies outside the standard Linux and GNU C libraries.

Installation

Currently it is recommended to compile and install tncattach from source with the below commands.

If that is not possible for you, precompiled amd64 and armhf (Raspberry Pi and similar) binaries have been provided in the releases section. You can download the latest release here.

# If you don't already have a compiler installed
sudo apt install build-essential

# Clone repository from GitHub
git clone https://github.com/markqvist/tncattach.git

# Move into source directory
cd tncattach

# Make program
make

# Install to system
sudo make install

Using tncattach

Using tncattach is simple. Run the program from the command line, specifying which serial port the TNC is connected to, and the serial port baud-rate, and tncattach takes care of the rest. In most cases, depending on what you intend to do, you probably want to use some of the options, though. See the examples section below for usage examples.

Usage: tncattach [OPTION...] port baudrate

Attach TNC devices as system network interfaces

  -m, --mtu=MTU              Specify interface MTU
  -e, --ethernet             Create a full ethernet device
  -i, --ipv4=IP_ADDRESS      Configure an IPv4 address on interface
  -n, --noipv6               Filter IPv6 traffic from reaching TNC
      --noup                 Only create interface, don't bring it up
  -T, --kisstcp              Use KISS over TCP instead of serial port
  -H, --tcphost=TCP_HOST     Host to connect to when using KISS over TCP
  -P, --tcpport=TCP_PORT     TCP port when using KISS over TCP
  -t, --interval=SECONDS     Maximum interval between station identifications
  -s, --id=CALLSIGN          Station identification data
  -d, --daemon               Run tncattach as a daemon
  -v, --verbose              Enable verbose output
  -?, --help                 Give this help list
      --usage                Give a short usage message
  -V, --version              Print program version

The program supports attaching TNCs as point-to-point tunnel devices, or generic ethernet devices. The ethernet mode is suitable for point-to-multipoint setups, and can be enabled with the corresponding command line switch. If you only need point-to-point links, it is advisable to just use the standard point-to-point mode, since it doesn't incur the ethernet header overhead on each packet.

If you want to connect to a virtual KISS TNC over a TCP connection, you can use the -T option, along with the -H and -P options to specify the host and port.

Additionally, it is worth noting that tncattach can filter out IPv6 packets from reaching the TNC. Most operating systems attempts to autoconfigure IPv6 when an interface is brought up, which results in a substantial amount of IPv6 traffic generated by router solicitations and similar, which is usually unwanted for packet radio links and similar.

If you intend to use tncattach on a system with mDNS services enabled (avahi-daemon, for example), you may want to consider modifying your mDNS setup to exclude TNC interfaces, or turning it off entirely, since it will generate a lot of traffic that might be unwanted.

Station Identification

You can configure tncattach to automatically transmit station identification beacons according to a given interval, by using the --id and --interval options. Identification will be transmitted as raw data frames with whatever content has been specified in the --id option. Useful for amateur radio use, or other areas where station identification is necessary.

Identification beacons will be transmitted when:

  • There is outgoing data to send, and the specified interval has elapsed.
  • The specified interval elapses, and data has been sent since the last ID beacon.
  • The program exits, if any data frames have been transmitted since the last ID beacon.

The above methodology should comply with station identification rules for amateur radio in most parts of the world, and complies with US Part 97 rules.

Examples

Create an ethernet device with a USB-connected TNC, set the MTU, filter IPv6 traffic, and set an IPv4 address:

# Attach interface
sudo tncattach /dev/ttyUSB0 115200 --ethernet --mtu 576 --noipv6 --ipv4 10.92.0.10/24

Create an ethernet device with a TCP-connected TNC, set the MTU, filter IPv6 traffic, and set an IPv4 address:

# Attach interface
sudo tncattach -T -H localhost -P 8001 --ethernet --mtu 576 --noipv6 --ipv4 10.92.0.10/24

You can interact with the interface like any other using the ip or ifconfig utilities:

# Check interface is running
ifconfig

tnc0: flags=579<UP,BROADCAST,RUNNING,ALLMULTI>  mtu 576
        inet 10.92.0.10  netmask 255.255.255.0  broadcast 10.92.0.255
        ether 02:56:ad:f2:40:33  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

Create a point-to-point link:

# Attach interface
sudo tncattach /dev/ttyUSB0 115200 --mtu 400 --noipv6 --noup

# Configure IP addresses for point-to-point link
sudo ifconfig tnc0 10.93.0.1 pointopoint 10.93.0.2

# Check interface
ifconfig

tnc0: flags=4305<UP,POINTOPOINT,RUNNING,NOARP,MULTICAST>  mtu 400
        inet 10.93.0.1  netmask 255.255.255.255  destination 10.93.0.2
        unspec 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00  txqueuelen 500  (UNSPEC)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

Worth Knowing on Raspbian

On some versions of Raspbian (and probably other operating systems), the DHCP client daemon dhcpcd interferes with TNC interfaces, by overriding their MTU and trying to auto-configure link-local addresses. You probably don't want this, and it can be disabled by editing the /etc/dhcpcd.conf file, adding a statement telling dhcpcd to ignore your TNC interface:

# Add the following statement somewhere at the beginning
# of /etc/dhcpcd.conf to prevent dhcpcd from changing MTU

denyinterfaces tnc0

Support tncattach development

You can help support the continued development of open, free and private communications systems by donating via one of the following channels:

More Repositories

1

Reticulum

The cryptography-based networking stack for building unstoppable networks with LoRa, Packet Radio, WiFi and everything in between.
Python
1,487
star
2

NomadNet

Communicate Freely
Python
405
star
3

MicroAPRS

APRS fork of MicroModem
C
244
star
4

MicroModem

Atmega328p-based 1200 Baud AFSK radio modem
C
206
star
5

Sideband

LXMF client for Android, Linux and macOS allowing you to communicate with people or LXMF-compatible systems over Reticulum networks using LoRa, Packet Radio, WiFi, I2P, or anything else Reticulum supports.
Python
200
star
6

LibAPRS

An APRS library for the Arduino IDE
C++
189
star
7

OpenModem

Powerful AFSK modem platform
C
163
star
8

LXMF

Lightweight Extensible Message Format for Reticulum
Python
129
star
9

RNode_Firmware

Firmware for the RNode radio interface
Python
114
star
10

MicroModemGP

General purpose firmware for MicroModem with forward error correction and larger packet sizes
C
58
star
11

MidiKatapult

Custom layout mapper for the Novation Launchpad
Processing
27
star
12

rnodeconfigutil

Python
22
star
13

LoRaMon

LoRa packet sniffer for RNode hardware
Python
21
star
14

MicroDigi

Standalone digipeater firmware for MicroModem
C
17
star
15

WiPacket

A simple WiFi raw packet interface
C
15
star
16

ArduLASER

Arduino based laser controller
Processing
10
star
17

TelemetryKit

Arduino library for 1200-baud AFSK FPV audio-channel telemetry
C++
5
star
18

openmodemconfigutil

Configuration utility for OpenModem
CSS
4
star
19

reticulum_website

Website for Reticulum
CSS
4
star
20

otp

One-Time Pad Helper
C
2
star
21

rnview

Remote view utility for Reticulum
Python
2
star