Setting up an AMPRNet Gateway on Ubuntu Server 16.04 behind a NAT

Simple AMPR setup.

First, forward all packets from the AMPR gateway (169.228.66.251) to your linux box using NAT. It is important to note that the IPIP traffic coming to this address is of the same layer as TCP and UDP, so you will likely need to use an enterprise grade firewall that can do port forwarding based on source address.

Then, create an interface on your linux box using the following script. (as root)

This script is adapted from startampr.sh, which can be found at http://www.qsl.net/kb9mwr/wapr/tcpip/startampr


#!/bin/sh

#One of your IP addresses. Must be from the subnet sent to you by IPIP
ipadd='44.xx.xx.xx/32'

#Your IP Block. Must be the subnet sent to you by IPIP
ipaddblock='44.xx.xx.xx/29'

modprobe ipip
ip addr add  $ipadd dev tunl0
ip tunnel change ttl 64 mode ipip tunl0
ip link set dev tunl0 up
ifconfig tunl0 mtu 1480

#Route all traffic to 44. addresses over the interface.
ip rule add to 44.0.0.0/8 table 44 priority 44

#Route all traffic from our ampr address range over the tunnel
ip rule add from $ipaddblock table 44 priority 45

#The AMPRnet gateway at the other end of the tunnel.
ip route add default dev tunl0 via 169.228.66.251 onlink table 44

Now, ping your address from an external server, and it should work!

You can add new addresses to your interface by using the following command.

ip addr add  MY_IP_ADDRESS dev tunl0

This will get you a simple setup which is capable of communicating with the wider internet.

In order to connect to other AMPRnet devices, it is recommended to set up RIP routing. This can be implemented using the remainder of the startampr script hosted here

EDIT: fixed definition of IP address so the script works

Published 2017-01-03