STUNSERVER(1)

NAME

stunserver - STUN protocol service (RFCs: 3489, 5389, 5789, 5780)

SYNOPSIS

stunserver [OPTIONS]

DESCRIPTION

stunserver starts a STUN listening service that responds to STUN binding requests from remote clients. Options are described below.

OPTIONS

The following options are supported.

      --mode MODE
      --primaryinterface INTERFACE
      --altinterface INTERFACE
      --primaryport PORTNUMBER
      --altport PORTNUMBER
      --family IPVERSION
      --protocol PROTO
      --maxconn MAXCONN
      --verbosity LOGLEVEL
      --help

Details of each option are as follows.

—mode MODE

Where the MODE parameter specified is either “basic” or “full”. In basic mode, the server listens on a single port. Basic mode is sufficient for basic NAT traversal scenarios in which a client needs to discover its external IP address and obtain a port mapping for a local port it is listening on. The STUN CHANGE-REQUEST attribute is not supported in basic mode.

In full mode, the STUN service listens on two different interfaces and two different ports on each. A client binding request may specify an option for the server to send the response back from one of the alternate interfaces and/or ports. Full mode facilitates clients attempting to discover NAT behavior and NAT filtering behavior of the network they are on. Full mode requires two unique IP addresses on the host. When run over TCP, the service is not able to support a CHANGE-REQUEST attribute from the client.

If this parameter is not specified, basic mode is the default.

   * * * * *

—primaryinterface INTERFACE

Where INTERFACE specified is either a local IP address (e.g. “192.168.1.2”) of the host or the name of a network interface (e.g. “eth0”).

The interface or address specified will be used by the service as the primary listening address.

In basic mode, the default is to bind to all available adapters (INADDR_ANY). In full mode, the default is to bing to the first non-localhost adapter with a configured IP address.

   * * * * *

—altinterface INTERFACE OR IPADDRESS

Where INTERFACE specified is either a local IP address (e.g. “192.168.1.3”) of the host or the name of a network interface (e.g. “eth1”).

This parameter is nearly identical as the —primaryinterface option except that it specifies the alternate listening address for full mode.

This option is ignored in basic mode. In full mode, the default is to bind to the second non-localhost adapter with a configured IP address.

   * * * * *

—primaryport PORTNUM

Where PORTNUM is a value between 1 to 65535.

This is the primary port the server will bind to for listening for incoming binding requests. The service will bind both the primary address and the alternate address to this port.

The default is 3478.

   * * * * *

—altport PORTNUM

Where PORTNUM is a value between 1 to 65535.

This is the alternate port the server will bind to for listening for incoming binding requests. The service will bind both the primary address and the alternate address to this port.

This option is ignored in basic mode. The default is 3479.

   * * * * *

—family IPVERSION

Where IPVERSION is either “4” or “6” to specify the usage of IPV4 or IPV6.

The default family is 4 for IPv4 usage.

   * * * * *

—protocol PROTO

Where PROTO is either IP protocol, “udp” or “tcp”.

udp is the default.

   * * * * *

—maxconn MAXCONN

Where MAXCONN is a value between 1 and 100000.

For TCP mode, this parameter specifies the maximum number of simultaneous connections that can exist at any given time.

This parameter is ignored when the protocol is UDP. The default value is 1000

   * * * * *

—verbosity LOGLEVEL

Where LOGLEVEL is a value greater than or equal to 0.

This parameter specifies how much is printed to the console with regards to initialization, errors, and network activity. A value of 0 specifies a very minimal amount of output. A value of 1 shows slightly more. A value of 2 shows even more. Specifying 3 will show a lot more.

The default is 0.

   * * * * *

—help

Prints this help page

EXAMPLES

stunserver
    With no options, starts a basic STUN binding service on UDP port 3478.

stunserver —mode full —primaryinterface 128.34.56.78 —altinterface 128.34.56.79
    Above example starts a dual-host STUN service on the the interfaces identified by the IP address “128.34.56.78” and “128.34.56.79”. There are four UDP socket listeners

    128.34.56.78:3478 (Primary IP, Primary Port) 128.34.56.78:3479 (Primary IP, Alternate Port) 128.34.56.79:3478 (Primary IP, Primary Port) 128.34.56.79:3479 (Alternate IP, Alternate Port)

An error occurs if the addresses specified do not exist on the local host running the service.

stunserver —mode full —primaryinterface eth0 —altinterface eth1
    Same as above, except the interfaces are specified by their names as enumerated by the system. (The “ifconfig” or “ipconfig” command will enumerate available interface names.

AUTHOR

john selbie (john@selbie.com)