Table of Contents

Port-Forwarding

Port-Forwards are necessary if you want to run any ip-based services in your local network which you want to be accessible the internet.

Overview

Level of difficulty

 Medium

Use-case

In the following use-case, a game-server running locally on host 192.168.1.100 port 2222 tcp, should be made accessible from the internet. Therefore it is necessary to redirect incoming connection-requests from your wan-gateway to the machine running the server.

Forward properties:
name some awesome game
protocol tcp
remote port 2222
local ip 192.168.1.100
local port 2222

Instructions

GUI

In this tutorial we will configure a port forward, step-by-step. At first you have to log in to your router.

Go to the Network Settings tab and then to Port Forwards.

There you can specify the protocol you want use (TCP,UDP or both).

UCI Config System

uci add firewall rule
uci set firewall.@rule[-1].name='some awesome game'
uci set firewall.@rule[-1].src=wan
uci set firewall.@rule[-1].proto=tcp
uci set firewall.@rule[-1].src_dport=2222
uci set firewall.@rule[-1].dest_ip=192.168.1.100
uci set firewall.@rule[-1].target=DNAT
uci set firewall.@rule[-1].dest=lan
uci commit firewall
/etc/init.d/firewall restart

UCI config files (native)

Redirects are defined in /etc/config/firewall

config 'redirect'
        option 'name' 'some awesome game'
        option 'src' 'wan'
        option 'proto' 'tcp'
        option 'src_dport' '2222'
        option 'dest_ip' '192.168.1.100'
        option 'target' 'DNAT'
        option 'dest' 'lan'

Troubleshooting

Not available, yet