Network and Firewall


Routing Table

Display the routing table.

netstat -nr

DNS

Display the local DNS cache.

ipconfig /displaydns

Firewall

Manage Windows firewall using the netsh command.

C:\>netsh advfirewall ?

The following commands are available:

Commands in this context:
?              - Displays a list of commands.
consec         - Changes to the `netsh advfirewall consec' context.
dump           - Displays a configuration script.
export         - Exports the current policy to a file.
firewall       - Changes to the `netsh advfirewall firewall' context.
help           - Displays a list of commands.
import         - Imports a policy file into the current policy store.
mainmode       - Changes to the `netsh advfirewall mainmode' context.
monitor        - Changes to the `netsh advfirewall monitor' context.
reset          - Resets the policy to the default out-of-box policy.
set            - Sets the per-profile or global settings.
show           - Displays profile or global properties.

Get Windows Firewall Status:

netsh advfirewall show allprofiles

Turn off Windows Firewall:

netsh advfirewall set allprofiles state off

Turn on Windows Firewall:

netsh advfirewall set allprofiles state on

Allow a given port inbound:

netsh advfirewall firewall add rule name="[comment]" dir=in action=allow remoteip=[allowed_ip_address] protocol=TCP localport=[port]

Delete a rule:

netsh advfirewall firewall del rule name="[comment]"