Does new Windows netsh firewall rule break existing connection? - firewall

Can't find the answer anywhere and I'm a little bit afraid to check this out on my computer.
I want to block all traffic that comes from specific address - except one, which is already established.
netsh advfirewall firewall add rule name=”ping” protocol=icmpv4 action=block
dir=in remoteip=xxx.xxx.xx.xx
Is it okay to add new netsh advfirewall rule that block all the traffic from the address or it'll break my existing connection too?

Related

Opening a port to a VM on Azure

Firstly, apologies if similar questions have been answered before, but the Azure configuration seems to have changes since most of the posts I have seen so far.
I have an application which I have installed on an Azure VM [Windows server 2012].
It's actually wso2 API manager, if anybody has experience of that.
The application fires up Tomcat and listens for SSL traffic on port 9443. Why it's not 443 I'm not sure.
I've set up an Inbound Security rule on my Network Security Group, as follows:
Priority : 1010
Source: Any
Service: Custom
Protocol: Any
Port Range: 9443
Action : Allow
I still have no joy accessing this from a browser though, I get the slightly confusing "This site can't be reached / the connection was reset" error.
I'd welcome any pointers to get this working or to debug!
I recently experienced nearly the same issue that you did. What worked for me:
1) I added my inbound rule prior to any other inbound rule. I noticed your rule is 1010 which means it's being applied after the default RDP rule is. No, this shouldn't make a difference, but it may.
2) When you create your inbound rule, hit the "advanced" button, choose the CIDR option and route the traffic to the internal IP address of the VM.
3) For the destination port range I chose only the port I needed. In your case 9443.
The issue for me was the internal IP address. Once I set that everything started working for me.

IPFW - Ruleset by default

I'm trying to set a IPFW as open by default, so I do firewall_type="open", but when I do "ipfw flush", it only adds a "deny ip any from any" rule. Should it be "allow ip any from any"? I mean, If I flush the rules, should it be set only as the default ruleset or, instead of that, it will add that rule automatically?
Another question. If I restart the firewall doing "service ipfw restart", it add the whole open ruleset, but its last two rules are:
65000 allow ip from any to any
65535 deny ip from any to any
If firewall_type="open", should it be "65535 allow ip from any to any" only, without the last rule?
I have read somewhere:
If the open policy is enabled in the kernel (IPFIREWALL_DEFAULT_TO_ACCEPT), then rule # 65535 will be automatically set to "allow ip from any to any" instead of "deny ip from any to any," thus making rule # 65000 as set in rc.firewall for the open policy redundant. As such, it is more apropos to indicate firewall type "UNKNOWN" if one enables an open policy in the kernel, and does not wish to enable any other rules.

Using IPSec to block all traffic except web browsing

I am using IPsec to block all protocoles traffic, and allow some ports.
I want to allow Web Browsing while blocking all of the other traffic.
I tried to add rule to allow the 80 port , port 53 as source and destination port through UDP and TCP protocoles, but still in the browser have a DNS error.
Please can you help me?
I don't know IPsec, but in general you cannot limit the source ports. The source ports will be random, and will not likely be 53 or 80. You should limit only the destination ports (80, 53).
The way IPSec works is that all 'block' rules take priority over 'allow' rules. If we ignore the fact you're not using the recommended methods to do what you want to do, you've not configured IPSec properly.
Unfortunately, using this method will be horrible, since you'll have to configure filters to block everything except HTTP, and there's no way of specifying 'everything except something'. I went down this road briefly a few weeks ago, made the same mistake you did, and aborted the whole plan!
I know this is an old question, but it would good to follow it up with the solution you found.

Browse Web Site With IP Address Rather than localhost

