Mediasoup's WebRtcServer concerning firewall settings and port binding.

Hello everyone,

I have a doubt on configuring Mediasoup’s WebRtcServer concerning firewall settings and port binding.

Suppose I’m using the WebRtcServer with 3 Workers:

  1. Are only the ports utilized by the WebRtcServer required to be unblocked and bindable, meaning just 3 ports in this scenario?

  2. Additionally, do I need to ensure that the ports defined by rtcMinPort and rtcMaxPort are unblocked by the firewall and are also bindable too?

I would greatly appreciate any insights into this matter. Thank you!

If you only use WebRtcServers then you must only care about opening their individual ports.

So correct me if I’m wrong?

  • When opting not to utilize the WebRtcServer and instead managing RTP and RTCP traffic manually, the specified ports defined by rtcMinPort and rtcMaxPort become indispensable. In this scenario, it is imperative to ensure that these ports remain unblocked by the firewall and are bindable to facilitate seamless communication.

  • Conversely, when utilizing the WebRtcServer, it abstracts the management of RTP and RTCP traffic, handling it internally. Consequently, the primary concern shifts to ensuring that the ports utilized by the WebRtcServer remain unblocked and are bindable. This enables the WebRtcServer to efficiently manage and distribute WebRTC traffic across the specified ports, streamlining the process.

See listenInfos parameter given to createWebRtcTransport(): if you specify port in those listenInfos then, again, no port range is used. If you don’t specify port in them then port range of the worker is used. If you don’t specify listenPorts and instead pass a webRtcServer, then the listenInfos of the WebRtcServer are used, and there port is required so again no port range is used.

Yeah,

In conclusion in the scenario where i employing 3 instances of WebRtcServer, each configured with distinct listenInfos to operate on separate UDP/TCP ports, for instance

[4/4/2024, 12:05:23:444] [Server] Create a WebRtcServer {
  worker_pid: 43294,
  webRtcServerOptions: {
    listenInfos: [
      {
        protocol: 'udp',
        ip: '0.0.0.0',
        announcedAddress: 'Server Ipv4',
        port: 44444
      },
      {
        protocol: 'tcp',
        ip: '0.0.0.0',
        announcedAddress: 'Server Ipv4',
        port: 44444
      }
    ]
  }
}
[4/4/2024, 12:05:23:465] [Server] Create a WebRtcServer {
  worker_pid: 43295,
  webRtcServerOptions: {
    listenInfos: [
      {
        protocol: 'udp',
        ip: '0.0.0.0',
        announcedAddress: 'Server Ipv4',
        port: 44445
      },
      {
        protocol: 'tcp',
        ip: '0.0.0.0',
        announcedAddress: 'Server Ipv4',
        port: 44445
      }
    ]
  }
}
[4/4/2024, 12:05:23:483] [Server] Create a WebRtcServer {
  worker_pid: 43296,
  webRtcServerOptions: {
    listenInfos: [
      {
        protocol: 'udp',
        ip: '0.0.0.0',
        announcedAddress: 'Server Ipv4',
        port: 44446
      },
      {
        protocol: 'tcp',
        ip: '0.0.0.0',
        announcedAddress: 'Server Ipv4',
        port: 44446
      }
    ]
  }
}

and i pass them to the createWebRtcTransport(), I need only to guarantee that these 3 ports (44444,44445,44446 UDP/TCP) remain unblocked by the firewall and are available for binding. Each WebRtcServer instance abstracts the management of RTP and RTCP traffic, handling it internally, without the need to use the rtcMinPort-rtcMaxPort port ranges.

Yes, that’s.

2 Likes

Thank you for the confirmation!