django not accessible from another computer - python-3.x

followed instructions here to create my first django web sever. Haven't done any major customization yet, except.
Setup settings.py:
ALLOWED_HOSTS = ['192.168.1.111', 'localhost', '127.0.0.1']
Started django from cmd prompt
python manage.py runserver 0.0.0.0:8080
All the three url link works on this local machine where django is installed:
http://127.0.0.1:8080/, http://localhost:8080/, http://192.168.1.111:8080/
I then went onto Windows Firewall settings to include 8080 as an inbound rule:
My problem is http://192.168.1.111:8080/ does throw an exception when accessed from another computer (in the same network, IP being 192.168.1.77). Error is "Site cannot be reached, took too long to respond".
I am not able to figure out what am I doing wrong. I am certain its a firewall issue. Turned off windows firewall on 192.168.1.111 and it worked from 192.168.1.77. Question still remains - How do I make it work with firewall on on 192.168.1.111.
My python version is 3.9 and django version is 3.2. FYI - I moved to 8080 just for kicks. I had same issue with 8000.
Two things worth noticing:
(1) 192.168.1.111:8080 does throw a "Not secure connection" warning on the primary machine (where django is installed)
(2) netstat seems OK too:
C:\Windows\system32>netstat -ab
Active Connections
.
.
[postgres.exe]
TCP 0.0.0.0:7680 DEVSERVER:0 LISTENING
Can not obtain ownership information
TCP 0.0.0.0:8080 DEVSERVER:0 LISTENING
[python3.9.exe]
TCP 0.0.0.0:49664 DEVSERVER:0 LISTENING
.
.
Can not obtain ownership information
TCP 192.168.1.111:8080 DEVSERVER:50515 ESTABLISHED
[python3.9.exe]
TCP 192.168.1.111:49800 52.226.139.121:https ESTABLISHED
[SearchApp.exe]
TCP 192.168.1.111:50502 52.182.141.63:https TIME_WAIT
TCP 192.168.1.111:50515 DEVSERVER:8080 ESTABLISHED
.
.
C:\Windows\system32>
192.168.1.111:8080 just doesn't seem to work from any computer within the network. Tried from 192.168.1.77 (windows/chrome) and 192.168.1.75(windows/firefox)

OK.. so it was a firewall issue. Apparently, there was another outbound rule with python.exe that was override=True and blocking Public or Private UDP or TCP. I don't even remember. I just deleted all TCP rule relating to python and just kept one (noted in my question above). Its working now

Related

Connecting to host from inside a docker container on linux requires opening firewall port

Background: I'm trying to have XDebug connect to my IDE from within a docker container (my php app is running inside a container on my development machine). On my Macbook, it has no issue doing this. However, on linux, I discovered that from within the container, the port I was using (9000) was not visibile on the host gateway (Using sudo nmap -sT -p- 172.20.0.1 where 172.20.0.1 is my host gateway in docker).
I was able to fix this issue by opening port 9000 on my development machine (sudo ufw allow 9000/tcp). Once I did this, the container could see port 9000 on the host gateway.
My Question: Is this completely necessary? I don't love the idea of opening up a firewall port just so a docker container, running on my machine, can connect to it. Is there a more secure alternative to this?
From what you've told us, opening the port does sound necessary. If a firewall blocks a port, all traffic over that port is blocked and you won't be able to use the application on the container from the host machine.
What you can do to make this more secure is to specify a specific interface to open the port for as specified here:
ufw allow in on docker0 port 9000 proto tcp
Obviously replace docker0 with the docker interface on your machine. You can find this by looking at the output of ip address show or by following the steps here if the interface name is not obvious.

P4V not connecting to my DigitalOcean Droplet when setting up a Perforce Server

I'm trying to set up a Perforce Server using a Droplet from DigitalOcean and connect to it via P4V.
I was following this tutorial https://allarsblog.com/2014/09/25/setup-perforce-digital/ which I was originally led to by an Unreal Engine official YouTube tutorial. When I got to the part where I was supposed to connect via P4V I got the following error:
Connect to server failed; check $P4PORT.
TCP connect to [Droplet IP Address]:1666 failed.
connect: [Droplet IP Address]:1666: WSAECONNREFUSED
I posted on the DigitalOcean forum and they suggested I try to set the P4PORT then verify it with p4 info, but the p4 info command only yields the following:
Perforce client error:
Connect to server failed; check $P4PORT.
TCP connect to devel:1666 failed.
No such host is known.
Since it said no such host is known, I tried using the direct IP Address in the place of devel, and that only returned the same result but it also said connect: [IP Address]:1666: WSAECONNREFUSED.
I can ping the IP Address just fine. Connecting via puTTY (port 22) does not seem to be an issue. I'm using Windows 10, I heard Firewalls could produce this problem but even if I disable my Firewall I get the same errors.
This is my first time doing this, so I may have made a beginners mistake. Any help would be appreciated.
Found my answer in another Forum: Fire up PuTTY and log in as “root” Type “p4d” from the command line (If you don’t see it, it should be located in “/usr/local/bin”)
I had a similar issue.
To clear the " WSAECONREFUSED " error we put Server:[DigitalOcean ServerIP]:1666 and clicked the "New" button for user.
We were prompted with a new error -> WSAETIMEDOUT
to solve this we had to open the 1666 port on the server so we opened the up and down 1666 using these commands.
iptables -I INPUT -p tcp --dport 1666 --syn -j ACCEPT
&
iptables -I INPUT -p udp --dport 1666 -j ACCEPT