I am using VS2012 with IIS Express and can not seem to browse my web sites using my IP Address. Is there some way to do that? It used to work fine with earlier versions of VS.
For example, this address works fine:
http://localhost:64651/
But, this address does not work.
http://192.168.252.165:64651/
I am sure of the IP Address, since I just got it using ipconfig.
Go to your IISExpress>Config folder, locate applicationhost.config. Change <bindings> as below:
<bindings>
<binding protocol="http" bindingInformation="*:1407:YOUR_IP_ADDRESS" />
</bindings>
Before you do this , you will have to register this IP address using netsh command as below:
Port forwarding in Windows 7
If you’re running Windows 7, pretty much all incoming connections are locked down, so you need to specifically allow incoming connections to your application. First, start an administrative command prompt. Second, run these commands, replacing 192.168.1.11:1234 with whatever IP and port you are using:
> netsh http add urlacl url=http://192.168.1.11:1234/ user=everyone
This just tells http.sys that it’s ok to talk to this url.
IMPORTANT: The user=everyone parameter must be specified according to the system language. So if your windows language is spanish the parameter must be user=todos.
> netsh advfirewall firewall add rule name="IISExpressWeb" dir=in protocol=tcp localport=1234 profile=private remoteip=localsubnet action=allow
This adds a rule in the Windows Firewall, allowing incoming connections to port 58938 for computers on your local subnet.More information at this link.
Port forwarding Mac OS X
Step 1: View Current Firewall Rules
sudo ipfw show
Step 2: Add Port Forwarding Rule (80 to 8080)
The default port that Tomcat runs on is 8080, so here we show the command to do port fowarding from port 80 to 8080 (Tomcat’s default port). Obviously, this works for other ports as well, and you’d just have to adjust the command accordingly.
sudo ipfw add 100 fwd 127.0.0.1,8080 tcp from any to any 80 in
This is a temporary change, and it will revert once you reboot. If you want to make it permanent, you can create a lauch deamon for it.
Optional Remove Rule
If you want to remove your firewall rules run:
sudo ipfw flush
Port Forwarding Using PFCTL (aka PF) on Mac OS X
The setup for pfctl is similar to ipfw. Github user kujon has created a nice guide to show how to set up port forwarding from port 80 to another port using pfctl.
Note: Be sure to change the bindings of your project only by locating its name. You can even keep the localhost binding and add a new one , this way you can access same webpage using both the given IP address and your old localhost binding.
You can use Conveyor by Keyoti
Step 1:
Download the Visual Studio Extension by searching for 'Conveyor' in the Tools->Extensions and Updates dialog.
Step 2:
Conveyor is automatically enabled for web application projects, run (debug) a project and note the Remote URL, that is the URL you will use from your device or other computer. Please see troubleshooting below if you don't see the Conveyor window.
Step 3:
Add an inbound firewall rule allowing access to the TCP port given in the Remote URL.
1. Open Windows 'Start' and type WF.msc.
2. Click 'Inbound Rules' on the left.
3. Click 'New Rules' on the right.
4. Choose 'Port' in the new dialog, then 'Next'.
5. Select TCP, and enter the port from the Remote URL next to 'Specific local ports' (probably 45455), then 'Next'.
6. Next, and next (you may want to disable 'Public'), give it a name like 'Conveyor: web dev server access enabled'.
Step 4:
Use the Remote URL from your device (phone, tablet or other machine) to directly access your application.
More information at Conveyor
binding visual studio in local iis ip webconfig

How to enable Ping(ICMP) on Azure

In Windows Azure role, I cannot ping out
D:\Users\foglight>ping www.google.com
Pinging www.l.google.com [209.85.143.104] with 32 bytes of data:
Request timed out.
Request timed out.
Request timed out.
Request timed out.
Ping statistics for 209.85.143.104:
Packets: Sent = 4, Received = 0, Lost = 4 (100% loss),
I google it and found some one suggest run below command, but even after run it, I still can not ping out
netsh advfirewall firewall add rule name="ICMPv6" dir=in action=allow enable=yes protocol=icmpv6
Please someone tell me the reason and how to walkaround.
I don't believe you can do this. Traffic leaving the data center goes through the load balancer, and the load balancer only routes TCP-based traffic.
I know this question is very old, but I stumbled upon it while facing the same issue and there is an actual solution for it now in Azure.
When setting up your Virtual machine you can assign it an "Instance IP address". Once that has been configured, you can enabled ICMP in and out in the local firewall. You will then be able to ping out of your Azure VM and also use tools like traceroute.
I had a similar problem. Needed to assign public IP to Azure VM in order to enable ICMP. I used set-azurepublicip and update-azurevm and resolved the issue.
I also had problems to do traceroutes from my azure VM and to ping it.
Just wanted to let you know, that after you have a public IP assigned to the VM (which is in many cases the default), you also need to add ICMP Rules to your network security groups (NSG) (if you have any, which you should).
If you have a NSG on the vnet and a NSG on the VM network interface, you should create 4 rules that allow ICMP (vnet-in, vnet-out, vm-in, vm-out).
Selecting "Any" as protocol, will not work.
The default rule for internet access seems to be not sufficient.
You need to select ICMP. "Any" seems to be only UDP+TCP.
I set the source and destination port to "*" (not sure if it even has any effect if ICMP is selected).
After that and a little wait (~1-2 min), I could ping and trace in every direction :)

Resources