Matlab tunnel for ESMF computing nodes

Description of how port forwarding is configured to allow the private LAN computing nodes to access the Matlab licensing server on the public network.

Create the lmgr user account

The lmgr user account was created:

# grep lmgr /etc/passwd
lmgr:*:1108:1066:FlexLM License Manager:/u/lmgr:/usr/local/bin/bash

An ssh authentication key was generated to allow the lmgr account to login without a password; the known_hosts file was also pre-generated since the creation of the SSH tunnel will not be an interactive process. Edit the ~lmgr/.bash_profile to comment out any commands requiring an interactive response (e.g. querying for terminal type) or a tty (e.g. stty commands).

Edit /etc/hosts on each node

Each computing node on the private VLAN needs an entry in its local /etc/hosts file with the license server hostname set to the IP address of a "gateway" server which has access to the license server. For the ESMF, the Matlab license server is seshat.nacs.uci.edu and the gateway machine is esmf04m, so the following entries are created:

# grep 192.168.1.12 /etc/hosts
192.168.1.12    esmf04m esmf04m.ess.uci.edu # frame 4 100 Mb
192.168.1.12    seshat.nacs.uci.edu # frame 4 100 Mb

The server name must match the SERVER entry in the license.dat file. The gateway host doesn't need this entry since it already has access to the license server.

Start the SSH tunnel

On the gateway host, run the ~lmgr/bin/license_tunnel script as the lmgr user.

# cat ~lmgr/bin/license_tunnel
#! /usr/local/bin/bash

# This scripts creates ssh tunnels to allow computing nodes on the ESMF
# private network to access a license server running on LMHOST.  It requires
# that each host have an entry in /etc/hosts with LMHOST having the IP address
# of GATEWAY.


# server specified in the license.dat file
LMHOST=seshat.nacs.uci.edu
# port specified in the license.dat file
LMPORT=1711
# daemon port on the LMHOST server which is listed in a file on the server
DAEMONPORT=42279

GATEWAY=esmf04m
SSH=/usr/local/bin/ssh
# -q is quiet
# -n sets stdin to /dev/null
# -x disables X11 forwarding
# -g allows non localhost host connects, i.e. acts as a gateway for other hosts
SSHOPTIONS="-q -n -x -g"
# dummy command to keep the connection open
MYSLEEP=~lmgr/bin/mysleep


if [ `hostname` = $GATEWAY ]
then
    # connect to FlexLM on $LMHOST
    $SSH $SSHOPTIONS -L ${LMPORT}:${LMHOST}:${LMPORT} $GATEWAY $MYSLEEP 2>&1 >/dev/null &

    sleep 2

    # connect to MLM license on $LMHOST
    $SSH $SSHOPTIONS -L ${DAEMONPORT}:${LMHOST}:${DAEMONPORT} $GATEWAY $MYSLEEP 2>&1 >/dev/null &
fi
# su - lmgr
esmf04m$ bin/license_tunnel

Verifying that SSH tunnel is working

Check for the lmgr user process.

esmf04m$ ps -u lmgr -f
     UID     PID    PPID   C    STIME    TTY  TIME CMD
    lmgr  786600 1605714   0 15:05:52      -  0:00 sshd: lmgr@notty 
    lmgr 1253602 1876046   1 17:03:34 pts/26  0:00 ps -u lmgr -f 
    lmgr 1294508       1   0 15:05:51 pts/26  0:00 /usr/local/bin/ssh -q -n -x
    lmgr 1319116 1302758   0 15:05:54      -  0:00 sshd: lmgr@notty 
    lmgr 1466492 1319116   0 15:05:54      -  0:00 /bin/sh /u/lmgr/bin/mysleep
    lmgr 1671394 2253018   0 16:05:52      -  0:00 sleep 3600 
    lmgr 1876046 2195614   0 17:03:00 pts/26  0:00 -bash 
    lmgr 2113756       1   0 15:05:53 pts/26  0:00 /usr/local/bin/ssh -q -n -x
    lmgr 2253018  786600   0 15:05:52      -  0:00 /bin/sh /u/lmgr/bin/mysleep
    lmgr 2293784 1466492   0 16:05:54      -  0:00 sleep 3600 

Test with the lmstat command on a compute node.

esmf01m$ /usr/local/matlab/etc/lmstat
------------------------------------------------------------------
lmstat - Copyright (C) 1989-2001 Globetrotter Software, Inc.
Flexible License Manager status on Wed 6/29/2005 17:07

License server status: 1711@seshat.nacs.uci.edu
    License file(s) on seshat.nacs.uci.edu: /export/home/license.dir/matlab-7/license.dat:

seshat.nacs.uci.edu: license server UP (MASTER) v8.0

Vendor daemon status (on seshat.nacs.uci.edu):

       MLM: UP v8.0

------------------------------------------------------------------

Run the matlab command on a compute node.

esmf01m$ /usr/local/bin/matlab

                              < M A T L A B >
                  Copyright 1984-2003 The MathWorks, Inc.
              Version 6.5.1.199709 Release 13 (Service Pack 1)
                                Aug  4 2003

 
  To get started, type one of these: helpwin, helpdesk, or demo.
  For product information, visit www.mathworks.com.
 
>>

"Je sui fini"

"I am finished"

Last modified: Mon Jul 18 13:32:43 PDT 2005