NMAP, also known as Network Mapper, is an open-source tool that network administrators use to discover hosts and services on a computer network, thus creating a “map” of the network. It provides information about which systems are running, which services (application name and version) those systems are offering, what operating systems (and OS versions) they are running, and the type and level of packet filters/firewalls they are using. However, using NMAP for bandwidth analysis is a bit unorthodox and might not provide the most accurate results as it’s not specifically designed for this task.
That said, NMAP does allow for some indirect methods to gain insights on network bandwidth. One of the notable ways is through observing the round trip time (RTT) it takes for a network packet to travel from the source to the destination and back. In a high latency environment (long RTT), NMAP could potentially slow down. This might infer that the network might have bandwidth restrictions.
To run this in NMAP, use the -Pn option (which won’t ping the host but assumes it’s up):
```
nmap -Pn —max-retries=1 —initial-rtt-timeout=1ms —min-rtt-timeout=1ms —max-rtt-timeout=1ms target
```
Here, we are setting the number of retransmissions of the same packet to 1, and set the initial, minimum, and maximum timeouts to the lowest possible value. In a high latency environment, NMAP will have to wait longer or retransmit its probes, potentially hinting at bandwidth restrictions.
However, It’s important to note that this method just provides a basic view. For more accurate bandwidth analysis, consider employing more specific network monitoring tools like iperf, bwm-ng, iftop, etc.
A common technique for measuring bandwidth is using Iperf. Iperf can measure the throughput on an IP network between two servers. It supports tuning of various parameters related to timing, buffers, and protocols (TCP, UDP, SCTP with IPv4 and IPv6).
Here are two simple steps for measuring bandwidth with Iperf:
Step 1: One server runs Iperf in server mode: `iperf -s`
Step 2: Another server runs Iperf in client mode, pointing to the IP address of the first server: `iperf -c server_IP_address`
The result of the above example is the bandwidth between two servers.
Sources:
- NMAP docs (https://nmap.org/book/man.html)
- Bandwidth analysis tool (https://www.tecmint.com/linux-network-bandwidth-monitoring-tools/)
- Iperf tool (https://iperf.fr/)