Page 1 of 1

Port Forwarding Issue

Posted: Tue Feb 25, 2020 5:14 pm
by dnoci001
I have tested some server code on my local network and it works fine.
I'm having trouble setting up port forwarding for external access to the server. I have a SR515ac router.
I have set up a static IP for my machine and have also added it to the static lease list.
I have disabled the firewall on my machine to isolate the problem.
On the router I have done a few things.
I have gone to virtual server setup and added a new row with the desired port 1234 for external start and end and internal start and end. This also has the static IP I have previously defined and uses eth4.1.
I have added this information also to the NAT port triggering.
In Security ->IP filtering -> Incoming I have also added a rule to accept any traffic going to port 1234.

This is all new to me so I imagine I have done something very naive. Is there anything In particular I might have done wrong?

Thanks!

Re: Port Forwarding Issue

Posted: Thu Mar 05, 2020 2:37 pm
by ngufra
I don't know the devices you are using so it's a guess.

Do you have to specify TCP or UDP or both in the port forwarding? If so it is set correctly?

Are you trying to access your service from inside or from outside your home? The port forwarding is design to forward between WAN and LAN.


If i understand right:
Router is DHCP server and always give the same ip to you computer (based on physical address).
Check on your computer that the ip is the one you expected.
Computer has firewall off. Computer has a service waiting for connections on the port 1234
You have found your sonic connection ip address (or use a dynamic dns service)
you set port forwarding so that connection arriving on WAN port of router for port 1234 are sent to your computer (say 192.168.1.4) also on port 1234 (it could be a different port)

you try to reach the address of the router from outside your home (neighbor/cell network) on port 1234 and expect the packets forwarded to your computer.

This should work.

Re: Port Forwarding Issue

Posted: Tue Nov 24, 2020 1:27 pm
by quoyle
This is also not working for me. I have a server running on port 3000. My computer's IP address from the DHCP server is 192.168.42.2. I can access it at http://localhost:3000/ and also at http://192.168.42.2:3000/. But when I go to http://<my external ip>:3000/, I cannot access it. So I have tried setting the router to forward port 3000 to address 192.168.42.2. I have tried it with all three options for "Use interface" (ipoe_0_0_35/atm0.1, ipoe_0_1_1/ptm0.1, and ipoe_eth4/eth4.1), though I do not know what these mean. I have also tried it with TCP, UDP, and TCP/UDP settings for the "Protocol," but it doesn't work with any combination. All I get is "This site can’t be reached" from my web browser (same message as if the server isn't running). I have also used Wireshark to inspect the outgoing packets, and I can see that connecting to http://<my external ip>:3000/ sends packets out and never gets a response. I have also tried this same setup running the same server with a different (Linksys) router and it worked there too. Is there anything else I can try to get this port forwarding working on this router?

Re: Port Forwarding Issue

Posted: Tue Nov 24, 2020 1:44 pm
by ngufra
You can set protocol to tcp/udp so it will forward any up packet.
Do you need to specify external ans internal port? Basically you are asking that any packet that arrives to your router on its external address on port 3000 should be forwarded to 192.168.42.2 also on port 3000. You have confirmed that the service is running and accessible from your network.
Can you provide screenshots (blackout the confidential info like Mac address and public ip)
There was a similar question recently. Search the forum

Re: Port Forwarding Issue

Posted: Tue Nov 24, 2020 6:07 pm
by quoyle
Thank you for replying, ngufra. The internal and external ports should be the same, as far as I understand. At least, that's how I set it up in the past with my other router. I attached a screenshot showing many windows. You can see that connecting through localhost and through the LAN IP works (I get the "swashbuckler" page). The black windows at the bottom show the application running. Although they do not say "hosting on <external IP>," they should still work with the external IP as they have in the past. You can also see the browser's "this site cannot be reached" messages from the external IP page. On the right, I show the DHCP table and the NAT settings. Hopefully this information helps. I will keep on looking through more forum posts for help too.

Re: Port Forwarding Issue

Posted: Tue Nov 24, 2020 6:54 pm
by ngufra
It seems you try to use your external ip from inside your network. You need to ask a friend of yours from their house to connect to your public ip;3000.
Or on your phone disable wifi and try using the 4g network.
Your router is 192.168.42.1?
What is 192.168.1.3?

Re: Port Forwarding Issue

Posted: Tue Nov 24, 2020 10:33 pm
by ds_sonic_asif
Perhaps this is what you need. I had to add this static lease to make an internal service visible.

Re: Port Forwarding Issue

Posted: Wed Nov 25, 2020 7:48 am
by kyle.depasquale
quoyle wrote:
Thank you for replying, ngufra. The internal and external ports should be the same, as far as I understand. At least, that's how I set it up in the past with my other router. I attached a screenshot showing many windows. You can see that connecting through localhost and through the LAN IP works (I get the "swashbuckler" page). The black windows at the bottom show the application running. Although they do not say "hosting on <external IP>," they should still work with the external IP as they have in the past. You can also see the browser's "this site cannot be reached" messages from the external IP page. On the right, I show the DHCP table and the NAT settings. Hopefully this information helps. I will keep on looking through more forum posts for help too.


When you're trying to access the swashbuckler page from the external IP, are you doing so from your local network, or are you doing it from outside the network (like on your phone, but disconnected from your Wifi)? Because of how NAT works, I don't believe you will be able to access your internal service via an external IP address while on the same network.

Re: Port Forwarding Issue

Posted: Wed Nov 25, 2020 10:18 am
by quoyle
@ngufra and @kyle.depasquale you were right! Thank you! I should have read ngufra's original reply a little more carefully. Accessing http://<my external ip>:3000/ from inside my own network does not work, but connecting to it from outside does. So I had it right the whole time! This was surprising to me because with my old router I could connect just fine by going from my computer > modem/router > internet > modem/router > forward to my computer. But I guess with this router I cannot do that. Is there an explanation of why this is the case? Or a setting to change that would allow this type of "out-and-back-in" connection?

EDIT: I have discovered that going out and back in is called "NAT loopback" or an "NAT hairpin" connection. Does the SR515ac support this option?

Re: Port Forwarding Issue

Posted: Wed Nov 25, 2020 11:01 am
by ngufra
Glad it worked. Now make sure you set dhcp so the server is always assigned the same ip.
And use something like no-ip dynamic Dns service so you get a name and don't have to keep track of the numeric up.