Posts: 6
Joined: Wed Jul 29, 2015 2:51 pm

port forwarding not working

Mon Jun 17, 2019 1:35 pm

I have a raspberry pi on network behind an openwrt router. The router's wan is public.
The router is port-forwarding:
xxxx from the wan to 80 on the pi
yyyy from the wan to 443 on the pi
zzzz from the wan to 22 on the pi
my web server uses secure http, so http (port 80) is set up to forward to https (port 443)

Everything was working fine; I could access my web page by: and it would forward to
pi:80 would forward to
pi:443 would forward to
sftp to would forward to py:22

I recently changed my internet from to
And now it is not working: times out
pi:80 forwards to, but then it times out
sftp to, it times out

I changed my port forwarding:
zzzz from the wan to 22 on a nas
sftp to forwards correctly to nas:22

so the problem lies with the raspberry pi... I think there may be an artifact from the network laying around on the pi somewhere.
Any suggestions?

Posts: 3085
Joined: Thu May 05, 2016 9:33 am
Location: Paris, France

Re: port forwarding not working

Mon Jun 17, 2019 2:03 pm

Port forwarding just does not care about the IP config, as long as it is correct.

I suggest you use ipcalc to check your configs on the router and the Pi. You can install it on the Pi or use one online

Then check the usual suspects on the Pi, /etc/hosts/ /etc/dhcpcd.conf /etc/network/interfaces, /etc/resolv.conf, /etc/rc.local, iptables rules, ...
Also verify the router's firewall rules are up to date. Outgoing 22/tcp might be working but others failing.

(Prefer using DHCP for the LAN with IP address reservations; it makes network provisioning/maintenance easier.)
"S'il n'y a pas de solution, c'est qu'il n'y a pas de problème." Les Shadoks, J. Rouxel

Return to “Networking and servers”