STUN (which stands for simple traversal of UDP through NAT) is a pragmatic approach
to solving the problem of connecting VoIP calls through routers. It allows a VoIP client
to determine what type of NAT it is behind and also helps to determine how to route
UDP traffic to the client from the outside world.
By installing the STUN server, VoIP client can intelligently modify the private IP address
and port in its SIP/SDP message by using the NAT mapped public IP address and port.
This
will allow SIP signaling and RTP media to successfully traverse a NAT without
requiring
any configuration changes on the NAT. Click to view image.
Various types of NAT (according to the RFC)
 Full Cone: A full cone NAT is one where all requests from the same internal IP address
and port are mapped to the same external IP address and port. Furthermore, any
external host can send a packet to the internal host, by sending a packet to the mapped external address.
address.
 Restricted Cone: A restricted cone NAT is one where all requests from the same
internal IP address and port are mapped to the same external IP address and port.
Unlike a full cone NAT, an external host (with IP address X) can send a packet to the
internal host only if the internal host had previously sent a packet to IP address X.
 Port Restricted Cone: A port restricted cone NAT is like a restricted cone NAT, but the
restriction includes port numbers. Specifically, an external host can send a packet, with
source IP address X and source port P, to the internal host only if the internal host had
previously sent a packet to IP address X and port P.
 Symmetric: A symmetric NAT is one where all requests from the same internal IP address and port, to a specific destination IP address and port, are mapped to the same external
IP address and port. If the same host sends a packet with the same source address and
port, but to a different destination, a different mapping is used. Furthermore, only the
external host that receives a packet can send a UDP packet
back to the internal host.
STUN uses the following algorithm (adapted from RFC 3489) to discover the presence
of NAT gateways and firewalls.
|