LinuxCommandLibrary

pystun3

Discover NAT type using STUN protocol

TLDR

Check NAT type

$ pystun3
copy
Use specific STUN server
$ pystun3 -H [stun.example.com]
copy
Specify source port
$ pystun3 -p [54320]
copy
Use specific interface
$ pystun3 -i [192.168.1.100]
copy
Verbose output
$ pystun3 -v
copy
JSON output
$ pystun3 --json
copy

SYNOPSIS

pystun3 [-H server] [-p port] [-i ip] [options]

DESCRIPTION

pystun3 is a STUN (Session Traversal Utilities for NAT) client that discovers the type of NAT between a host and the internet. It communicates with a STUN server to determine the NAT classification (full cone, restricted cone, port restricted, or symmetric) and reports the external IP address and mapped port.
Understanding NAT type is essential for configuring VoIP, video conferencing, and peer-to-peer applications that require direct connections between hosts. The tool can target specific STUN servers, bind to particular network interfaces, and output results in JSON format for scripting.

PARAMETERS

-H HOST

STUN server hostname.
-p PORT
Source port.
-i IP
Source IP address.
-v
Verbose output.
--json
JSON output format.
-P PORT
STUN server port.

CAVEATS

Requires network access. STUN server must be reachable. NAT types vary.

HISTORY

pystun3 is a Python 3 port of pystun, implementing STUN (Session Traversal Utilities for NAT) client functionality.

SEE ALSO

stun(1), nmap(1), netcat(1)

> TERMINAL_GEAR

Curated for the Linux community

Copied to clipboard

> TERMINAL_GEAR

Curated for the Linux community