Lucas1984
Posts: 11
Joined: Sat Feb 20, 2016 10:27 am

Port Forwarding Issue

Sat Feb 20, 2016 12:48 pm

Hi there,

I'm having an issue getting port forwarding to work, and it's because I have no idea what I'm doing, and all the tutorial videos I can find are using a completely different router than the one I have. I have dynamic DNS through noip installed, working, and running on the pi, and I just can't seem to figure this part out. Please help!

I have a ZyXel NGB-418N router.

The following is an example of what I am looking at in the Port Forwarding menu. If someone could just help me with the terminology and fill in the blanks I would be GRATEFUL!

I will represent dialogue boxes with [_______]

Active [y] <--- The tutorials I have seen say to check this box
Service name ___________ [user-defined] <--- Drop down with user-defined as the default
Local Port Range [____] ~ [____] <---- I have no idea what this means, but I'm supposed to put numbers in there I think.
Public Port Range [____] ~ [____] <---- I have no idea what this means, but I'm supposed to put numbers in there I think.
Protocol [TCP/UDP] <--- This is a drop down with TCP/UDP as the default.
Server IP Address: [________] <----I think the Pi's IP goes here, but I don't know.


I have also included a screen shot of the menu.

Please help!
Attachments
pforward.jpg
The menu I am looking at when trying to do this.
pforward.jpg (15.72 KiB) Viewed 3111 times
Last edited by Lucas1984 on Sat Feb 20, 2016 1:33 pm, edited 2 times in total.

ghans
Posts: 7882
Joined: Mon Dec 12, 2011 8:30 pm
Location: Germany

Re: Port Forwarding Issue

Sat Feb 20, 2016 1:28 pm

Well , WHAT do you want to forward ?
Webserver (80) , SSH (22) , Webserver+SSL (443) ?


ghans
• Don't like the board ? Missing features ? Change to the prosilver theme ! You can find it in your settings.
• Don't like to search the forum BEFORE posting 'cos it's useless ? Try googling : yoursearchtermshere site:raspberrypi.org

Lucas1984
Posts: 11
Joined: Sat Feb 20, 2016 10:27 am

Re: Port Forwarding Issue

Sat Feb 20, 2016 1:31 pm

Web server. I don't know what's what on that menu though. The ultimate goal with this build is a private cloud server using OwnCloud.

JimmyN
Posts: 1109
Joined: Wed Mar 18, 2015 7:05 pm
Location: Virginia, USA

Re: Port Forwarding Issue

Sat Feb 20, 2016 1:53 pm

In this case the service name can be anything you like, it's just a name for your reference. Usually the dropdown will include presets for SSH, Mail, Webserver, etc that will fill in the port info for you. But they may not be correct, so it's just as easy to create your own user defined service.

The local port range is the port your Pi will be listening on, you'll probably be listening for a single port rather than a range. So just put that number in the box. Since it may expect two values you might have to put the same port number in both boxes, so the range would be something like 22 and 22 if this is a port forward for SSH.

The public port range is the port number the router will look for to route it to your Pi.

The "TDC/UDP" is the correct protocol

The server IP address is the Pi's IP.

Example:
You're wanting to SSH into the Pi from another location using the internet.
SSH requests will normally use port 22, so you want the Public port to be 22 and the router will watch for incoming requests for that port. When the router sees that it will forward the request to the server IP address (Pi) using the local port you've set. If the Pi is also listening on port 22 then all the port numbers will be the same. When the router sees port 22 it will forward it to the Pi using port 22.

Another example but with the port being re-assigned:
If you have a webserver running it will normally listen on port 80. But your IP may block port 80, so you have to use port 8080 to access your webserver. If you set the public port to 8080, and the local port to 80, when the router sees the incoming request for 8080 it will forward it to the Pi but use port 80 instead of 8080, since that's what the Pi is listening for.

Lucas1984
Posts: 11
Joined: Sat Feb 20, 2016 10:27 am

Re: Port Forwarding Issue

Sat Feb 20, 2016 2:14 pm

Another example but with the port being re-assigned:
If you have a webserver running it will normally listen on port 80. But your IP may block port 80, so you have to use port 8080 to access your webserver. If you set the public port to 8080, and the local port to 80, when the router sees the incoming request for 8080 it will forward it to the Pi but use port 80 instead of 8080, since that's what the Pi is listening for.
How do I now log into it from a web browser since I never gave it a port number like in all the tutorial videos I have seen?

This one for example: https://www.youtube.com/watch?v=muBrjhso1tA

He gave his Pi the port 42132 at 0:42 seconds into the video.
Attachments
Untitled.jpg
Untitled.jpg (54.5 KiB) Viewed 2996 times

JimmyN
Posts: 1109
Joined: Wed Mar 18, 2015 7:05 pm
Location: Virginia, USA

Re: Port Forwarding Issue

Sat Feb 20, 2016 3:10 pm

Which port is your webserver listening on? That will be your local port number. The public port will be the one you use in your browser to access it from outside your LAN. Normally the browser will use port 80 by default, but if your IP blocks port 80 you'll have to use something like 8080. In that case the browser URL needed to access your webserver would look like xxx.xxx.xxx:8080

Lucas1984
Posts: 11
Joined: Sat Feb 20, 2016 10:27 am

Re: Port Forwarding Issue

Sat Feb 20, 2016 11:28 pm

