# Setting up tunnel to access compute nodes behind private LAN via front-end

Context

I find the front end on macos way more convenient and I would like to keep my notebooks on my macbook. On the other hand, I have access faster multi-core linux machines behind a LAN.

Hence I would like to be able to use machines with multiple cores which are within a private LAN as remote kernels for a Mathematica front end running on a mac laptop.

The setting is the following:

Attempts

• I know how to set up the (mac) front end on the laptop to run MathKernels on the front-end. (dark green MathLink connection)
• I know how to set up the the (linux) front end to run MathKernels on the compute nodes. (light green MathLink connection)
• If I put my laptop within the private LAN I can run MathKernels on the compute nodes

Question

How do I simply setup the extra options in this dialog box

so as to tunnel through to,say compute 2 from my mac laptop?

Update

@Szabolcs suggests this set of updated scripts

• Might be useful: library.wolfram.com/infocenter/Conferences/7250 – Szabolcs Dec 10 '14 at 21:06
• @Szabolcs Thanks. I did find this but it seems to involve mma 6 and looks a bit complicated. – chris Dec 10 '14 at 21:08
• Finally found it: stackoverflow.com/q/6226196/695132 Take a look at the comments for a newer version of the same (by 'sakra'). I don't use this myself anymore so can't give much advice ... the reason is that I found remote connections to be extremely unreliable when I was using Windows XP (freezing front end), so I gave up. I remember others told me they couldn't reproduce the problems I saw on more modern systems, so you shouldn't give up on OS X because of this. – Szabolcs Dec 10 '14 at 21:16
• Thanks again. I ll try tomorrow at work! – chris Dec 10 '14 at 21:18

## 1 Answer

Having convinced our SysAdmin to grant me access to one compute node by VPN,

I managed to connect to one compute node (b1) using the following parameters in the KernelConfiguration submenu in the Evaluation menu.

Note that I added both to MLOpen and to Launch command the extra parameter

   -Linkhost xxx.xxx.xxx.xxx


where xxx.xxx.xxx.xxx is the IP address of the front-end through the VPN. (which you can access via ifconfig on the frontend host), e.g.

   utun0: flags=8051<UP,POINTOPOINT,RUNNING,MULTICAST> mtu 1500
inet 10.8.0.18


in my case

Then, having launched this tunnel1 Kernel, I am able to drive another sets of three compute nodes via the following command (each of them 40 cores):

Needs["SubKernelsRemoteKernels"];
(LaunchKernels[
RemoteMachine[#,
"ssh -x -f -l 3 1 math -mathlink -linkmode Connect 4 \
-linkname '2' -subkernel -noinit", 40]] // Length) & /@ {"b2","b3","b4"}

\$KernelCount


(* 160 *)

I am now in a position to use 160 kernels instead of 4, which is pretty cool ;-)