MATLAB: How to configure MATLAB Parallel Server using the MATLAB Job Scheduler to work within a firewall

MATLAB Parallel Server

I am installing MATLAB Parallel Server and Parallel Computing Toolbox. I plan on using the MATLAB Job Scheduler.
My network has a firewall, and I would like to know which ports need to be opened.

Best Answer

All ports listed here should be opened to inbound traffic from any machine unless otherwise stated. Outbound communication for cluster happens through ephemeral ports.
======================================================================================
Cluster Machine Ports
The BASEPORT is set to 27350 by default in the mjs_def file found in: MATLABROOT/toolbox/parallel/bin/
NOTE: In R2019a and later, mdce_def was renamed to mjs_def.
These formulas should be calculated per machine and should reflect the number of each type of service running on that machine rather than across the entire cluster.
nJ is the number of job managers running on the machine.
nW is the number of workers running on the machine.
R2010b - R2014b:
BASEPORT to BASEPORT+5+nJ+3*nW
BASEPORT+1000 to BASEPORT+1000+2*nW (only to other cluster machines)
R2015a - R2016b:
BASEPORT to BASEPORT+5+nJ+3*nW
BASEPORT+1000 to BASEPORT+1000+2*nW (only to other cluster machines)
Two additional required port ranges were introduced in these versions. The default value of these new port ranges are shown in brackets below:
JOBMANAGER_PEERSESSION_MIN_PORT to JOBMANAGER_PEERSESSION_MAX_PORT (14351 to 14383)
WORKER_PARALLELPOOL_MIN_PORT to WORKER_PARALLELPOOL_MAX_PORT (14384 to 14448)
To customize the jobmanager_peersession or worker_parallelpool ranges please follow the instructions in:
R2017a+:
Port ranges in this version were simplified.
BASEPORT to BASEPORT+6+nJ+4*nW
BASEPORT+1000 to BASEPORT+1000+2*nW (only to other cluster machines)
======================================================================================
Client Machine Ports
These port ranges can be controlled using the function pctconfig in MATLAB on the client machine.
R2006b - R2009a:
27370 to 27371
R2009b - R2014b:
27370 to 27470
R2015a - R2016b:
No inbound port range needed.
Outbound ports 14351 through 14351 + nJ
R2017a+:
No inbound port range needed.
Outbound ports 14351 through 14351 + nJ
======================================================================================
Admin Center
Port 7 on the machine using Admin Center needs to be open for all connectivity tests to pass without warning. This port is *not *required for cluster setup or general cluster operation.
======================================================================================
Online Licensing
Port 443 for https needs to be open for outbound communication from cluster machines if the cluster is set to use Online Licensing.
---------------------------------------------------------------------------
Additional note/update regarding R2019a:
  • mjs_def.bat is located in $MATLAB/R20XXx/toolbox/distcomp/bin for R2019a and earlier releases.
  • In R2019a and later, mdce_def was renamed to mjs_def.