Arduino Forum

Using Arduino => Networking, Protocols, and Devices => Topic started by: Nishant_Sood on Apr 04, 2013, 04:05 pm

Title: Port change from 80 to something else
Post by: Nishant_Sood on Apr 04, 2013, 04:05 pm
I have my DSL routers settings hosted at my externaladdress:80 port so I can't use this port for port forwarding, that's why I need to change the port to something else, but whenever I try with another port then my webpage simply doesn't load forget the all over external ip access, what to do?

I understand that port 80 is the standard default IP connection address but then my problem is also genuine.
Title: Re: Port change from 80 to something else
Post by: jrckart on Apr 04, 2013, 08:11 pm
most routers will allow you to change the port that they use for remote management. post make and model of you router, and i will pull up a manual and look into this for ya.
changing your router from the default of 80 is also a small step in security, as this is the place most folks would start when looking to screw with your setup.

if you are intent in on changing the server port on your Arduino with an Ethernet shield, look for a line  like this
EthernetServer server(80);
and change whats in the parenthesis.

JR
Title: Re: Port change from 80 to something else
Post by: Nishant_Sood on Apr 04, 2013, 08:28 pm
Quote
EthernetServer server(80);


As I already wrote that I have done this over and over again ,and used 5400, 81, 50,5000,192 etc ports here but in all of these I wasnt able to access the webserver on ethernet that is my Arduino.

My wireless router that also has ethernet connectivity on its back is D-Link ,DIR-524
Title: Re: Port change from 80 to something else
Post by: SurferTim on Apr 04, 2013, 08:51 pm
Did you port forward your port to the private ip? I'm not that familiar with that particular model of D-Link router, but normally that is under the advanced tab in the router setup as Virtual Server.
Title: Re: Port change from 80 to something else
Post by: Nishant_Sood on Apr 04, 2013, 08:57 pm
Quote
Did you port forward your port to the private ip?


The ethernet shield's IP on my local network is 192.168.0.104 so I port forwarded on this IP address so as such to make it accessible through my WAN:PORT.

YES , its under advanced port and I have configured this through that part only.
Title: Re: Port change from 80 to something else
Post by: AlxDroidDev on Apr 04, 2013, 09:25 pm
You  can have your external port different from your internal port.

For example:

Internal (arduino):  192.168.0.12:80

External () 212.56.89.41:88

In your router's config you'll forward its port 88 to internal address 192.168.0.12 at port 80

This way you don't have to change the Arduino's listening port, while keeping accessible for outsiders at port 88.
Title: Re: Port change from 80 to something else
Post by: Nishant_Sood on Apr 04, 2013, 09:33 pm
Quote
In your router's config you'll forward its port 88 to internal address 192.168.0.12 at port 80


You mean keeping the ethernetshield @ port 80 and still port forwarding at my routers end with port 88 will work? or you are saying that I define in my router port forwarding settings that ports 80 to 88 included in the IP 192.168.0.12
Title: Re: Port change from 80 to something else
Post by: AlxDroidDev on Apr 04, 2013, 09:56 pm

Quote
In your router's config you'll forward its port 88 to internal address 192.168.0.12 at port 80


You mean keeping the ethernetshield @ port 80 and still port forwarding at my routers end with port 88 will work? or you are saying that I define in my router port forwarding settings that ports 80 to 88 included in the IP 192.168.0.12


From the internet your Arduino will be accessible from <your valid IP address>:88

for example:

http://212.56.89.41:88   (this is a totally arbitrary address I totally made up, just to indicate a valid internet IP address)

Your router will do a port forwarding of that port to the internal address 192.168.0.12 in the port 80, and that will be invisible to the outside clients.

Now, if your are trying to access your arduino from your LAN, it is still 192.168.0.12:80

How you do that depends on the specific model of your router/gateway. It might be called something like port forwarding.
Title: Re: Port change from 80 to something else
Post by: Nishant_Sood on Apr 04, 2013, 10:00 pm
I actually mean that IF I do portforwarding on the internal IP 192.168.0.104 on port 80 in my router then how can I access my ethernet arduino at port 88 it would be accessible on port 80 only.
Title: Re: Port change from 80 to something else
Post by: AlxDroidDev on Apr 04, 2013, 10:21 pm

I actually mean that IF I do portforwarding on the internal IP 192.168.0.104 on port 80 in my router then how can I access my ethernet arduino at port 88 it would be accessible on port 80 only.


The router does that for you, automagically.

The Arduino is still accessible through port 80 only. However, every request that comes from the internet to port 88 is sent to your LAN in the port 80, so the Arduino will be able to respond. When the Arduino responds to the router, the router will send that response back to the internet client.

