Port forwarding

  Last modified on Tuesday 10 February 2015

Port forwarding enables SSH access to my home server from outside the home by forwarding traffic directed at a port on the router (reachable over the Internet by dynamic DDNS) to the SSH port on the internal server behind a NAT firewall.

OpenWrt port forward configuration is done in /etc/config/firewall. A sample entry that redirects port 55555 on the router to the SSH server listening on port 22 at 192.168.1.88 ...

config 'redirect'
    option 'name' 'ssh'
    option 'src' 'wan'
    option 'proto' 'tcpudp'
    option 'src_dport' '55555'
    option 'dest_ip' '192.168.1.88'
    option 'dest_port' '22'
    option 'target' 'DNAT'
    option 'dest' 'lan'

Save and make the changes active by running ...

# /etc/init.d/firewall restart

Alternative: setup port forwarding in LuCI under Network->Firewall->Port Forwards.

Example: SSH login outside the home enter ssh -p 55555 my.external.ip.address and the connection will be forwarded to the Pi server.

Link: OpenWrt Port Forwarding

Happy hacking!

More • openwrtlinuxnetwork