Windows/Firewall

From Omnia
Jump to navigation Jump to search

Allow ICMP

netsh advfirewall firewall add rule name="ICMP Allow incoming V4 echo request" protocol=icmpv4:8,any dir=in action=allow
netsh advfirewall firewall add rule name="ICMP Allow incoming V4 echo request" protocol=icmpv4:8,any dir=in action=block

IPv6 version:

netsh advfirewall firewall add rule name="ICMP Allow incoming V6 echo request" protocol=icmpv6:8,any dir=in action=allow
netsh advfirewall firewall add rule name="ICMP Allow incoming V6 echo request" protocol=icmpv6:8,any dir=in action=block

Enable Firewall Rule (powershell): (as needed)

# check firewall rule - should have been auto created
Get-NetFirewallRule -Name "OpenSSH-Server-In-TCP"
# Check if our firewall rule below has been added
Get-NetFirewallRule -Name "OpenSSH Server (sshd)"
# search for any (not case sensitive)
Get-NetFirewallRule -Name "*ssh*"
Get-NetFirewallRule -DisplayName "*ssh*"
# if need to create a new one:  (Allowed on Domain,Private,Public)
New-NetFirewallRule -Name sshd -DisplayName 'OpenSSH Server (sshd)' -Enabled True -Direction Inbound -Protocol TCP -Action Allow -LocalPort 22
# With Edge Traversal
New-NetFirewallRule -Name sshd -DisplayName 'OpenSSH Server (sshd)' -Enabled True -Direction Inbound -Protocol TCP -Action Allow -LocalPort 22 -EdgeTraversalPolicy Allow
# If you want it just on Private
New-NetFirewallRule -Name sshd -DisplayName 'OpenSSH Server (sshd)' -Enabled True -Direction Inbound -Protocol TCP -Action Allow -LocalPort 22 -Profile Private

Change firewall rule to just private:

Set-NetFirewallRule -Name sshd -Profile Private
# to Domain,Private
Set-NetFirewallRule -Name sshd -Profile Domain,Private

Verify:

NetFirewallRule -Name sshd | Select-Object Name, Profile, Enabled

keywords