Skip to content

Traversal Using Relays around NAT

Traversal Using Relays around NAT (TURN) is a protocol that assists in traversal of network address translators (NAT) or firewalls for multimedia applications. It may be used with the Transmission Control Protocol (TCP) and User Datagram Protocol (UDP). It is most useful for clients on networks masqueraded by symmetric NAT devices. TURN does not aid in running servers on well known ports in the private network through a NAT; it supports the connection of a user behind a NAT to only a single peer, as in telephony, for example.

TURN is specified by RFC 5766. An update to TURN for IPv6 is specified in RFC 6156. The TURN URI scheme is documented in RFC 7065.

직접(P2P) 연결이 실패할 경우 트래픽을 중계하는 데 사용되는 서버

INFORMATION

기본 포트는 3478

About

  • 턴(TURN) 서버는 Peer가 방화벽 또는 프록시 뒤에 위치하거나 다른 이유로 인해 직접 연결을 실패하면, 중간에서 오디오/비디오/데이터 스트리밍 등의 데이터를 릴레이 해주는 역할을 맡는다.
  • WebRTC는 인터넷 상에서 먼저 피어(Peer) 간에 UDP로 직접 통신을 시도하고, 이를 실패하면 TCP를 이용하는데 이마저 실패하면 TURN 서버를 거치게 된다. (하지만 실제로는 TCP는 잘 이용되지 않는다)
  • 공용 주소를 가지고 있으므로 스턴(STUN) 서버 역할을 함께 제공한다. 따라서 스턴 서버를 별도로 두지 않고 턴 서버에 스턴 서버 기능을 이용하는 경우가 많다.

TURN relay example

  • 서버 예제는 coturn 항목 참조.

Client javascript:

var config = {
    sdpSemantics: "unified-plan",
    iceServers: [
        { urls: ["turn:192.168.0.106"], username: "admin", credential: "0000" },
    ],
    iceTransportPolicy: "relay",
    iceCandidatePoolSize: "0",
};
var pc = new RTCPeerConnection(config);

Projects

Troubleshooting

stun:localhost is not connect

Session Traversal Utilities for NAT#stun:localhost is not connect 항목 참조.

See also

Favorite site