Detailed explanation of Rendezvous mode of SRT encoder

✦ Function
SRT encoder First, two devices that are set to Rendezvous mode will negotiate together to establish an SRT session through the same UDP port number.
✦ Use scenario
The networks where the two devices are located have firewalls (or routers with equivalent functions). The outside interface of the firewall is a public IP address, but there is no firewall operation authority (that is, port mapping cannot be configured). If the firewall is set to work properly Mode, SRT session can be established through Rendezvous mode.
Once the establishment of the SRT connection is completed, the SRT source device and the SRT target device begin to exchange control information, and then directly use the established SRT channel to transmit data.
✦ Example
Rendezvous mode can establish an SRT connection when the firewalls at both ends have no port forwarding rules, so as to realize video transmission between two points. At this time, you need to set each other's public network IP and the same port number respectively on both ends. In this way, the two devices will send control information packets to each other's public network IP at the same time to establish an SRT connection.
A company temporarily decided to transmit the video signal from the Changsha office to the Shenzhen headquarters in real time. It was too late to apply for port forwarding rules in the firewall, so the devices at both ends could not directly find each other through a specific port of the other party's public IP. At this time, you can use the Rendezvous mode to establish an SRT connection. We need to set the Changsha SRT device (encoder) to Rendezvous mode, and write the export public network IP address of the Shenzhen SRT device and an unused UDP port number At the same time, set the Shenzhen SRT device (decoder) to Rendezvous mode, and write the export public network IP address of the Changsha SRT device and the same UDP port number, so that the SRT connection can be established.
Insert picture description here

Figure: Network relationship between SRT source device (encoder) and SRT target device (decoder)
✦ Principle
In the previous example scenario, the SRT connection in Rendezvous mode can be easily completed, which seems to be natural, but the actual situation is not so Simple, there are some network-related knowledge hidden behind this, let's briefly discuss how SRT uses Rendezvous mode to establish a connection through the firewall.
Of course, network security and firewall is a very profound professional network knowledge. I won't discuss the in-depth content with you here, but simply share the knowledge related to SRT.
First of all, we need to know that when using Rendezvous mode, the source port and destination port of the control information packet sent by the device are the same. In the previous example, the source port of the control information packet sent by the encoder is 12345, and the destination port is also 12345. Similarly, the source port and destination port of the control information packet sent by the decoder are also 12345. In other words, the same "four" port numbers is a necessary condition for establishing an SRT connection through the firewall in Rendezvous mode.
Therefore, the firewall between codecs must ensure that the port number in the packet header is not converted.
Insert picture description here

Figure: In Rendezvous mode, both ends use the same port number to establish SRT connection through the firewall

The firewalls that can be seen on the market today are basically stateful firewalls that can perform stateful inspections (stateful firewalls, now that this function is too common, no one has specifically proposed this concept), it can perform stateful packet inspection or Status view, to achieve the function of connection tracking, and Rendezvous mode is relying on this function to create a network channel that runs through two firewalls and conduct data transmission in it.
When the firewall is working, it will create a connection tracking table based on the traffic being transmitted and keep it updated dynamically.
For example, in the above figure, the connection tracking table in firewall A will record the internal network IP and port number of the source device (encoder), the public network IP and port number after NAT conversion, and the accessed target device (decoder) ) The public IP and port of the firewall are as follows:
Insert picture description here

At this time, when the opposite end sends a data packet, the connection tracking table of firewall A will also record another reverse inbound information, as shown in the following table:

When the reverse data packet arrives at firewall A, the same port number for sending data and receiving data will have a "spoofing" effect on firewall A, making it think that the received inbound data is a reply message to the outbound data, thus allowing The data packet passes through the firewall until the transmission session is disconnected, and the SRT connection is established.
Insert picture description here

In most scenarios, the network devices (firewalls and routers) we use use PAT (NAT reload) for address translation from LAN IP to public IP. At this time, the network device will change the source port number when converting the address, so the Rendezvous mode is mostly unavailable. It is better to use the router as a static port mapping rule directly, so that you can use the Listener mode on this end to monitor the mapped port. , The other end uses the Caller mode to establish a connection; in contrast, the Rendezvous mode is rarely used.

Guess you like

Origin blog.csdn.net/kiloview2019/article/details/105947055