External access

172 views
Skip to first unread message

bob gailer

unread,
Nov 7, 2016, 8:48:56 AM11/7/16
to Django users
I am running a the django server, listening at port 8000. I can access
the server using localhost. When I try using my external ip address I
get "The server at 24.211.133.163 is taking too long to respond." I have
port 8000 forwarded to my server computer in my router. What more do I
need to do?


GMail

unread,
Nov 7, 2016, 8:52:26 AM11/7/16
to django...@googlegroups.com
Hi! Seems like port forwarding doesn't work correctly. Do you have any other ports forwarded (like ssh or ftp)? If so, do they work as expected?

What is this command's output:
telnet <external_ip> 8000

> On 7 Nov 2016, at 16:48, bob gailer <bga...@gmail.com> wrote:
>
> I am running a the django server, listening at port 8000. I can access the server using localhost. When I try using my external ip address I get "The server at 24.211.133.163 is taking too long to respond." I have port 8000 forwarded to my server computer in my router. What more do I need to do?
>
>
> --
> You received this message because you are subscribed to the Google Groups "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
> To post to this group, send email to django...@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/0fb3e7f8-0c7c-4976-4f8d-a8e914b0b3cb%40gmail.com.
> For more options, visit https://groups.google.com/d/optout.

Larry Martell

unread,
Nov 7, 2016, 8:52:40 AM11/7/16
to django...@googlegroups.com
Is the port open on the firewall? What OS are you on?

Andreas Kuhne

unread,
Nov 7, 2016, 8:58:31 AM11/7/16
to django...@googlegroups.com
Do you have "ALLOWED_HOSTS" correclty configured in django settings?

Regards,

Andréas

2016-11-07 14:48 GMT+01:00 bob gailer <bga...@gmail.com>:
I am running a the django server, listening at port 8000. I can access the server using localhost. When I try using my external ip address I get "The server at 24.211.133.163 is taking too long to respond." I have port 8000 forwarded to my server computer in my router. What more do I need to do?
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.

Michal Petrucha

unread,
Nov 7, 2016, 9:26:14 AM11/7/16
to django...@googlegroups.com
By default, runserver only binds to 127.0.0.1:8000, which makes it
only accessible over the loopback interface. If you want to make it
accessible from all interfaces, try starting it up like this:

./manage.py runserver 0.0.0.0:8000

Good luck,

Michal
signature.asc

bob gailer

unread,
Nov 7, 2016, 1:16:18 PM11/7/16
to django...@googlegroups.com
How would I determine that?
> What OS are you on?
Windows 10.

Bob

bob gailer

unread,
Nov 7, 2016, 1:19:29 PM11/7/16
to django...@googlegroups.com
On 11/7/2016 8:51 AM, GMail wrote:
> Hi! Seems like port forwarding doesn't work correctly. Do you have any other ports forwarded (like ssh or ftp)? If so, do they work as expected?
>
> What is this command's output:
> telnet <external_ip> 8000
Sorry but I'm running Windows 10 which does not recognize "telnet"

Bob

Larry Martell

unread,
Nov 7, 2016, 1:20:19 PM11/7/16
to django...@googlegroups.com
Sorry, I do not know anything about Windows.I only work with Linux.

bob gailer

unread,
Nov 7, 2016, 1:22:23 PM11/7/16
to django...@googlegroups.com
On 11/7/2016 8:58 AM, Andreas Kuhne wrote:
> Do you have "ALLOWED_HOSTS" correclty configured in django settings?
Thanks - was not aware of that. Now it looks like:
ALLOWED_HOSTS = ['209.216.2.211', '209.216.15.70', '24.211.133.163']
The last one is my external ip

