The network license manager requires two TCP ports for normal operation. The license manager contains two processes, the license manager daemon (lmgrd) and the vendor daemon (MLM). Each of these processes operate on a different port. The ports for each process are specified within the MATLAB license file on the license server. These ports are not locked and can be changed to any available TCP ports on the machine.
The port used by the license manager daemon (lmgrd) is used to listen for incoming license requests from the client application. This port is set to 27000 by default during installation. Once lmgrd is contacted by the client application, the vendor daemon (MLM) responds with the name and location of the vendor daemon and a second port number. The second port is used for communication between the client application and MLM. The MLM port is the one that is used for communication of license checkout and status requests. The port used by MLM is not set by default. When it is not set, the port is chosen randomly.
The ports of the license manager are specified within the license.dat file on the license manager machine. The license manager files are located in the MATLAB installation directory (on the server) in the flexlm folder on Windows (etc as of R2010b), and in the MATLAB installation directory in the etc subdirectory on all other systems. The port for lmgrd is set in the SERVER line of the license.dat file. For example, to specify port 27000, you would have the following:
SERVER server1 8090bf8d 27000
To change the port, change 27000 to another number. It is recommended that you choose a value between 27000 and 27010.
The port assignment for MLM is specified in the DAEMON line of the license.dat file. By default this is not set. To change the port you can append "port=" and the port number at the end of the DAEMON line. For example:
DAEMON MLM "C:\Program Files\MATLAB\R2018b\etc\win64\mlm.exe" port=1049
In this example, the port for MLM would be 1049. Specifying the port assignment for MLM can be useful if you are running the license manager through a firewall. In that case you will want to use specified ports so that these can be opened in the firewall.