netserver
Provide network performance testing server
TLDR
Start a server on the default port (12865) and fork to background
Start server in foreground and do not fork
Specify [p]ort
Force IPv[4] or IPv[6]
SYNOPSIS
netserver [options]
netserver [-4] [-6] [-L host[,port]] [-p port] [-D] [-u] [-P] [-S] [-s] [-h] [-v] [-M value] [-N value] [-t value] [-T value]
PARAMETERS
-4
Forces netserver to use IPv4 addresses exclusively for listening.
-6
Forces netserver to use IPv6 addresses exclusively for listening.
-L host[,port]
Specifies the local host interface and an optional port number for netserver to bind to. This is useful for multi-homed systems.
-p port
Sets the TCP/IP port number on which netserver will listen for incoming connections. The default port is 12865.
-D
Enables debug output, providing more verbose information about netserver's operations for troubleshooting.
-u
Displays the current netserver build date and exits.
-P
Prints the Process ID (PID) of the netserver daemon to standard output upon startup.
-S
Instructs netserver to use shared memory for certain context messages, primarily when a shared memory transport is involved. This is an advanced option.
-s
Enables security checks, often used in conjunction with the netperf client's 'remote' option to restrict access.
-h
Displays a concise help message detailing available command-line options and then exits.
-v
Displays the version information of the netserver utility and then exits.
-M value
Sets the maximum number of bytes that netserver will allocate for response messages.
-N value
Configures the maximum number of network buffers that netserver should pre-allocate to handle incoming data.
-t value
Sets the interval (in seconds) at which netserver checks for and reaps orphaned child processes that have completed their tasks.
-T value
Establishes an idle timeout (in seconds) for client connections. If no activity is detected within this period, the connection may be closed.
DESCRIPTION
The netserver command is a daemon that operates as the server-side component of the netperf network performance benchmarking tool. It passively listens on a specified TCP/IP port (defaulting to 12865) for incoming connection requests from a netperf client.
Upon establishing a connection, netserver forks a child process to handle the specific benchmark request, enabling the parent process to continue listening for new client connections. It supports a wide array of test types initiated by the client, including TCP and UDP stream tests, request/response transactions, and various others, facilitating precise measurements of network throughput, latency, and even CPU utilization during data transfers.
Running netserver on a remote host is a fundamental prerequisite for conducting comprehensive network performance analyses between two distinct systems, providing crucial data for network optimization and troubleshooting.
CAVEATS
Firewall Configuration: The default listening port (12865) must be open in any firewall between the netperf client and netserver to allow communication.
Security Implications: While netserver is essential for performance testing, it does not implement strong authentication or authorization mechanisms by default. It is generally recommended to run it in controlled, trusted network environments or to utilize its -s security option where applicable. Avoid exposing it directly to the public internet.
Resource Consumption: During active benchmark tests, netserver (and its child processes) can consume significant CPU, memory, and network bandwidth resources. Ensure the host running netserver has adequate resources to avoid skewing test results.
<B>TYPICAL USAGE</B>
To conduct a network performance test, netserver is first started on the target server machine. For example:
netserver -p 12865
Then, from a client machine, the netperf command is executed, pointing to the netserver host and port, such as:
netperf -H server_ip -l 10 -t TCP_STREAM
This setup allows for unidirectional or bidirectional performance measurements, depending on the netperf test type.
<B>INTERACTION WITH NETPERF</B>
netserver operates as the passive endpoint, waiting for instructions from the netperf client. It does not initiate any tests itself. When a netperf client connects and requests a specific test (e.g., a TCP stream throughput test), netserver sets up the necessary data transfer mechanisms on its end (e.g., opening a data socket) and then participates in the data exchange as directed by the client, collecting statistics which are then reported back to the netperf client.
HISTORY
The netserver utility is an integral part of the netperf benchmarking suite, which was originally developed by Hewlett-Packard (HP) in the early 1990s. netperf was created to provide a robust and flexible tool for measuring various aspects of network performance, particularly in heterogeneous environments. It quickly gained adoption in the networking and systems administration communities due to its comprehensive testing capabilities and detailed output.
While many other network benchmarking tools have emerged, netperf (and thus netserver) remains a widely respected and actively maintained project, continually updated to support modern networking protocols and hardware. Its design, separating client and server components, allows for precise end-to-end performance measurements across different machines.