I'm having an issue running and connecting to my python django server on a windows 2012 server. To run the server I use command: python manage.py 0.0.0.0:80. This results in an error below
[Error 10013]: an attempt was made to access a socket in a way forbidden by its access permissions
I've tried running the command prompt as an administrator with no change. For reference, I am able to run the server on port 8000 but then I cannot connect to the port remotely. I have turned off firewalls as well so that is probably not the issue.
While it is preferable to run the django on port 80, I am trying to get this working on any port.
Port 80 (and many other ports) is reserved by Windows Server. Checkout this https://serverfault.com/questions/633179/cant-make-confluence-run-on-port-80-with-windows-server-2012-r2,
You may want to google "Windows Server Reserved port" for more info and a way to "unreserve" it.
Related
Im very new to network programming and faced a following problem:
Im working on VMware CentOS7 virtual machine on Windows10 host.
My script should send WHOIS queries and parse their output (e.g. expiration date).
However, an attempt to send a query leads to a connection error:
>>>import whois
>>>whois.query('google.com')
WhoisCommandFailed: connect: Network is unreachable
I tried to whois from terminal, but error was the same.
When i tried to use whois directly from Windows, which hosts virtual machine, the error seemed to look same as well (connection timeout).
As i found out, it was most likely related to access to port 43. I created rules (for in and out) for Windows firewall for this port by a guide , but error still persisted.
It looks like access to this port was blocked by ISP (however ping command is working).
To sum up, I got two questions there:
1) (less important) How to check if port 43 is blocked by firewall either by ISP?
2) (most important) Is it possible somehow to reconfigure WHOIS for usage of another port (i.e. 23) for sending queries by Python script?
Unfortunately, ISP security policy doesn't allow them to open 43 port.
Mostly ISP doesn't block any port but yes, this is not 100% true.
Testing connection:
run tcpdump (install command: yum install tcpdump) command on CentOS: tcpdump -peni any tcp and port 43
You have to see lines with the following text: 192.168.1.1.57350 > 192.34.234.30.43 where 192.34.234.30 IP address means the remote whois server.
Try to telnet to remote server's TCP/43 port: telnet 192.34.234.30 43
You should see the following:
Trying 192.34.234.30...
Connected to 192.34.234.30.
Escape character is '^]'.
If you can`t see context like that and you get back prompt immediately you will a firewall rule somewhere what is block connection. I recommend to switch off firewall temporarily and test again.
You cannot change port number, because it is configured on the remote side, on the server.
Can CentOS7 server communicate towards the internet? In example can you install packages?
Is there any router between windows machine and ISP?
I'm new to Docker. I get a connecting error when trying to setup Docker in PyCharm Professional edition.
I have followed this official manual and turn on the checkbox(Expose daemon on tcp://localhost:2375 without TLS)
But it still not work.
Cannot connect: io.netty.channel.AbstractChannel$AnnotatedConnectException: Connection refused: no further information: localhost/127.O.O.1:2375
caused by: java.net.ConnectException: Connection refused: no further information
I have accidentally connected docker one time.But when i restart my computer i cannot connect docker anymore.
Any further help would be gratefully appreciated.
If you are facing connection refused then there may be a chance that there is no server to respond to your request.
So first check whether docker server is listening on 2375 port.
netstat -anp tcp | findstr 2375
Or, use tcpview for GUI.
If docker is not listening on this port, then check your C:\ProgramData\Docker\config\daemon.json file and verify whether you have the below Key value pair in your JSON.
"hosts": ["tcp://0.0.0.0:2375"]
If it is not there, then add this and restart your docker daemon.
If you are behind a proxy, then make sure to add this in no-proxy, so that your requests will not be routed via a proxy server.
NOTE: I don't have any experience with docker on windows
I have written a server program using python and django and I have tested it in several computers. Now I have installed it on a HP server. While I can see that it is working when I type localhost in browser address, when I type the server's IP, I see "This webpage is not available" (ERR_CONNECTION_REFUSED).
The OS is windows server 2008. There isn't any antivirus or firewall installed and the windows firewall is disabled.
It's noticeable that the messages that I send from my server program to some other devices in the network are successfully delivering. In the other word the connection is one-way (not duplex)
Assuming you're using the Django development server:
To make your development server viewable to other machines on the
network, use its own IP address (e.g. 192.168.2.1) or 0.0.0.0 or ::
(with IPv6 enabled).
So, your command will look something like
runserver 0.0.0.0:8000
I have two computers in the same enterprise network. The one with Windows XP (IP 192.168.101.96) and the other with Windows 7 (IP 192.168.101.98).
If I start Django project on PC with Windows XP (python manage.py runserver 192.168.101.96:8001), I can easily access it from Windows 7 PC with browser.
But the opposite way doesn't work. If I start Django project on PC with Windows 7, I can't access it from Windows XP PC.
The same situation is with command python -m SimpleHTTPServer 8001.
I tried to add a rule for external connections on TCP port 8001 in Windows firewall settings. Also I tried to add python.exe to firewall exceptions, but nothing seems to work...
It should be noted that when I start Django server and execute NETSTAT -p tcp -ano command, I can see line:
TCP 192.168.101.98:8001 0.0.0.0:0 LISTENING 6920
But nevertheless, nothing work. What can be the source of the problem?
for access to another computer server , server must be run on port 80.
you must run django server on port 80
python manage.py runserver 0.0.0.0:80
then access with type ip in the browser without post number :
http://192.168.101.98/
good luck
The problem was in ESET Endpoint Security special firewall. It's "automatic mode" blocks traffic without any promt to user. The problem can be solved by adding special rule to this firewall or changing it's main policy to "interactive mode" for example.
My python application is running on port number 6666 on a linux machine to which I can connect using putty and I have sudo permissions to execute commands (I dont know root password)
1.If I change the port number in that application to 443 and if I run that application then getting some permission denied error at the time of socket binding
2.and if I use sudo for the above case then getting some module not found error.
If I open https://that_server_name:6666/path_to_my_appln from my localhost, then getting the error as cound not find response (as I am able to successfully run my application with port 6666, I ran the application and I tried to open that url)
or else if I open https://that_server_name:443/path_to_my_appln , then getting error as 503, service temporarily unavailable(as I am getting above mentioned errors for port number 443, so I did not start my application in backend)
My question is how to map 443 to an application running on 6666 port
In order to listen to a port below 1024 on Linux you need to have root permissions. You can
Run the program as root and secure it, for example by dropping privileges after binding to the socket.
Use a webserver (Apache, nginx, ...) to proxy the request.
Of cause there are some more solutions.
You should try to solve the problem of module not found error. That would be a good solution to your problem. If you post your module not found error that would be helpful. How are you running the Python application. Are you running it from a virtualenv?