Session Traversal Utilities for NAT
Session Traversal Utilities for NAT (STUN) is a standardized set of methods, including a network protocol, for traversal of network address translator (NAT) gateways in applications of real-time voice, video, messaging, and other interactive communications.
STUN is a tool used by other protocols, such as Interactive Connectivity Establishment (ICE), the Session Initiation Protocol (SIP), or WebRTC. It provides a tool for hosts to discover the presence of a network address translator, and to discover the mapped, usually public, Internet Protocol (IP) address and port number that the NAT has allocated for the application's User Datagram Protocol (UDP) flows to remote hosts. The protocol requires assistance from a third-party network server (STUN server) located on the opposing (public) side of the NAT, usually the public Internet.
Originally, STUN was an acronym for Simple Traversal of User Datagram Protocol (UDP) through Network Address Translators, but this title was changed in a specification of an updated set of methods published as RFC 5389, retaining the same acronym.
About
- 스턴(STUN) 서버는 공용 인터넷 망에 위치하며, 라우터의 NAT 뒤에 있는 피어(Peer)가 공인 IP 주소를 요청할 때 해당 주소를 확인하고 외부 망에서 접근 가능한 IP:PORT 정보를 알려주는 역할을 한다.
- NAT 네트워크에 존재하는 피어(Peer)는 사설IP 를 가지므로 외부에 있는 WebRTC 피어와 통신할 수 없으므로, STUN 서버를 통해 공인 IP 주소(Public IP)를 알아 내고 P2P로 직접적인 연결을 하는데 방해되는 요소가 라우터 내에 있는지 알아낸다.
- STUN 서버는 클라이언트가 공용 주소, 이면에 있는 NAT의 유형 및 NAT에 의해 특정 로컬 포트와 연결된 인터넷 측 포트를 찾을 수 있도록 해줍니다. 이 정보는 클라이언트와 VOIP 제공업체 사이의 UDP 통신을 설정하는 데 사용되며, 따라서 통화를 연결하는 데 사용됩니다. STUN 프로토콜은 RFC3489에 정의되어 있습니다.
- STUN 서버는UDP 포트 3478에 연결되지만 서버는 클라이언트가 대체IP 및 포트 번호에서 테스트를 실행하도록 힌트를 제공합니다(STUN 서버에는 2개의 IP 주소가 있음). RFC에는 포트 및 IP가 임의적이라고 명시되어 있습니다.
Projects
Flow chart
Stun_flow_chart.png
STUN(RFC 5780)을 이용한 NAT Behavior Discovery
지난 시간과 마찬가지로 본 내용을 이해하기 위해서는 아래 블로그글을 반드시 먼저 읽어 보시기 바랍니다.
- NAT 장비는 이렇게 만들어야 하는데... (RFC 4787) - 1편: Mapping Behavior
- NAT 장비는 이렇게 만들어야 하는데... (RFC 4787) - 2편: Filtering Behavior
- STUN(RFC 3489)과 STUN(RFC 5389/5780)의 차이
Troubleshooting
stun:localhost is not connect
Firefox를 사용할 경우 Trickle ICE에서 coturn등을 사용해, stun:localhost
로 접속할 경우 정상적으로 접속되지 않는다면 about:config
페이지에서 아래와 같이 수정한 후 테스트 해보자.
자세한 사항은 Firefox#WebRTC Privacy 항목 참조.
만약 Edge를 사용할경우 Edge#WebRTC LocalHost IP Setting 항목 참조. 간단히, regedit의 Software\Policies\Microsoft\MicrosoftEdge\Main
경로 참조.
만약 Chrome을 사용할 경우 Chrome:WebRTC#localhost ICE 항목 참조. 간단히, chrome://flags/#enable-webrtc-hide-local-ips-with-mdns
플래그를 Disable
로 변경.
WARNING |
|
See also
- WebRTC
- Session Traversal Utilities for NAT (STUN)
- Traversal Using Relays around NAT (TURN)
- Interactive Connectivity Establishment (ICE)
- Network address translation (NAT)
- UDP hole punching
Favorite site
- Wikipedia (en) STUN
- WebRTC in the real world: STUN, TURN and signaling
- STUN, TURN, ICE 이해하기
- WebRTC: Configure Your Own TURN/STUN Server (red5, TURN, STUN, WebRTC)
- [추천] TURN/STUN Server - Red5 Pro Server - Red5 Pro Docs
- (WebRTC) STUN 과 TURN 에 대하여 #1 - 개요
- [그림] WebRTC란? (STUN과 TURN 서버의 이해) (2)
Tutorials
- NAT (Network Address Translation) 소개 (RFC 3022/2663)
- NAT 장비는 이렇게 만들어야 하는데... (RFC 4787) - 1편: Mapping Behavior
- NAT 장비는 이렇게 만들어야 하는데... (RFC 4787) - 2편: Filtering Behavior
- NAT 장비는 이렇게 만들어야 하는데... (RFC 4787) - 3편: Deterministic Properties
- STUN(RFC 3489)과 STUN(RFC 5389/5780)의 차이 (STUN, NAT)
- STUN(RFC 5780)을 이용한 NAT Behavior Discovery (STUN, NAT)