[IPython-User] Tunnelling ipython notebook through gateway server

Jimmie Yoo jimmie.yoo@chaj....
Thu Feb 21 10:37:19 CST 2013

I had to do something like this recently and one of the simplest ways that
I've found is to modify your ssh config file as follows:

[user@mylaptop ~/]# cat .ssh/rsg_config
# Host is whatever friendly name you want to use for the ipython_host
Host ipy_host

  # ipython_host ssh username
  User         ipython_user

  # Actual ipython hostname
  HostName     ipython.bla.local

  # Path to your private key file if you're using one and only needs
  # to be defined if you're not using the default one (~/.ssh/id_rsa)
  # This will come into play when connecting to the gateway
  IdentityFile ~/.ssh/ipython_id_rsa

  # This is the command that will be invoked on the gateway host after
  # you connect. As you can see it simply executes an nc (netcat) which just
  # echoes all of your traffic to the ipython_host
  # %h is the 'HostName' defined above
  # %p is the port which defaults to 22
  ProxyCommand ssh -q -i ~/.ssh/ipython_id_rsa
gatewayuser@gateway.bla.localnc %h %p 2>/dev/null

You should then in theory be able to access the ipython notebook instance
on your laptop by running:

ssh -L 8888:localhost:8888 ipy_host &
(& will background)

and then you should be able to hit the site in your browser on

Lemme know if this works or if you have any questions. If this does work
perhaps we should post this somewhere.


On Thu, Feb 21, 2013 at 6:16 AM, Jose Gomez-Dans <jgomezdans@gmail.com>wrote:

> Hi,
> I have access to a cluster where I can run ipython. I would like to tunnel
> the notebook port so I can access it from my computer, but I have only seem
> how to do that for machines that are single hop.
> My setup is as follows:
> laptop  -----SSH-----> gateway  -----SSH-----> ipython_host
> So I would need to map port 7000 (eg) on ipython_host through to the
> gateway and back to laptop. It's fairly straightforward to tunneling
> between laptop and gateway, but I can't run ipython there.
> Does anyone have any suggesting, or I should just desist?
> Thanks!
> Jose
> _______________________________________________
> IPython-User mailing list
> IPython-User@scipy.org
> http://mail.scipy.org/mailman/listinfo/ipython-user
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/ipython-user/attachments/20130221/5a01b8b2/attachment.html 

More information about the IPython-User mailing list