Using netsh advfirewall to block URLs in Windows - firewall

I know that Windows allow blocking IP addresses through netsh like so:
netsh advfirewall firewall add rule name="Block some stuff" dir=in action=block remoteip=xxx.xxx.xxx.xxx enable=yes
But is there any way to use netsh (or is there any other Windows utility) to block URLs like how ipfw and iptables allows? I know there's wipfw, but I'd like to use something built in if possible.

Use nslookup to resolve dns/ip of the url and block that ip using netsh.
Or, you may add an exception in hosts file in Windows.

Related

Updating the `/etc.ufw/before.rules` file to allow `ufw` firewall redirection

I need to Configure My Server so that the ufw firewall running on it can redirect port 8080/TCP to port 80/TCP. From quick research, I know I can do it in Two ways; one is to run a command similar to;
sudo ufw allow 8080/tcp to port 80/tcp
On my Terminal. The other is to modify the /etc/ufw/before.rules file which is a file containing the iptables rules - underlying rules that ufw firewall is built on.
I am curious to know how to reconfigure the /etc/ufw/before.rules to achieve the same result.

Unable to connect properly to an open port on my Windows VM

So I have this setup, I have a Windows Server 2019 with a RASA open source server installed.
RASA works on Port 5005 so I added an inbound port for 5005.
So on my computer I tried accessing use < Public IP > :5005 and it didn't work even though if I use use < Private IP > :5005 or localhost:5005 in the virtual machine it works fine.
I also tried accessing the use < Public IP > :5005 inside the virtual machine and it didn't work.
The error is took to long to respond
Am I missing something?
In this case, you could add a rule to the Windows firewall inside the Server to expose the port for the public and private profiles. You could open a command prompt as an administrator on Azure VM and run the following command.
netsh advfirewall firewall add rule name=RASA dir=in action=allow protocol=TCP localport=5005

How to deploy a Node js application on Windows?

I have a domain and hosting so I want to deploy nodejs in a Windows environment. However when I tried to find the best way to deploy it they are all related to running nodejs in a linux environment.
so how do I deploy it in a windows environment?
When you map a domain name to an IP address, all traffic is going to come in on port 80 (http) & 443 (https), by default.
Here is a solution:
Suppose your domain name is example.app.com with its public IP address as 127.65.43.21:80.
Start your server on localhost:8081
Add "local DNS" in the hosts file as a new line
127.65.43.21 example.app
Any free address in the network 127.0.0.0/8 (127.x.x.x) can be used.
Assuming 127.65.43.21:80 is not occupied by another service.
You can check with netstat -a -n -p TCP in powershell ran as Admin
Add the following network configuration with netsh command utility:
netsh interface portproxy add v4tov4 listenport=80 listenaddress=127.65.43.21 connectport=8081 connectaddress=127.0.0.1
You can now access the server at http://example.app.com
You can see the entry you have added with the command:
netsh interface portproxy show v4tov4
You can remove the entry with the following command:
netsh interface portproxy delete v4tov4 listenport=80 listenaddress=127.65.43.21
Hope this answers your query.

How to enable inbound connection for a particular port in windows 10?

in windows 10 IoT i want to accept TCP packets on a port (eg:- 49856) from a remote machine.
You can have a try the following command:
netsh advfirewall firewall add rule name="Open mongod port 49856" dir=in action=allow protocol=TCP localport=49856

Cannot access to CentOS from MS Windows via http

I have got installed CentOS 7 under virtual envirment.
It has proper hostname so I can ping it and it has acccess to internet inside of it and I can ping by IP and host name outside of it. Also It has working Apache and its test page is fine that has been checked locally.
Now I would like to get access to this test page from the MS Windows but I cannot. (I can ping CentOS by IP and hostname.)
Has it something to do with Iptables or firewall?
And this link doesnt help as well https://serverfault.com/questions/459267/enabling-http-access-on-port-80-for-centos-6-3-from-console
I assume some settings should be changed under CentOS but I am not sure which of them.
My question is which steps I have to execute to allow all those things?
Either disable firewalld.service
systemctl disable firewalld.service
systemctl stop firewalld.service
Or allow access to port 80
firewall-cmd --zone=public --add-port=80/tcp --permanent
firewall-cmd --reload
Also disable SELINUX:
setenforce 0
sed -i 's/^SELINUX=enforcing/SELINUX=disabled/' /etc/sysconfig/selinux
So the answer is a simple one.
I just used Firewall settings to allow http and httpd.

Resources