In slurm.conf add the parameter SrunPortRange=min-max. If this is
configured then srun will use its dynamic ports only from the configured
range.