I have a raspberry pi at a remote site which is connected to the wider internet using a USB 3g/4g modem (its very slow, but works) I have root ssh access to this device, RPi is accessible via sitename.ddns.net, the IP address changes randomly, but the DDNS works well, connected to the RPi via eht0 is a server, server IP address is, eht0 has static address I can remote access this at the moment by opening an SSH tunnel and using socks5 proxy in the browser to tunnel thru to the device ... but im trying to set up port forwarding so that I can just use sitename.ddns.net:8089 to access the server on the far side of the RPi

I have tried various combinations of IPTABLES -R or -L but can seem to get any of these to work, server at the far end is on port 80, I would rather not use for 80 on the pi, perhaps 8089 just to be a bit random.

is this the right thing to be looking at or should this be done using some sort of bridge between wwan0 (or ppp0) to eth0

any help would be appreciated.

diagrammatic explanation ... (dunno if it should be wwan0 or ppp0)

(home/office) ----3g----(wwan0 - pi - eth0


1 Answer 1


You can create an ssh tunnel.

Global Access

From what you described the command should be this (Connect to the RPi via SSH and run):

ssh -N -L 8089: localhost

Now you can connect to your server via sitename.ddns.net:8089.

To make this work on startup I recommend you set this up as a systemd service.

Local Access

I would recommend you create a local ssh tunnel and thus not open up the server to the world.

To do that run a similar command from your local PC.

ssh -N -L 8089: [email protected]

Now you can access the server from

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.