IP thing.jpg
IP thing.jpg (51.06 KiB) Viewed 2881 times
Alright,

I think I understand now.

Is this other thing part of my problem? The script to start the noip process is working, but it doesn't appear to be getting my IP like it did last time. Do I need to reset the update interval to a lower number in order for it to get my IP sooner after booting?

Lucas1984
Posts: 11
Joined: Sat Feb 20, 2016 10:27 am

Re: Port Forwarding Issue

Sat Feb 20, 2016 11:52 pm

Now it's showing my IP address, but when I use _________.ddns.net:8080 the connection times out.

Lucas1984
Posts: 11
Joined: Sat Feb 20, 2016 10:27 am

Re: Port Forwarding Issue

Sat Feb 20, 2016 11:56 pm

I have tried disabling the router's firewall, and when I do this the browser tells me "ERROR: Network Changed"

ripat
Posts: 191
Joined: Tue Jul 31, 2012 11:51 am
Location: Belgium

Re: Port Forwarding Issue

Sun Feb 21, 2016 6:46 am

Lucas1984 wrote:Now it's showing my IP address, but when I use _________.ddns.net:8080 the connection times out.
If you are trying to connect to your server from inside the LAN it is attached to using it's WAN address, this won't usually work unless you have activated NAT Hairpin (a.k.a Nat Inside-to-Inside, a.k.a Nat Loopback, a.k.a Nat Reflection) on your router.

To see if your basic NAT is working, you have to test it from outside your LAN with an online scan service or from any hosts outside your LAN.
Using Linux command line usually boils down to these three things:
#1) Respect the privacy of others.
#2) Think before you type.
#3) With great power comes great responsibility.

Lucas1984
Posts: 11
Joined: Sat Feb 20, 2016 10:27 am

Re: Port Forwarding Issue

Sun Feb 21, 2016 7:58 am

itworks.jpg
Dude it totally works.
itworks.jpg (39.23 KiB) Viewed 2753 times
If you are trying to connect to your server from inside the LAN it is attached to using it's WAN address, this won't usually work unless you have activated NAT Hairpin (a.k.a Nat Inside-to-Inside, a.k.a Nat Loopback, a.k.a Nat Reflection) on your router.

To see if your basic NAT is working, you have to test it from outside your LAN with an online scan service or from any hosts outside your LAN.
THANK YOU MY FELLOW BELGIAN! - My dad's family is from the Roeselare area.

I took the WiFi off my phone and tried it and it loaded up immediately on my cellular network. I will look into the NAT Hairpin settings now. Thank you again so much for both knowing what my issue was, and responding to my thread.
Last edited by Lucas1984 on Sun Feb 21, 2016 9:22 am, edited 1 time in total.

ripat
Posts: 191
Joined: Tue Jul 31, 2012 11:51 am
Location: Belgium

Re: Port Forwarding Issue

Sun Feb 21, 2016 8:49 am

Glad you could make it work. Are you sure you want to use apache as webserver on the capable yet ressource limited Rpi?

Maybe you could look into lightweight web servers like lighttpd or Nginx. Nothing wrong with apache but it's on the heavy side.
http://wiki.dreamhost.com/Web_Server_Pe ... Comparison
Using Linux command line usually boils down to these three things:
#1) Respect the privacy of others.
#2) Think before you type.
#3) With great power comes great responsibility.

Lucas1984
Posts: 11
Joined: Sat Feb 20, 2016 10:27 am

Re: Port Forwarding Issue

Sun Feb 21, 2016 9:21 am

The eventual goal is to be using OwnCloud, so I will need to remove Apache I believe.

I have a book that I have been doing a lot of the set up from, and it said that I would need to download and install LAMP Stack, so I did. For right now I'm glad to have gotten this far.

Am I correct that in order to use OwnCloud I will need to remove Apache?

ghans
Posts: 7882
Joined: Mon Dec 12, 2011 8:30 pm
Location: Germany

Re: Port Forwarding Issue

Sun Feb 21, 2016 9:31 am

Obviously OwnCloud requires a Webserver , so removing
Apache would only make sense if you were to replace it
with something else.

Check the OwnCloud guide for instructions on nginx or lighttpd
if you wish to replace Apache.

ghans
• Don't like the board ? Missing features ? Change to the prosilver theme ! You can find it in your settings.
• Don't like to search the forum BEFORE posting 'cos it's useless ? Try googling : yoursearchtermshere site:raspberrypi.org

Lucas1984
Posts: 11
Joined: Sat Feb 20, 2016 10:27 am

Re: Port Forwarding Issue

Sun Feb 21, 2016 9:40 am

ghans wrote:Obviously OwnCloud requires a Webserver , so removing
Apache would only make sense if you were to replace it
with something else.

Check the OwnCloud guide for instructions on nginx or lighttpd
if you wish to replace Apache.

ghans
I was under the impression that OwnCloud either was, or had it's own server software, but evidently I'm mistaken. Would you guys advise going to a "lighter" server software for OwnCloud?

Lucas1984
Posts: 11
Joined: Sat Feb 20, 2016 10:27 am

Re: Port Forwarding Issue

Sun Feb 21, 2016 10:43 am

Nevermind I just looked at the link. Amazing how huge the disparity is. I will be removing Apache, and going with Nginx.

Thanks again!

Return to “Troubleshooting”