I have a router that provides internet connection to a single client device via a wireless cellular data network. This network provides non-public IP addresses which gets natted. I would like to get a static IP address outside of the network that will route everything back to the device on the cell network.
Because this is an embedded device, space is limited (about 500kB to work with here). Because the network is expensive, it has to not consume too much traffic.
First I tried creating an IPIP tunnel using iproute2. From the server, I used the router's egress IP for the remote IP, not the private address the router received. I hoped that once the router communicated over the tunnel to the server, the server could communicate back. This was not the case.
I tried dropbear SSH and found it won't do a generic tunnel, but I thought I could probably get around that using iptables. However, it seems that just having the ssh link open consumes about 150 bytes/sec.
I also tried nc, but the communication is only one direction, so I can initiate a connection to the server, but can't get anything back.
OpenSSH and OpenVPN are too big to fit on the device (both around 1MB).
My next attempt will probably be to write a program that keeps a persistent socket open to the server, and to use iptables to route the traffic to that program. I wanted to see if there were any other ideas first.
So, any ideas?