Jan 152013

Access to Flexlm license server via a SSH tunnel  with port forwarding is possible but require you to do some tweak in Windows or Linux client.

Using SSH or OpenSSH for Windows or Linux  is easy to create a port forwarding. Let say we want to forward all requests to a  remote server license port but pass all requests via  a local port. We will then create a local port 2300 on the localhost and forward it requests to the remote server’s license port. This can be done like this…

ssh username@servername.cie.com   -L   2300:servername.cie.com:2300   -N
(-N will not open a command session but will keep the tunnel open)

It can however be a bit more complex. Your software using flexlm normally use LM_LICENSE_FILE variable (or a vendor defined variable) to find where the license is located. I.E. port@host-server or LM_LICENSE_FILE=2300@servername.cie.com

The software will send it’s requests for a key to that port but then a problem will occur when the flexlm server answers the client sortware to get it’s actual license key from a different port on the full server name. Remember that we asked thru the port forwarding (the software asked not the server directly but a local port@localhost with the local port forwarding). This second port is the Vendor Daemon port number I.E. 2301@servername.cie.com. This port can be define in the license.dat file on the server. In our case it’s mandatory to define it so we can also forward it. The server license.dat should look similar to this:

SERVER servername.cie.com 000000000 2300
DAEMON name  “/usr/local/flexlm/bin/name” port=2301

On the client/user side, configuration should be made so all tentative to access the remote server (any request) be force to access it through the localhost. This been done easily but remember that you will only be able to access the server via ssh and it’s IP address and the full host-name will not work anymore.

In order to define the server name to the localhost IP address is easy. In Windows using notepad++ or notepad Edit the text file C:\windows\system32\drivers\etc\hosts. You will need Administrator privileges to do this; or open it and save it to the desktop then copy it to the directory. In Linux the file is located in /etc/hosts.

127.0.0.1  localhost
127.0.0.1  servername.cie.com

When this is done, no need to reboot, just forward the two port from localhost to the remote server using it’s IP address.

ssh username@111.222.111.222   -L   2300:111.222.111.222:2300   -L   2301:111.222.111.222:2301  -N
(enter your password when asked.)

This been setup, you can now use the software you want from home and use your license server.

Voila.

One Response to “Howto access Flexlm license server via ssh tunnel with port forwarding”

  1. lobo says:

    Works great.
    I had trouble figuring out the SSH man page and this was a nice example for Solidworks LIcencing with the extra port info which I was unaware of too so saved me quite a bit of time.
    Thanks for the post.

Leave a Reply

(required)

(required)