HubsInfo Network

Useful netsh firewall commands for windows servers...

0 Members and 1 Guest are viewing this topic.

RuNNer

Useful netsh firewall commands for windows servers...
« on: November 04, 2013, 10:25:15 PM »
Useful netsh firewall commands for windows servers...



Netsh tool is a command-line scripting utility that allows you to, either locally or remotely, display or modify the network configuration of a computer that is currently running. Netsh tool also provides an useful feature that allows you to run a group of commands in batch mode. Netsh can also save the list of commands into text file for archival purposes or to help you configure other servers in the same way.
You can use the Netsh network administartion tool to perform the following tasks:
  • Configure interfaces.
  • Configure routing protocols.
  • Configure filters.
  • Configure routes.
  • Configure remote access behavior for Windows-based remote access routers that are running the Routing and Remote Access Server (RRAS) Service.
  • Display the configuration of a currently running router on any computer.
  • Use the scripting feature to run a collection of commands in batch mode against a specified router.
   Netsh command internal help


C:\netsh
netsh>help

The following commands are available:

Commands in this context:
..          - Goes up one context level.
?           - Displays a list of commands.
abort        - Discards changes made while in offline mode.
add         - Adds a configuration entry to a list of entries.
alias        - Adds an alias.
bridge       - Changes to the `netsh bridge' context.
bye         - Exits the program.
commit       - Commits changes made while in offline mode.
delete       - Deletes a configuration entry from a list of entries.
diag         - Changes to the `netsh diag' context.
dump         - Displays a configuration script.
exec         - Runs a script file.
exit         - Exits the program.
firewall      - Changes to the `netsh firewall' context.
help         - Displays a list of commands.
interface     - Changes to the `netsh interface' context.
offline      - Sets the current mode to offline.
online       - Sets the current mode to online.
popd         - Pops a context from the stack.
pushd        - Pushes current context on stack.
quit         - Exits the program.
ras         - Changes to the `netsh ras' context.
routing      - Changes to the `netsh routing' context.
set         - Updates configuration settings.
show         - Displays information.
unalias      - Deletes an alias.
winsock      - Changes to the `netsh winsock' context.

The following sub-contexts are available:
bridge diag firewall interface ras routing winsock
To view help for a command, type the command, followed by a space, and then type ?.
netsh> ?


   Netsh contexts


Netsh utility interacts with others using dynamic-link library files. Each Netsh helper DLL provides an extensive set of features called a context, which is a group of commands specific to this DLL networking component. These contexts extend the functionality of netsh. For ex., Dhcpmon.dll provides netsh the context and set of commands necessary to configure and manage DHCP settings.
For more information about Netsh contexts, use this command in the netsh shell:
netsh>show helper
DLL Filename  Command
------------  -------
HNETMON.DLL   bridge
DGNET.DLL    diag
FWCFG.DLL    firewall
IFMON.DLL    interface
IFMON.DLL      ip
IPV6MON.DLL    ipv6
IPV6MON.DLL      6to4
IPV6MON.DLL      isatap
IPV6MON.DLL    portproxy
RASMONTR.DLL  ras
RASMONTR.DLL   aaaa
RASMONTR.DLL   appletalk
RASMONTR.DLL   ip
RASMONTR.DLL   ipx
RASMONTR.DLL   netbeui
IPMONTR.DLL   routing
IPMONTR.DLL    ip
IPPROMON.DLL     autodhcp
IPPROMON.DLL     dnsproxy
IPPROMON.DLL     igmp
IPPROMON.DLL     nat
IPPROMON.DLL     ospf
IPPROMON.DLL     relay
IPPROMON.DLL     rip
IPPROMON.DLL     routerdiscovery
IPXMONTR.DLL   ipx
IPXPROMN.DLL     netbios
IPXPROMN.DLL     rip
IPXPROMN.DLL     sap
IFMON.DLL    winsock
netsh>



   List of available netsh contexts


AAAA - commands for AAAA
Shows and sets the configuration of the Authentication, Authorization, Accounting, and Auditing (AAAA) database used by the Internet Authentication Service (IAS) and the Routing and Remote Access service.
DHCP - commands for DHCP
Administers DHCP servers and provides an equivalent alternative to console-based management.
Diag - diagnostic (diag) commands
Administers and troubleshoots operating system and network service parameters.
Interface - commands for Interface IP
Configures the TCP/IP protocol (including addresses, default gateways, DNS servers, and WINS servers) and displays configuration and statistical information.
RAS - commands for RAS
Administers remote access servers.
Routing - commands for Routing
Administers Routing servers.
WINS - commands for WINS
Administers WINS servers.

   Netsh usage from command line, Netsh syntax


netsh -a AliasFile -c Context -r RemoteComputer NetshCommand
or
netsh -a AliasFile -c Context -r RemoteComputer -f ScriptFile
-r : Configures a remote computer.

RemoteComputer : Specifies the remote computer to configure.

NetshCommand : Specifies the netsh command that you want to run.

-f : Exits Netsh.exe after running the script.

ScriptFile : Specifies the script that you want to run.

/? : Displays help at the command prompt.



   Show Network Diagnostic GUI


Type the following command:
netsh diag gui

   Switch the specified adapter from a static address to DHCP


Type the following command:
netsh interface ip set address "Local Area Connection" dhcp
NOTE: Typing this command changes the interface named "Local Area Connection" to DHCP. To display all of the adapters in the computer with their current IP addresses to determine the correct adapter name, type the following command:
Netsh interface ip show config
To change to a static address, type the following command:
netsh interface ip set address "Local Area Connection" static ipaddr subnetmask gateway metric
NOTE: Replace ipaddr with the static IP address, subnetmask with the subnet mask, gateway with the default gateway and, if necessary, metric with the appropriate metric. The following example changes the interface "Local Area Connection" to a static address of 192.168.0.10 with a subnet mask of 255.255.255.0, and the interface has a default gateway of 192.168.0.1 with a metric of 1:
netsh interface ip set address "Local Area Connection" static 192.168.0.10 255.255.255.0 192.168.0.1 1

   Show multicast joins for an each network inteface


Type the following command:
netsh interface ip show joins

   Gathering diagnostic data from Windows Firewall


Windows Firewall configuration and status information can be retrieved at the command line by using the Netsh.exe tool. This tool adds IPv4 firewall support to the following Netsh context:
netsh firewall
To use this context, type netsh firewall at a command prompt, and then use additional Netsh commands as needed. The following commands are useful for gathering firewall status and configuration information:
Netsh firewall show state
Netsh firewall show config

Supported data gathering and configuration commands are listed in the following table.
Note Settings can be modified only by an administrator.
Data GatheringCommand Description
show allowedprogram   Displays the allowed programs.
show config      Displays the detailed local configuration information.
show currentprofile      Displays the current profile.
show icmpsetting      Displays the ICMP settings.
show logging      Displays the logging settings.
show opmode      Displays the operational mode.
show portopening      Displays the excepted ports.
show service      Displays the services.
show state      Displays the current state information.
show notifications      Displays the current settings for notifications.



F.A.Q (Frequently Asked Questions) :
What is the diffrence between a DoS attack and DDoS attack ?
DoS (Denial of Service) :

A DoS Attack is a Denial of Service attack.
This means that one computer and one internet connection is used to flood a server with packets (TCP / UDP).
The point of such a denial of service attack is to overload the targeted server’s bandwidth and other resources.
This will make the server inaccessible to others, thereby blocking the website or whatever else is hosted there.

DDoS (Distributed denial of service) :
A DDoS Attack is a Distributed Denial of Service Attack.
In most respects it is similar to a DoS attack but the results are much, much different.
Instead of one computer and one internet connection the DDoS attack utilizes many computers and many connections.
The computers behind such an attack are often distributed around the whole world and will be part of what is known as a bot-net.
The main difference between a DDoS attack vs a DoS attack, therefore, is that the target server will be overload by hundreds or even thousands of requests in the case of the former as opposed to just one attacker in the case of the latter.
Therefore it is much, much harder for a server to withstand a DDoS attack as opposed to the simpler DoS incursion.
If you are under any form of DDoS i urge you to inform your hosting provider or datacenter to deal with the matter accordingly since it can not be stopped at a server or software level, DDoS attacks need to be blocked before they even hit the server at a network level via the routers.




HOW TO CONFIGURE Windows 2008 R2 with netsh firewall commands:
Firewall Tweaks

Open up your command prompt and enter the following commands into it.

netsh firewall set opmode enable
netsh firewall set portopening protocol=ALL profile=ALL port=27015 mode=DISABLE scope=ALL addresses=50.X.X.X


For anyone who wanted maximum security in windows firewall with one command:
netsh advfirewall firewall add rule name="All Protocol Block" protocol=any dir=in action=block


Go to Start >> Run >> CMD (Right click and Run the command prompt as Administrator)
Then enter the following commands into them.
Windows Server 2008

Code:
netsh advfirewall firewall add rule name="Remote Desktop Protocol" program=System profile=public,private,domain dir=in localport=3389 protocol=tcp action=allow
Windows Server 2003


Code:
netsh firewall set portopening protocol=TCP port=3389 name="Remote Desktop Protocol" mode=ENABLE
Step 2 :
First thing to do is enable windows firewall.
Go to Start >> Run >> CMD (Right click and Run the command prompt as Administrator)
Then enter the following commands into them.
Windows Server 2008


Code:
netsh advfirewall set domainprofile state on
netsh advfirewall set privateprofile state on
netsh advfirewall set publicprofile state on
netsh advfirewall set allprofiles state on
Windows Server 2003


Code:
netsh firewall set opmode mode=enable profile=ALL

Step 3 :
The first DOS attack to block is all incoming ICMP Packets. (If you like to ping your server then don't follow this step.)

Side note : You can change the Protocol type to other formats that are unused by srcds such as IGMP.

Go to Start >> Run >> CMD (Right click and Run the command prompt as Administrator)
Then enter the following commands into them.

Windows Server 2008
Block all ICMPV4 Requests :

Code:
netsh advfirewall firewall add rule name="All ICMP V4" protocol=icmpv4:any,any dir=in action=block
Block all ICMPV6 Requests :


Code:
netsh advfirewall firewall add rule name="All ICMP V6" protocol=icmpv6:any,any dir=in action=block
Windows Server 2003
Block all ICMPV4 Requests :


Code:
netsh firewall set icmpsetting type=ALL mode=disable
This will force any incoming pings to your server to respond with a request timed out.

Optional : (The following firewall codes are optinal since all game server traffic is UDP and only rcon runs on TCP these are the only two packet types you should never block on your server)

Side note : Web hosting servers use TCP for transferring web traffic including of file downloads if you are using your game server for web hosting as well do not block TCP or port(s) "80,8080".


These are all the packet types that should be unused by everything and should be blocked upon your server. (Prevents people sending packets to your server and using up resources to respond to the packets when the only data you are using is TCP and UDP.)

I have exlcluded IPv6 since it wont be that long until IPv6 becomes used by most servers (No point in blocking the future of the internet.)

Windows Server 2008
Block all IGMP Requests : http://en.wikipedia.....ement_Protocol


Code:
netsh advfirewall firewall add rule name="All IGMP" protocol=2 dir=in action=block
Block all GRE Requests : http://en.wikipedia....._Encapsulation


Code:
netsh advfirewall firewall add rule name="All GRE" protocol=47 dir=in action=block
Block all VRRP Requests : http://en.wikipedia.....dancy_Protocol


Code:
netsh advfirewall firewall add rule name="All VRRP" protocol=112 dir=in action=block
Block all PGM Requests : http://en.wikipedia.....eral_Multicast


Code:
netsh advfirewall firewall add rule name="All PGM" protocol=113 dir=in action=block
Block all L2TP Requests : http://en.wikipedia....neling_Protocol


Code:
netsh advfirewall firewall add rule name="All L2TP" protocol=115 dir=in action=block
Step 4 :
Securing srcds incoming ports and traffic.

Now srcds uses allot of different ports but really you only need one port enabled in the windows firewall and you can gain access to connect to your server and display it on the Steam master server list. (The rest of the traffic is outgoing not incoming.)

This will block all rcon hacks attacks and exploits just by blocking the rcon protocol for your srcds server. (The reason i do this is because i have rcon disabled and i use sourcemod for rcon related commands such as changing the sv_cheats value)
The following setting is recommended ONLY for those have rcon disabled in your "server.cfg"

NOTE : (Change the srcds location with your own)
Go to Start >> Run >> CMD (Right click and Run the command prompt as Administrator)


Code:
netsh advfirewall firewall add rule name="srcds block TCP" protocol=TCP dir=in action=block program="C:\srcds\srcds.exe"

Step 5 :
This is the same as the step above except we are allowing all incomming traffic on the specific UDP port of our game server. (Add extra ports if you need them for source TV, Rcon etc.)
NOTE : (Change the srcds location with your own)
Go to Start >> Run >> CMD (Right click and Run the command prompt as Administrator)

Code:
netsh advfirewall firewall add rule name="srcds allow UDP"  protocol=UDP dir=in action=allow program="C:\srcds\srcds.exe" localport=27015,27020
http://forums.allied...=1&d=1341599162

If you are having problems and error codes for blocking or specifying ports then "Block edge traversal" by right clicking the inbound rule in your windows firewall and going to properties >> Advanced.

Stage 3 :

Disabling server hanging / hung errors :

Usualy when your game server crashes you get flagged the following error "srcds.exe has stopped working. Windows can check online for a solution to the problem" and even after disabling error reporting you will get the following message "srcds.exe has stopped working. A problem caused the program to stop working correctly. Please close the program" To fix this issue we do not have to disable error reporting but i will include it as a optional setting for those who have no use for windows error reports or logs.

Another common srcds server error this will fix upon crash is the famous "threadtools.cpp" error by rebooting the server automatically upon crashing it does keep server uptime at a maximum.

To disable windows error reporting : (Optional setting)
Go to Start >> Run >> CMD (Right click and Run the command prompt as Administrator)
Then enter the following commands into them.

Code:
serverWerOptin /disable
Suppress system application error messages :
The default value data is 0 and we should change it to 2 to set all messages to be hidden.
Go to Start >> Run >> regedit (Right click and Run regeditor as Administrator)


Code:
HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Windows\ErrorMode
Even after doing all that, it’s still not enough to disable the error window when the game server crashes/hangs. To totally suppress the “.exe has stopped working” dialog.” Go to the following registry location and change the value data to 1.

Code:
HKEY_CURRENT_USER\Software\ Microsoft\Windows\Windows Error Reporting\DontShowUI
Registry hardening/Security against DOS :
This next step is very long and extensive and will take some time applying all the settings recommended if you are lazy and want the layman's way out i have provided a (.zip) archive that contains registry keys and a cmd/bat file that will allow you to execute and apply all these changes at once.
Download :
http://forums.allied....1&d=1341550118

http://www.dslreports.com/drtcp

Included in the download is a registry editing tool by speedguide this will allow you to optimize your servers registry all at once tunning it for best security and speed of your server since my server has a 100mb up and down speed thats what i have set it to as displayed in the picture bellow and the rest of the settings are optimal.


Windows Server 2008 TCP/IP Stack Registry Configuration Tweaks :
The following registry settings are to help harden your TCP/IP Stack from denial of service SYN, ACK, TCP, UDP, ICMP attacks and throttling issues, As well as to reduce CPU load on the machine itself and leave the handling of incoming connections to the network cards / adapters.

To change / edit the registry values Go to Start >> Run >> regedit (Right click and Run as Administrator)

Check the TCP/IP state
To check the current status of the Vista TCP/IP tweakable parameters, in elevated command prompt type the following command:
[indent=1]netsh int tcp show global[/indent]

The settings, as well as their default and recommended state are explained below. The two most important tweakable parameters are "Auto-Tuning Level" and "Congestion Control Provider".
When checking the TCP state with the "netsh int tcp show global" command, it is also possible to see the following message below all those parameters:
[indent=1]** The above autotuninglevel setting is the result of Windows Scaling heuristics overriding any local/policy configuration on at least one profile.[/indent]
It is displayed when the "Receive Window Auto-Tuning Level" is not explicitly set, or if the system deemed it necessary to make a change because of user prompted "repairing" of your network connection, for example.

Disable Windows Scaling heuristics
Windows Vista/7 has the ability to automatically change its own TCP Window auto-tuning behavior to a more conservative state regardless of any user settings. It is possible for Windows to override the autotuninlevel even after an user sets their custom TCP auto-tuning level. When that behavior occurs, the "netsh int tcp show global" command displays the following message:
[indent=1]** The above autotuninglevel setting is the result of Windows Scaling heuristics
overriding any local/policy configuration on at least one profile.[/indent]
To prevent that behavior and enforce any user-set TCP Window auto-tunning level, you should execute the following command:
[indent=1]netsh int tcp set heuristics disabled
possible settings are: disabled,enabled,default (sets to the Windows default state)
recommended: disabled (to retain user-set auto-tuning level)[/indent]
Note this should be executed in elevated command prompt (with admin priviledges) before setting the autotuninlevel in next section. If the command is accepted by the OS you will see an "Ok." on a new line.
The corresponding Registry value (not necessary to edit if setting via netsh) is located in:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\s ervices\Tcpip\Parameters
EnableWsd=0
(default: 1, recommended: 0)

TCP Auto-Tuning
To turn off the default RWIN auto tuning behavior, (in elevated command prompt) type:
[indent=1]netsh int tcp set global autotuninglevel=disabled[/indent]
The default auto-tuning level is "normal", and the possible settings for the above command are:
[indent=1]disabled: uses a fixed value for the tcp receive window. Limits it to 64KB (limited at 65535).
highlyrestricted: allows the receive window to grow beyond its default value, very conservatively
restricted: somewhat restricted growth of the tcp receive window beyond its default value
normal: default value, allows the receive window to grow to accommodate most conditions
experimental: allows the receive window to grow to accommodate extreme scenarios (not recommended, it can degrade performance in common scenarios, only intended for research purposes. It enables RWIN values of over 16 MB)[/indent]
Our recommendation: normal (unless you're experiencing problems).
If you're experiencing problems with your NAT router or SPI firewall, try the "restricted", "highlyrestricted", or even "disabled" state.
Notes:
- Reportedly, some older residential NAT routers with a SPI firewall may have problems with enabled tcp auto-tuning in it's "normal" state, resulting in slow speeds, packet loss, reduced network performance in general.
- auto-tuning also causes problems with really old routers that do not support TCP Windows scaling. See
MSKB 935400
- netsh set commands take effect immediately after executing, there is no need to reboot.
- sometimes when using "normal" mode and long lasting connections (p2p software / torrents), tcp windows can get very large and consume too much resources, if you're experiencing problems try a more conservative (restricted) setting.

If you're experiencing problems with Auto-Tuning, see also:
MSKB 835400 - email issues
MSKB 934430 - network connectivity behind firewall problems
MSKB 940646 - 3G WWAN throughput issues
MSKB 929868 - web browsing issues
MSKB 932170 - slow network file transfer

Compound TCP - Improve throughput
Add-On Congestion Control Provider
The traditional slow-start and congestion avoidance algorithms in TCP help avoid network congestion by gradually increasing the TCP window at the beginning of transfers until the TCP Receive Window boundary is reached, or packet loss occurs. For broadband internet connections that combine high TCP Window with higher latency (high BDP), these algorithms do not increase the TCP windows fast enough to fully utilize the bandwidth of the connection.
Compound TCP (CTCP) is a newer method, available in Vista and Server 2008 (there is also a hotfix available for XP x64 and 2003 Server - MSKB 949316). CTCP increases the TCP send window more aggressively for broadband connections (with large RWIN and BDP). CTCP attempts to maximize throughput by monitoring delay variations and packet loss. It also ensures that its behavior does not impact other TCP connections negatively.
By default, Vista and Windows 7 have CTCP turned off, it is only on by default under Server 2008. Turning this option on can significantly increase throughput and packet loss recovery.
To enable CTCP, in elevated command prompt type:
[indent=1]netsh int tcp set global congestionprovider=ctcp[/indent]
To disable CTCP:
[indent=1]netsh int tcp set global congestionprovider=none[/indent]
Possible options are: ctcp, none, default (restores the system default value).
Recommended setting: ctcp
It is better to use this newer generation CTCP congestion control algorithm for most broadband connections, we highly recommend it being turned on.

ECN Capability
ECN (Explicit Congestion Notification, RFC 316 is a mechanism that provides routers with an alternate method of communicating network congestion. It is aimed to decrease retransmissions. In essence, ECN assumes that the cause of any packet loss is router congestion. It allows routers experiencing congestion to mark packets and allow clients to automatically lower their transfer rate to prevent further packet loss. Traditionally, TCP/IP networks signal congestion by dropping packets. When ECN is successfully negotiated, an ECN-aware router may set a bit in the IP header (in the DiffServ field) instead of dropping a packet in order to signal congestion. The receiver echoes the congestion indication to the sender, which must react as though a packet drop were detected.
ECN is disabled by default in Vista and other modern TCP/IP implementations, as it is possible that it may cause problems with some outdated routers that drop packets with the ECN bit set, rather than ignoring the bit. To check whether your router supports ECN, you can use the Microsoft Internet Connectivity Evaluation Tool. The results will be displayed under "Traffic Congestion Test".
To change ECN, in elevated command prompt type:
[indent=1]netsh int tcp set global ecncapability=default
Possible settings are: enabled, disabled, default (restores the state to the system default).
The default state is: disabled
Recommendation: enabled (only for short-lived, interactive connections and HTTP requests with routers that support it, in the presense of congestion/packet loss), disabled otherwise (for pure bulk throughput with large TCP Window, no regular congestion/packet loss, or outdated routers without ECN support).[/indent]
Notes: ECN is only effective in combination with AQM (Active Queue Management) router policy. It has more noticeable effect on performance with interactive connections and HTTP requests, in the presense of router congestion/packet loss. Its effect on bulk throughput with large TCP Window are less clear.
Currently, we do not recommend enabling this setting, as reportedly it has negative impact on throughput with some residential US ISPs. EA multiplayer games that require a profile logon do not support ECN as well (you will not be able to logon).

RSS - Receive-side Scaling
The receive-side scaling setting enables parallelized processing of received packets on multiple processors, while avoiding packet reordering. It avoids packet reordering y separating packets into "flows", and using a single processor for processing all the packets for a given flow. Packets are separated into flows by computing a hash value based on specific fields in each packet, and the resulting hash values are used to select a processor for processing the flow. This approach ensures that all packets belonging to a given TCP connection will be queued to the same processor, in the same order that they were received by the network adapter.
To set RSS:
[indent=1]netsh int tcp set global rss=enabled[/indent]
Possible rss settings are: disabled, enabled, default (restores rss state to the system default).
Default state is: enabled
Recommended: enabled (if you have 2 or more processor cores and a NIC that can handle RSS)

TCP Chimney Offload
TCP chimney offload enables Windows to offload all TCP processing for a connection to a network adapter. Offloads are initiated on a per-connection basis. Compared to task offload, TCP chimney offload further reduces networking-related CPU overhead, enabling better overall system performance by freeing up CPU time for other tasks.
To set TCP Chimney Offload:
[indent=1]netsh int tcp set global chimney=enabled

Default state: disabled (under Vista), automatic (under Windows 7 and 2008 Server)
Recommended: enabled[/indent]
The possible states are disabled, enabled, default (Vista), automatic (only Windows 7 and 2008 Server) as follows:
[indent=1]automatic - This default setting is only available under Windows 7 and 2008 Server, it is not available udner Vista. It offloads if the connection is 10 GbE, has a RTT < 20ms, and the connection has exchanged at least 130KB of data. The device driver must also have TCP Chimney enabled.
default - this setting restores chimney offload to the system default. Setting this "default" state under Windows 7 and 2008 Server is possible, but it sets the system to the "automatic" mode described above.
disabled - this setting is maually configured as disabled.
enabled - this setting is manually configured as enabled.[/indent]
Notes:
Under Windows 7 and Server 2008 the "default" and the additional "automatic" parameter set the system to the same "automatic" state.
For Chimney Offload to work, it needs to be enabled in both the OS and NIC. To enable the "TCP Offloading" setting in your NIC, navigate to the Device Manager, under Network Adapters, in the Advanced tab, and check "Enabled" in the box next to the TCP offload entry.


Direct Cache Access (DCA)
Windows 7 and 2008 Server (but not Vista) add NETDMA 2.0 Direct cache access support. Direct Cache Access (DCA) allows a capable I/O device, such as a network controller, to deliver data directly into a CPU cache. The objective of DCA is to reduce memory latency and the memory bandwidth requirement in high bandwidth (Gigabit) environments. DCA requires support from the I/O device, system chipset, and CPUs.
To enable DCA:
[indent=1]netsh int tcp set global dca=enabled

Available states are: enabled, disabled.
Default state: disabled
Recommended: enabled (provided the CPU/Chipset/NIC support it)[/indent]
It is also possible to enable this setting by editing the Windows Registry instead of using netsh as follows:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\S ervices\Tcpip\Parameters
EnableDCA=1
(DWORD, entry does not exist by default. Set to 1 to enable, 0 to disable)

Setting MTU
It is sometimes useful to view and set the MTU value for a specific network interface manually. To view a list of active network interfaces and their MTU values in Vista using netsh, open command prompt as administrator and execute the following command:
[indent=1]netsh interface ipv4 show subinterface[/indent]

To change the MTU value of a specific network card, type the following in command prompt:
[indent=1]netsh interface ipv4 set subinterface "network interface name" mtu=#### store=persistent[/indent]
Where "network interface name" is your specific network adapter name as obtained above (or viewable under Network adapters), and mtu=#### is the desired MTU value.
For example, if the name of your network card is "Wireless Network Connection" and you'd like to set its MTU to 1500, you'd have to type:
[indent=1]netsh interface ipv4 set subinterface "Wireless Network Connection" mtu=1500 store=persistent[/indent]
Note: The maximum MTU value is usually 1500, and up to 1492 for PPPoE connections.

TCP 1323 Options
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\S ervices\Tcpip\Parameters\
Tcp1323Opts=1
(DWORD, entry created automatically by Windows when you run the "netsh int tcp set global autotuninglvl=..." command, set to 0 by default).
Setting this seems to have no effect, since auto-tuning uses the TCP 1323 scale factor and changes it on the fly, disregarding this setting. Additional testing may be required to determine it's effect if auto-tuning is turned off. Setting it to 1 is best for broadband connections.

NetDMA (TCPA)
NetDMA enables support for advanced direct memory access. In essence, it provides the ability to more efficiently move network data by minimizing CPU usage. NetDMA frees the CPU from handling memory data transfers between network card data buffers and application buffers by using a DMA engine.
Under Windows 7, NetDMA can be set directly using the netsh interface (not available under Vista):
[indent=1]netsh int tcp set global netdma=enabled[/indent]
Under Vista/2008/7, you can set NetDMA/TCPA using the following Registry parameter:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\S ervices\Tcpip\Parameters
EnableTCPA=1
(DWORD, not in registry by default. Set to 1 to enable, 0 to disable NetDMA)
Recommended setting is 1 (if not using Chimney Offload), zero otherwise. A new DWORD value may need to be created if not already present in the registry.
For NetDMA to work, it must be enabled in BIOS, your CPU must support Intel I/O Acceleration Technology (I/OAT), and it does not work together with Chimney Offload.

Checksum Offloading (DisableTaskOffload)
This NDIS 5 setting allows for reducing CPU load by offloading some tasks required to maintain the TCP/IP stack to the network card. Theoretically, Widnows should automatically detect capable network hardware.
[indent=1]The tasks offloaded are as follows:
- TCP/IP checksum calculation - each packet sent includes a verification checksum.
- TCP/IP segmentation - also known as "TCP Large Send" where Windows sends a large amount of data to the network card, and the NIC is then responsible for dividing it according to the network MTU. Experimental feature, not enabled by default
- IPSec Encryption cyphers and message digests - provides encryption of packets at the hardware level.[/indent]
To change the checksum offloading setting in the Windows Registry:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\S ervices\Tcpip\Parameters
DisableTaskOffload=0
(DWORD value, default: not set, recommended: 0=enable offload, 1=disable offload)

DefaultTTL
TTL can be safely left alone in many cases. It is a limit to the time and number of hops/routers a packet will travel before being discarded. A number that's too small risks packets being discarded before reaching their destination. A number that's too large (over 12 will cause delay in when lost IP packets are discarded.
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\S ervices\Tcpip\Parameters
DefaultTTL=64
(DWORD, set to a decimal value between 32 and 128. Recommended: 64)

TcpMaxDataRetransmissions
Determines how many times unacknowledged data (non-connect segment) is retransmitted before TCP aborts the connection. The retransmission timeout is doubled with each successive retransmission on a connection. It is reset when responses resume.
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\S ervices\Tcpip\Parameters
TCPMaxDataRetransmissions=7
(DWORD, recommended: between 3 and 10, not present in registry by default)
Note: When not present in the registry, the default behavior is 255 retransmissions (5 in documentation).

SynAttackProtect
This undocumented setting provides protection against SYN denial of service (DoS) attacks. When enabled, connections timeout sooner if SYN attack is detected. When set at 1, TCPMaxDataRetransmissions can be lowered further.
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\S ervices\Tcpip\Parameters
SynAttackProtect=1
(DWORD, recommended: 1, not present in registry by default)

Network Throttling Index
By default, Windows Vista/7 implements a network throttling mechanism to restrict the processing of non-multimedia network traffic to 10 packets per millisecond (a bit over 100 Mbits/second). The idea behind such throttling is that processing of network packets can be a resource-intensive task, and it may need to be throttled to give prioritized CPU access to multimedia programs. In some cases, such as Gigabit networks and some online games, for example, it may be benefitial to turn off such throttling all together.
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Multimedia\SystemProfile
NetworkThrottlingIndex=ffffffff (DWORD, default: 10 hex, recommended: 10 hex for media sharing, ffffffff for gaming and max throughput, valid range: 1 through 70 decimal or ffffffff to completely disable throttling)
It is only recommended to change this setting in saturated Gigabit LAN environments, where you do not want to give priority to multimedia playback. Reportedly, disabling throttling by using ffffffff can also help reduce ping spikes in some online games.
Notes: Setting is available in Windows 7, Vista (SP1), 2008 Server. Default value is 10 under Windows 7, similar behavior if the setting is not present in the Registry.
Games that may be affected by this throttling: Source Engine games (TF2, Left 4 Dead, CS:S), HoN, CoD, Overlord series.

Set DNS and Hosts Priority
As with previous versions of Windows, one can improve DNS and hostname resolution by increasing the priority of of related services, while keeping their order. Lower numbers mean higher process priority. The corresponding registry settings in Vista are as follows:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\S ervices\Tcpip\ServiceProvider
LocalPriority=4
(DWORD, recommended: 4, default: 499) - local names cache
HostsPriority=5 (DWORD, recommended: 5, default: 500) - the HOSTS file
DnsPriority=6 (DWORD, recommended: 6, default: 2000) - DNS
NetbtPriority=7 (DWORD, recommended: 7, default: 2001) - NetBT name resolution, including WINS

TcpTimedWaitDelay (port allocation)
Short lived (ephemeral) TCP/IP ports above 1024 are allocated as needed by the OS. The default Vista values have improved from previous Windows versions, and are usually sufficient under normal load. However, in some instances under heavy load it it may be necessary to adjust the settings below to tweak the availability of user ports requested by an application.
If the default limits are exceeded under heavy loads, the following error may be observed: "address in use: connect exception". By default under Vista (when the values are not presend in the registry), the OS can allocate up to 16384 ephemeral ports above port 1024, and the OS waits for 120 seconds before reclaiming ports after an application closes the TCP connection. This is a considerable improvement over older Windows versions. However, if necessary, the following registry values can be added/edited:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\S ervices\Tcpip\Parameters
MaxUserPort=65534
(DWORD, not in the registry by default. Recommended: leave at default, or use a number above 16384 up to 65534 decimal as necessary) - maximum number of ports to use. 1024 is automatically subtracted from entered value to allow for reserved ports under 1024.
TcpTimedWaitDelay=30 (DWORD, not present or 0xffffffff in registry by default. Recommended: 30 decimal, denoting 30 seconds) - time to wait before reclaiming ports, in seconds. Default time before reclaiming ports, if value is at 0xffffffff or not present in the registry is 120 seconds. Just reducing the delay is often sufficient without changing MaxUserPort, as it allows for reusing ports more efficiently.
Ephemeral ports can be checked and changed using netsh as well.
To query the current values, in command prompt, type:
netsh int ipv4 show dynamicportrange tcp (for UDP, use the same command, replacing only "tcp" with "udp" at the end)
To set both the starting, and max user port using netsh, in elevated command prompt run:
netsh int ipv4 set dynamicportrange protocol=tcp start=1025 num=64511 (start=NNN denoting the starting port, and num=NNN denoting the number of ports)
Notes:
By default, dynamic ports are allocated between ports 49152 and 65535 (for a total of 16384 ephemeral ports).

Using netsh allows to set both the starting port and port range. Editing the Registry allows for setting the port range, and the starting port is fixed at 1025. Deleting the MaxUserPort registry entry (or setting it to a value outside the allowed range) causes the OS to revert to using the default values.
Some system processes can install port filters to block certain port ranges. If ephemeral ports run into these filtered port ranges, TCP/IP applications will be unable to bind to any ports.

QoS Reserved Bandwidth
As with Windows XP, nework adapters have a "QoS Packet Scheduler" enabled by default, which reserves 20% of bandwidth by default for QoS applications that request priority traffic. Note this only has effect in the presence of running QoS applications that request priority traffic. Registry value is undocumented for the Vista version of Windows. To customize this setting, in the Windows Registry:
HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsof t\Windows\Psched
NonBestEffortLimit=0
(DWORD, not present in the registry by default. Recommended: 0 , possible values between 0 and 100) - indicates the percentage value of reserved bandwidth for QoS applications. Set to 0 to disable.

Notes: This tweak applies only to Windows versions that have Qos Packet Scheduler enabled. It will ONLY have effect in the presense of running QoS applications.





--
Ref: http://www.cezeo.com...administration/
Ref: https://forums.allie...ht=netsh&page=2