Take into account that when executing WMI scans on large IP ranges, a No buffer Available Space exception may occur. This exception occurs due to the availability of TCP ports. The Dynamic Port Range is used by the client computer to connect to Well Known Port Services or Root Services. This Dynamic Port Range depends on the version of Operating Systems.
Port Range: 1024-65535 - used by the computers running Windows XP, Windows 2000 Professional, and Windows Server 2003.
Port Range: 49152-65535 - used by computers running Windows Vista, Windows 7 and Windows Server 2008. By default, a fresh Windows Server 2008 installation will have this Dynamic Port Range configured.
How can you see the port range?
To see the port range you can use the following commands:
- NetSh INT IPV4 Show DynamicPort TCP
- NetSh INT IPV4 Show DynamicPort UDP
How do you change the port range?
To set or change the Dynamic Port Range use the following commands:
- NetSh INT IPV4 SET DynamicPort TCP Start=1024 num=65535
- NetSh INT IPV4 SET DynamicPort UDP Start=1024 num=65535
When you find a No Buffer Available Space exception, follow these steps:
- Check the Dynamic Port Range using the above commands
- If the number of ports is less than the given IP range, increase the port range using the commands above
- Run the scan again
Other ways to increase the range of ephemeral ports
Increase the range of ephemeral ports by setting the MaxUserPort TCP/IP parameter to a higher value like 32768 (setting the port range from 1024 to 32768).
Find this option on the windows registry key HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters as a DWORD value.
Windows 2008 R2
Increase the range of ephemeral ports by setting the Dynamic Port Range to a higher value through the command:
- netsh int ipv4 set dynamicportrange tcp start=32767 num=65535
This command will set the port range from 32768 to 65535.
Redhat LInux 5
Increase the range of ephemeral ports by setting ip_local_port_range kernel value on /proc/sys/net/ipv4/ip_local_port_range. Use the command
- echo "32768 65535" > /proc/sys/net/ipv4/ip_local_port_range
This will set the port range from 32768 to 65535.