The controller is not available at localhost JBOSS.7.1.1.FINAL

When i run the jboss-cli.sh,
I get this message.
[root bin]# sh jboss-cli.sh
You are disconnected at the moment. Type 'connect' to connect to the server or 'help' for the list of supported commands.
[disconnected /] connect localhost
The controller is not available at localhost:9999
[disconnected /] connect
The controller is not available at localhost:9999
[disconnected /] connect localhost:9999
The controller is not available at localhost:9999
[disconnected /]
Also i have another installation of jboss5 GA. I hope that is not interfering.
Although that is totally shut down for now.
Native management interface is :9999 in standalone.sh
Please throw light on this issue.
#
EDITED
#
When i stop my service with "service jboss stop"
i get this message
[root# bin]# *** JBossAS process (7302) received KILL signal ***
grep: /var/run/jboss-as/jboss-as-standalone.pid: No such file or directory
I Dont know how to check whether server is listening on the port 9999 or not.
Few more details
[root bin]# netstat -anp |grep 9999
tcp 0 0 127.0.0.1:9999 0.0.0.0:* LISTEN 7931/java
[root bin]# netstat -anp |grep 8080
tcp 0 0 0.0.0.0:8080 0.0.0.0:* LISTEN 7931/java
JBoss processs id and the server id acquiring these ports is same.
This question has two issues ,
First, i have provided debuging parameter in the startup script.
If you see 8787 that means you have somewhere provided debuging argument.
Second and the most important one controller not available #localhost or #IPADDRESS .
Please check if you have used port offset, as it increments all the ports by the number with with you have set port offset.
Suppose port offset is 2
Then try to access connect localhost:10001 Port i.e 9999+2
On my production server sometimes it does not works with localhost , but works with IP address.
Then try to access connect IPADDRESS:9999
OR
Then try to access connect 127.0.0.1:9999
Please check in the firewall weather the port 9999 or what ever with port offset, if the port is not open in the firewall it gives error,
I asked this question 6 months back and the above checks has solved
the problem always.
This is probaby because you have changed your binding configuration and jboss does not bind to 127.0.0.1.
In case your jboss instance is not binding to 127.0.0.1, you may use --controller option as follows:
./jboss-cli.sh --controller=YOUR_IP:9999
Use netstat -anp |grep 9999 to find out if port 9999 is in use and by which process id. You could also check the host.xml used by the controller to configure the proper native port.
In the host xml, you should find the default port:
<native-interface security-realm="ManagementRealm">
<socket interface="management" port="${jboss.management.native.port:9999}"/>
./jboss-cli.sh --controller=localhost:9999 --connect
You open the debug-port with jboss-cli.sh. Either you activated in jboss-cli.sh:
# Sample JPDA settings for remote socket debugging
# JAVA_OPTS="$JAVA_OPTS -Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=n"
or you set JAVA_OPTS with such an option in you environment. See
echo $JAVA_OPTS
I guess you did this for two jboss-processes, and you get a port-conflict. See
netstat -nap | grep 8787
I recently faced this issue and the root cause that I found was completely different than it is listed above. It is because for some other project I shifted to JDK 1.8 from 1.7. Boom! and error started coming up...I took hell lot of time figuring out why it is coming up before finally realizing I changed my JDK version.
It might be because JBOSS 7 doesn't work with 1.8 of which I have limited knowledge but yes this might prove useful for some cases.

node.js and npm has no network access in windows 7 64 bit ultimate

NOTE: to anyone else who has this problem, I tried all suggestions and all research. In the end I formatted the hard drive and reinstalled windows. Even though it was a fresh install from the start some windows installations just appear to not work at all with node. As far as I know this is the only solution.
So to start with, I already found the similar question:
Basic Node.js examples not working on Windows 7 which seems to be the same issue but there is no solution. I have also found forum posts online with no solutions but many people posting the same issues.
Node.exe and npm both appear to have no network access. npm install sends the get requests and never get a response. Node scripts that go to access a mongodb never send the connection request. I copied this code from my old machine to my new one. It was the first thing i put on the new machine. The old machine was running windows 7 64 home premium and the new one windows 7 64 ultimate. I've tried all compatibility modes, running as administrator, disabling windows firewall, there is no antivirus yet, i uninstalled/reinstalled, and I've tried changing the versions even though the version from old computer to new are the same. I've searched stackoverflow and the internet and have found others with the problem but no solutions. I have a virtual box ubuntu vm that can run node successfully however I would like to be able to run it without a vm if possible and I can't seem to find any cause of the problems. Even OEM software between the two computers are nearly identical since the old was an alienware m15x and the new is an m14x. Any help is appreciated.
edit:
I'm using the latest version currently (0.6.10). After running npm install and having it hang, i used netstat and got the following results under node.exe:
[node.exe]
TCP 10.20.21.225:49690 ec2-107-20-159-167.compute-1.amazonaws.com:https ESTABLISHED
[node.exe]
TCP 10.20.21.225:49691 nuq04s08-in-f31.1e100.net:https TIME_WAIT
TCP 10.20.21.225:49692 fa-in-f94.1e100.net:https TIME_WAIT
TCP 10.20.21.225:49693 nuq04s08-in-f19.1e100.net:http TIME_WAIT
TCP 10.20.21.225:49696 nuq04s08-in-f25.1e100.net:http TIME_WAIT
TCP 10.20.21.225:49702 nuq04s08-in-f6.1e100.net:http TIME_WAIT
TCP 10.20.21.225:49703 nuq04s08-in-f25.1e100.net:http TIME_WAIT
TCP 10.20.21.225:49704 nuq04s08-in-f25.1e100.net:http TIME_WAIT
TCP 10.20.21.225:49706 nuq04s08-in-f26.1e100.net:http TIME_WAIT
TCP 10.20.21.225:49707 nuq04s08-in-f26.1e100.net:http TIME_WAIT
TCP 10.20.21.225:49708 nuq04s08-in-f26.1e100.net:http TIME_WAIT
TCP 10.20.21.225:49709 nuq04s08-in-f26.1e100.net:http TIME_WAIT
Now when I run the example server on the node.js homepage, I cannot get the hello world in the browser however the connection is in netstat:
[node.exe]
TCP 127.0.0.1:1337 Robbie-PC:49805 ESTABLISHED
[node.exe]
TCP 127.0.0.1:7789 Robbie-PC:49158 ESTABLISHED
but when i wait a little while it changes to:
[node.exe]
TCP 127.0.0.1:1337 Robbie-PC:49805 CLOSE_WAIT
[node.exe]
TCP 127.0.0.1:7789 Robbie-PC:49158 ESTABLISHED
edit 2:
so I tried disabling all other connections.. no luck. Then I tried to use the debugger in eclipse, even eclipse couldn't find the vm's debugger broadcasting on port 5858. It literally just has no connection. So unless someone finally has any other ideas aside from wiping the hard drive and reinstalling windows, then I think this computer is going back to alienware as DOA. lets hope the next one doesn't have this problem. Thanks to all those who suggested things in the comments and to everyone who attempted to investigate a solution for me.
If you are behind a corporate network which probably needs proxy configuration on node to be setup. It runs something like this
npm config set proxy http://proxy.company.com:8080
npm config set https-proxy http://proxy.company.com:8080
Replace the proxy company name to whatever your network uses.
With the same OS I don't have this problem, but I already have problems downloading some packages (I wanted node mysql). In order to fix that I had to download the source from github, extract it in the node_modules repository and to rename it as "mysql".
Now I can make var mysql = require('mysql');
Maybe even try cygwin. Its a step back from both pure virtual Linux, and from getting it to run on Windows 7. Personally I have both Cygwin and Windows 7 installs of node.js on 64 bit (not ultimate though).
I just had to install node to a directory outside of 'program files' due to write protection and security settings. Still have to run the command console as administrator though to make sure all things work. Cygwin has none of these issues.

IIS and Glassfish in Windows 7

I installed the newest version of Windows 7.
This is my development box, so I have glassfish installed, which I use for Java applications. Also, I use IIS to run PHP applications. I run both servers on port 80, but never at the same time.
However, since I set up IIS, I can't get glassfish to run. In eclipse, it always gives the following error:
Port conflict: Please stop the server process using the same port as the one used by the Application Server.
A server process is already running on this port but we cannot determine if it's a GlassFish process (lack of info or credentials).If you do not find something else running on this port, check for antivirus software blocking or monitoring this port.
Edit: I tried turning off IIS, and even turned off the IIS feature. Still no luck.
I also ran netstat, and the following are showing up on ports that glassfish uses:
Proto Local Address Foreign Address State
TCP 0.0.0.0:80 NBSDTVL01574:0 LISTENING
TCP [::]:80 NBSDTVL01574:0 LISTENING
Thanks
This turned out to be an issue with my virtual machine. A fresh copy fixed the issue.
this happen because you select the same port number use by the iis and glashfish, i suggest you configure either of the two to use different port number.

Resources