Adding the ip addresses did not fix the problem.
>
> Regards,
>
> Andréas
>
> 2016-11-07 14:48 GMT+01:00 bob gailer <bga...@gmail.com
> <mailto:bga...@gmail.com>>:
>
> I am running a the django server, listening at port 8000. I can
> access the server using localhost. When I try using my external ip
> address I get "The server at 24.211.133.163 is taking too long to
> respond." I have port 8000 forwarded to my server computer in my
> router. What more do I need to do?
>
>
> --
> You received this message because you are subscribed to the Google
> Groups "Django users" group.
> To unsubscribe from this group and stop receiving emails from it,
> send an email to django-users...@googlegroups.com
> <mailto:django-users%2Bunsu...@googlegroups.com>.
> To post to this group, send email to django...@googlegroups.com
> <mailto:django...@googlegroups.com>.
> <https://groups.google.com/group/django-users>.
> <https://groups.google.com/d/msgid/django-users/0fb3e7f8-0c7c-4976-4f8d-a8e914b0b3cb%40gmail.com>.
> For more options, visit https://groups.google.com/d/optout
> <https://groups.google.com/d/optout>.
>
>
> --
> You received this message because you are subscribed to the Google
> Groups "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to django-users...@googlegroups.com
> <mailto:django-users...@googlegroups.com>.
> To post to this group, send email to django...@googlegroups.com
> <mailto:django...@googlegroups.com>.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CALXYUbmDO8hxr%2B1tFbUqtwkaQ9eECkPy%2BtT2M1%2Bj3%3DUj1-oJHA%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CALXYUbmDO8hxr%2B1tFbUqtwkaQ9eECkPy%2BtT2M1%2Bj3%3DUj1-oJHA%40mail.gmail.com?utm_medium=email&utm_source=footer>.
> For more options, visit https://groups.google.com/d/optout.


--
Image and video hosting by TinyPic

GMail

unread,
Nov 7, 2016, 1:24:06 PM11/7/16
to django...@googlegroups.com
Wow... Indeed, in Windows telnet is disabled by default. Here's how you can enable it (first link on Google): https://www.rootusers.com/how-to-enable-the-telnet-client-in-windows-10/
I believe the problem is (how somebody already mentioned earlier) your port is inaccessible from external network or server is only serving on lo (loopback interface, also was mentioned earlier). You could easily test both cases with telnet. And I forgot to mention, that you should probably run telnet on separate machine (not the one serving Django), since you have no problem accessing your server locally.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.

bob gailer

unread,
Nov 7, 2016, 1:54:05 PM11/7/16
to django...@googlegroups.com
On 11/7/2016 1:23 PM, GMail wrote:
> Wow... Indeed, in Windows telnet is disabled by default. Here's how
> you can enable it (first link on Google):
> https://www.rootusers.com/how-to-enable-the-telnet-client-in-windows-10/
C:\Users\bgailer>telnet 24.211.133.163
Connecting To 24.211.133.163...Could not open connection to the host, on
port 23: Connect failed.

C:\Users\bgailer>ftp 24.211.133.163
> ftp: connect :Connection timed out
> I believe the problem is (how somebody already mentioned earlier) your
> port is inaccessible from external network or server is only serving
> on lo (loopback interface, also was mentioned earlier). You could
> easily test both cases with telnet.
How would I do that?
> And I forgot to mention, that you should probably run telnet on
> separate machine (not the one serving Django), since you have no
> problem accessing your server locally.
I have no machines that are not on my lan.
>
>> On 7 Nov 2016, at 21:19, bob gailer <bga...@gmail.com
>> <mailto:bga...@gmail.com>> wrote:
>>
>> On 11/7/2016 8:51 AM, GMail wrote:
>>> Hi! Seems like port forwarding doesn't work correctly. Do you have
>>> any other ports forwarded (like ssh or ftp)? If so, do they work as
>>> expected?
>>>
>>> What is this command's output:
>>> telnet <external_ip> 8000
>> Sorry but I'm running Windows 10 which does not recognize "telnet"
>>
>> Bob
>>
>> --
>> You received this message because you are subscribed to the Google
>> Groups "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it,
>> send an email to django-users...@googlegroups.com
>> <mailto:django-users...@googlegroups.com>.
>> To post to this group, send email to django...@googlegroups.com
>> <mailto:django...@googlegroups.com>.
> --
> You received this message because you are subscribed to the Google
> Groups "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to django-users...@googlegroups.com
> <mailto:django-users...@googlegroups.com>.
> To post to this group, send email to django...@googlegroups.com
> <mailto:django...@googlegroups.com>.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/5F9B0BC5-2D58-46A9-B304-AFA2FF777419%40gmail.com
> <https://groups.google.com/d/msgid/django-users/5F9B0BC5-2D58-46A9-B304-AFA2FF777419%40gmail.com?utm_medium=email&utm_source=footer>.
> For more options, visit https://groups.google.com/d/optout.


