How do I block a loopback connection to some port on Windows? - c++

Adding an inbound Windows Firewall rule (via COM from C++) for local port 80 and addresses ANY, 127.0.0.1 or 0.0.0.0 does not block a local browser from accessing a local web server running on port 80. For debugging/testing purposes, I need to simulate loss of network connectivity between two programs running on the same computer. Is there a way to do this programmatically, on the command line, or with a tool?
In this question, they say allegedly there is no way to do this in the Windows Firewall:
How do I block localhost connections with the Windows 7/2008R2 firewall?
Is there a way, other than Windows Firewall, just to simulate loss of network connectivity between programs running on the same computer?

There is WIPFW -- a Windows port of FreeBSD's IPFW. However, I failed to get it to block localhost connections. Maybe you'll have more luck.
Alternatively, you can try a hack. If your programs establish a connection using the localhost host name instead of directly by the 127.0.0.1 IP address, you may change your hosts file to point the localhost name to some non-existing or otherwise unreachable address.

Related

Tomcat9 remote debugging

Is there some trick for remote debugging a Tomcat9 from outside localhost?
I have a AWS bastion -> server setup and on the server itself
ss -tunlp sees 127.0.0.1:8787 0.0.0.0:*
but nmap on the bastion server doesn't see 8787 open
the other (visible) stuff on the server ss lists as *:port which looks "wider" for sure
The security group for the server is OK and a reachability analysis confirms it. A also see all the other stuff (MySQL, RDP, SSH etc) that I use in exactly the same way
Thanks in advance,
Nik
/etc/default/tomcat9 (on Ubuntu 20) has the line
#JAVA_OPTS="${JAVA_OPTS} -agentlib:jdwp=transport=dt_socket,address=8000,server=y,suspend=n"
which should be uncommented but apparently is implicitly for binding the listener only on localhost. Changing the port format to
JAVA_OPTS="${JAVA_OPTS} -agentlib:jdwp=transport=dt_socket,address=*:8080,server=y,suspend=n"
widens the binding to external access

How can I change listening port of SSDT from localhost to interface IP of my machine

I would like to ask if its possible to change listening port of Integrated Workspace Database server to be able to listen on interface of my machine so remote users can connect. I have Visual Studio 2017 - SSDT installed and Integrate Workspace listening on localhost:some port
I can connect to the port via PowerBI running on my local machine. I would like to enable it also for remote user.
I tried:
port forwarding, it is displayed in CMD proxy output but does not work
firewall is OFF
No other proxy or anything else is on the computer
Based on my further analysis you cannot change the port or set it to specific port, it always connects to the random free port. However what you can do is to use Port Forwarding on your machine
e.g. like this
netsh interface portproxy add v4tov4 listenport=3340 listenaddress=10.1.1.110 connectport=3389 connectaddress=127.0.0.1 - because it also listens on this loopback address

Ports open, but no one can connect

I am programming a server system for a small RPG game made with SFML. This is my first project since we switched our ISP to Comcast and I am having trouble with people connecting to the server. I can connect locally fine and all of the port checking tools say that the port is open, but my friends cannot connect using my external IP. I turned my firewall off on my router and on my computer to see if it'd help the situation at all, but the same thing is occurring.
Comcast gave me an Arris TG862G-CT router.
Here's an image of the port forwarding page:
The port is shown as open, but my client cannot connect:
I'm not sure which language you are using, but many make a distinction between opening a port with the host address 127.0.0.1, 0.0.0.0, and localhost. Many times you will need to use 0.0.0.0 to connect from an external pc where as 127.0.0.1 and localhost are used as a loopback and only accessible by you.

Wamp server "The connection to the server timed out" error

I'm using WAMP in my localhost, I put it online, now I did ipconfig in my cmd, my ipv4 address looks like 192.xxx.x.xx,
when I access that address in my PC's browser, it loads my localhost (which is expected), but when I load that ip address in my android tablet device, I'm getting an error:
"The connection to the server timed out"
Anyone knows a fix? Thanks a lot!
are you sure your pad and your PC is in the same lan?
If your Android device and PC are on the same LAN then it is possible that a firewall on your PC is blocking access. Check that Apache (and port 80) are allowed in the firewall configuration.
There are three possibilities for this Problem
Server (your pc) and Client(another pc) are not belongs to same network
Firewall Blocked Connection, Check the OS firewall and also Antivirus if any
The both client and server belongs to same network as public, there is
possibilities to Block, change that private mode and check

How to connect from a VMware guest machine to the server installed on a Windows 7 host machine?

How to connect from a VMware guest (virtual) machine to the server installed on the host (physical) machine? Things like typing "localhost" in the address bar of a browser in a guest machine don't work. My host machine's OS is Windows 7 64 bit with WMware Workstation installed on it, if it matters.
EDIT: The Bridged network connection in combination with referring to 192.168.0.10* from the guest machine did work (replace * with a digit starting from 0 until it works).
If you use "Bridged" Network Connection (see Virtual Machine Settings: Network Adapter), your VM will be given an IP address on the same LAN as your host machine. At that point, you can just HTTP to your host's IP address, eg. http://192.168.0.100
You can also do that with the other options, but with NAT and Host-only (if I recall correctly) your host machine will appear to your guest machine to have a different IP address than its real LAN address. So Bridged is the easiest and is likely your best bet, unless you have some specific needs.
First thing to do: Check that you have the network up and running. Try to ping the host system or any web site from the console of the guest OS, let's say ping www.google.com.
If you received any answers then please try writing the IP number of the host machine in the addressbar of the browser on the guest machine (NOT localhost :P). You should be able to see any web service running (Tip: Open the console of your windows 7 and type ipconfig, then find the ethernet adapter corresponding to VMWare and you'll find the IP number of your host system).
If you didn't received any answer at all when you did ping then check the network configuration of VMWare to use Bridged Connection --at least that's how it works for me.
Good luck!
In a guest machine, localhost refers to the virtual machine itself. Refer to the host just as you would from any other machine: by its IP address.
Note that it may be using a second "virtual" network adapter to communicate with the guest. Check the VMware to find out, and to find the second IP address.
Just use the same IP sub net for your VMware machine, if your windows system has ip address class C 192.168.0.10 So assign 192.168.0.120 IP to your Vmware machine and make sure that Firewall allow the traffic in vmware and also add the listener port manually in vm machine. go to system - administration- firwal-add port 1521.
Thanks