pshangguan
Posts: 2
Joined: Sat Feb 01, 2020 6:47 pm

Setup Port Forwarding on Pi 4 Error

Mon Feb 10, 2020 10:45 pm

I have a raspberry pi 4 at home behind a router(netgear nighthawk) and I want to run a command to setup port forwarding on the router for port 11911/TCP. The internal IP of the PI is 192.168.1.20 and I tried to use "upnpc" as:

pi@raspberrypi:~ $ upnpc -a 192.168.1.20 11941 11941 TCP
upnpc : miniupnpc library test client, version 2.1.
(c) 2005-2018 Thomas Bernard.
Go to http://miniupnp.free.fr/ or https://miniupnp.tuxfamily.org/
for more information.
List of UPNP devices found on the network :
desc: http://192.168.1.1:5000/Public_UPNP_gatedesc.xml
st: urn:schemas-upnp-org:device:InternetGatewayDevice:1

Found a (not connected?) IGD : http://192.168.1.1:5000/Public_UPNP_C3
Trying to continue anyway
Local LAN ip address : 192.168.1.20
GetExternalIPAddress failed.
AddPortMapping(11941, 11941, 192.168.1.20) failed with code -3 (UnknownError)

I am not sure what is wrong with this...

Thanks,
Philip

pcmanbob
Posts: 8268
Joined: Fri May 31, 2013 9:28 pm
Location: Mansfield UK

Re: Setup Port Forwarding on Pi 4 Error

Tue Feb 11, 2020 11:26 am

Hi.

Port forwarding is normally done on the router its self using the router web access / setup page,

you need to read the user manual for your router as you may need to setup a service before you can do the port forwarding.

using UPNP will only work if a service has already been configured for it to use.
We want information… information… information........................no information no help
The use of crystal balls & mind reading are not supported

pshangguan
Posts: 2
Joined: Sat Feb 01, 2020 6:47 pm

Re: Setup Port Forwarding on Pi 4 Error

Sat Feb 15, 2020 2:48 am

I understand I could configure the router by using the browser. But I want to explore a command method to set it up so that when anyone uses the pi board and turned it on at home, it will configure the port forwarding on his/her home router automatically. I can find the router's external IP using "curl" on the board, I just need to find a way to set the port forwarding on the router using command so that I can do it from a startup script.

Any idea will be appreciated!

pcmanbob
Posts: 8268
Joined: Fri May 31, 2013 9:28 pm
Location: Mansfield UK

Re: Setup Port Forwarding on Pi 4 Error

Sat Feb 15, 2020 10:23 am

Well not all routers will support it out of the box and even those that do may have the function turned off, Did this on my router to preventive programs forwarding ports to the outside world without my knowledge.
We want information… information… information........................no information no help
The use of crystal balls & mind reading are not supported

User avatar
davidcoton
Posts: 4646
Joined: Mon Sep 01, 2014 2:37 pm
Location: Cambridge, UK

Re: Setup Port Forwarding on Pi 4 Error

Sat Feb 15, 2020 10:23 am

AFAIK, the commands required will be different for every make (and possibly model) of router.
Signature retired

Return to “Troubleshooting”