GMail

unread,
Nov 7, 2016, 2:41:17 PM11/7/16
to django...@googlegroups.com
> Connecting To 24.211.133.163...Could not open connection to the host, on port 23: Connect failed.
You forgot to specify port, command should be 'telnet 24.211.133.163 8000' (if you're running Django on different port, change 8000 to your port).

> How would I do that?
I believe it was mentioned earlier in this thread: 'python manage.py runserver 0.0.0.0:8000' or 'python manage.py runserver [::]:8000' for ipv6 (probably not your case though).

> I have no machines that are not on my lan.
I've actually tried to connect to your server from my machine:
% telnet 24.211.133.163 80
Trying 24.211.133.163...
telnet: Unable to connect to remote host: Connection refused
% telnet 24.211.133.163 443
Trying 24.211.133.163...
telnet: Unable to connect to remote host: Connection refused
% telnet 24.211.133.163 8000
Trying 24.211.133.163...
<nothing happens>

It seems like your router or Windows firewall (or it may be any antivirus software with embedded firewall installed on your server) is rejecting connections to 8000 port. Unfortunately, I can't help you with any Windows-related issues.

I could try to help you with your router settings, but I think, since this is not about Django anymore, this discussion should not take place in django-users@. Feel free to contact me personally though.
> To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
> To post to this group, send email to django...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/4a92ce05-eee8-038c-b1ef-6dd15e699087%40gmail.com.

Thomas Fuller

unread,
Nov 7, 2016, 3:19:26 PM11/7/16
to django...@googlegroups.com
I don't totally understand how it works under the hood, but using the answer Michal Petrucha provided earlier has worked for me in this situation independent of the OS and any router settings.

Run the server using:
python manage.py runserver 0.0.0.0:8000

You'll be able to get to at http://<your ip>:8000 from the machine running the server. With most default router configurations you should also be able to access 
it from any computer on your LAN at the same url.
If you need to access it outside your LAN you'll have to delve into port forwarding

-Thomas

To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.

bob gailer

unread,
Nov 9, 2016, 4:40:30 PM11/9/16
to django...@googlegroups.com
Here is an update on my situation.

Windows firewall - I setup in and outbound rules for port 8000 (UDP and TCP)
Router - I set up port forwarding for port 8000 (UDP and TCP)
Using example code in the socket module documentation I ram
socket_client and socket_server on my local machine with the port=8000
and host=my external IP . It worked just fine.
When I run the django server instead of the socket server and attempt
browser access thru my external IP I get a timeout.
Nothing appears on the console running the server.

So something is different . Any ideas?

I presume that the browser - django server communication at most uses
TCP and/or UDP.

Any ideas are welcome.

Antonis Christofides

unread,
Nov 10, 2016, 3:12:23 AM11/10/16
to django...@googlegroups.com
When you reply to a message please include the previous emails of that thread.
People who read this list on a mail client might have deleted them and they are
probably not going to look them up elsewhere in order to remember what the
problem was.

So, how are you running the Django development server? "python manage.py
runserver 0.0.0.0:8000"?

Antonis Christofides
http://djangodeployment.com

Luis Zárate

unread,
Nov 10, 2016, 1:44:44 PM11/10/16
to django...@googlegroups.com
First, start testing you machine port is available in your local network run


python manage.py runserver 0.0.0.0:8000

In other machine in the same network test it
Suppose your django machine has  internal ip address 192.168.1.100, then try to access 192.168.1.100:8000 from your web browser in the other machine.

If works then your problem is the NAT on router, if don't your problem is your firewall in the machine, so try to shutdown firewall and try again if works then test external IP if works then configure your firewall for incoming traffic and start it again.



So
> --
> You received this message because you are subscribed to the Google Groups "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
> To post to this group, send email to django...@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/c9803196-8a68-04e2-1fe8-086b43b9e7d5%40djangodeployment.com.

> For more options, visit https://groups.google.com/d/optout.
>

--
"La utopía sirve para caminar" Fernando Birri



Reply all
Reply to author
Forward
0 new messages