What you need to know is (the uppercase words are keyword you should look for in your router's config page):

ANY request from ANY source port that is sent to your ROUTER with DESTINATION port 88 will be forwarded to the INTERNAL client 192.168.0.12 in the PORT 80.


Title: Re: Port change from 80 to something else
Post by: Nishant_Sood on Apr 04, 2013, 10:26 pm
Thanks! Alex tried that but it fails

EDIT: I'm using WebServer sketch with uno
Title: Re: Port change from 80 to something else
Post by: Nishant_Sood on Apr 04, 2013, 10:34 pm
Port forwarding on the internal ethernetshield IP address set to port 80 ,
the arduino ethernet shield set to port 80,

the ethernet shield is being noticed by the router so thats not a problem,
also Im able to access the contents of the webserver using the internal IP address of the ethernetshield but not using the external IP address that is WAN on port 88.
Title: Re: Port change from 80 to something else
Post by: SurferTim on Apr 04, 2013, 11:14 pm
Have you tried allowing that port through the firewall? My router (not D-Link) requires both the destination NAT (port forward) and the port allowed on the firewall.

I use either port 8080 or 8088 for this kind of stuff.
Title: Re: Port change from 80 to something else
Post by: zoomkat on Apr 05, 2013, 04:35 am
Quote
I have my DSL routers settings


Is this router the equivalent to a "cable modem" supplied by your ISP? Does it connect directly to the DSL phone line? If so, then this may not be the router to be adjusting. You may need to connect an internal router to this device.
Title: Re: Port change from 80 to something else
Post by: Nishant_Sood on Apr 05, 2013, 03:01 pm
Quote
I use either port 8080 or 8088 for this kind of stuff.


So you mean these ports would work in place of port 80 ?

@Zoomkat

I have a DSL modem which was provided to me by the ISP ,now the phone line goes into that DSL and an ethernet cable comes out of it and then that ethernet cable is inserted into my DLINK- DIR524 WiFi router which also has some ethernet port at the back so I inserted another ethernet cable there and plugged it into my ethernet shield that's it.
I got my WAN IP using this URL >> http://checkip.dyndns.org/
Title: Re: Port change from 80 to something else
Post by: SurferTim on Apr 05, 2013, 03:11 pm
Quote
So you mean these ports would work in place of port 80 ?

Yes. Some ISPs block port 80 requests to residential ip addresses. Mine does. To get around that block, one of those ips will normally work. Insure you allow that port through your firewall.
Title: Re: Port change from 80 to something else
Post by: Nishant_Sood on Apr 05, 2013, 03:46 pm
I used port 8080 still the browser can;t link to it
Title: Re: Port change from 80 to something else
Post by: Nishant_Sood on Apr 05, 2013, 03:46 pm
internal network however works fine!

ANd! I just disabled by routers firewall
Title: Re: Port change from 80 to something else
Post by: SurferTim on Apr 05, 2013, 04:00 pm
..and you port forwarded that port to your private localnet ip? If it still doesn't work, it may be your DSL router doing the block.
Title: Re: Port change from 80 to something else
Post by: Nishant_Sood on Apr 05, 2013, 08:31 pm
Quote
..and you port forwarded that port to your private localnet ip? If it still doesn't work, it may be your DSL router doing the block.


But that what could be possible issue here? Can you outline which elements to check, I tried disabling the Firewall and restarting the router to no avail!

Should I provide you with the screenshot of my routers option/functions it supports so you may try to underline some options?
Title: Re: Port change from 80 to something else
Post by: zoomkat on Apr 05, 2013, 09:00 pm
Quote
internal network however works fine!


if you are trying to reach your arduino from outside your dlink router, you will need to use your wan ip address (or a service like no-ip.com), and have the dlink port forward the outside request to the lan ip address of your arduino.
Title: Re: Port change from 80 to something else
Post by: Nishant_Sood on Apr 05, 2013, 09:02 pm
Quote
you will need to use your wan ip address


I know this already and im doing it/trying it but IM not able to access using the WAN IP, however at the same time the internal IP communication works smooth
Title: Re: Port change from 80 to something else
Post by: zoomkat on Apr 05, 2013, 09:05 pm
Have you posted your code for evaluation?
Title: Re: Port change from 80 to something else
Post by: zoomkat on Apr 05, 2013, 09:10 pm
What are your setting on the below page?

http://support.dlink.com/emulators/di524_revc/adv_virtual.html
Title: Re: Port change from 80 to something else
Post by: Nishant_Sood on Apr 06, 2013, 08:07 am
Quote
Have you posted your code for evaluation?


My code is the very same no changes WEBSERVER ethernet example that comes with the Arduino 1.0 IDE ONLY the IP address that is 192.168.0.104 + the MAC address is changed and the Server port rest is the same.
Title: Re: Port change from 80 to something else
Post by: Nishant_Sood on Apr 06, 2013, 08:31 am
Here are the settings done regarding PORT forwarding on my router "uC"  is arduino here:

(http://www.flickr.com/photos/93413530@N06/8624125280/)
http://www.flickr.com/photos/93413530@N06/8624125280/
Title: Re: Port change from 80 to something else
Post by: Nishant_Sood on Apr 08, 2013, 04:33 am
Got time to check the screenshot zoomkat?
Title: Re: Port change from 80 to something else
Post by: zoomkat on Apr 08, 2013, 06:04 am
I looked at the screen shot, and looks fairly straight forward to enter the lan ip address used by the arduino server.

edit: if you want to use a port other than 80, then set the public port start to something 81 and the public port end to something like 91. This should allow any outside request that are wanting to access ports 81 thru 91 to be forwarded to the arduino.
Title: Re: Port change from 80 to something else
Post by: Nishant_Sood on Apr 08, 2013, 08:33 am
I think my DSL is screwed and I dnt know how to go about fixing that!

I used 81 start and 91 end port and used 8080 it doesn't work still

EDIT: tried an in between port namely 85 still the same
Title: Re: Port change from 80 to something else
Post by: Nishant_Sood on Apr 08, 2013, 09:59 am
Utilised the Dynamic DNS still the same problem , can;t make out what is the possible problem?