Remote access Jupyter notebook from Windows - ssh

I usually access Jupyter notebook running on Linux from Mac OS X via port forwarding like following:
https://coderwall.com/p/ohk6cg/remote-access-to-ipython-notebooks-via-ssh
Is it possible to do similar thing from Windows 10 instead of Mac OS? I guess putty or WSL offer one.
https://www.akadia.com/services/ssh_putty.html
https://superuser.com/questions/1119946/windows-subsystem-for-linux-ssh-port-forwarding

You can create an SSH tunnel to connect to the Jupyter Notebook or Jupyter Lab web interface using PUTTY on windows.
Download the latest version of PUTTY
Open PUTTY and enter the server URL or IP address as the hostname
Now, go to SSH on the bottom of the left pane to expand the menu and then click on Tunnels
Enter the port number which you want to use to access Jupyter on your local machine. Choose 8000 or greater (i.e. 8001, 8002, etc.) to avoid ports used by other services, and set the destination as localhost:8888 where :8888 is the number of the port that Jupyter Notebook is running on. Now click the Add button, and the ports should appear in the Forwarded ports list.
Click the Open button to connect to the server via SSH and tunnel to the desired ports.
In the PUTTY terminal, run Jupyter, where the default port is 8888
jupyter lab --no-browser or jupyter-notebook --no-browser
Copy the server path into the browser on your local system and navigate to the notebook
http://localhost:8888/lab?token=... or http://127.0.0.1:8888/lab?token=...
Note:
If running remotely to your employer, a VPN connection will probably be required.

As an addendum to this answer, this screenshot shows how putty config looks like:
On the Linux machine, I then start Jupyter with:
jupyter notebook --no-browser --port=8889
Finally, on the windows (or any remote machine) I enter localhost:8888 in the browser.
It asks for the token, that is provided at the shell of the Linux machine.
--
Note which port refers to which machine, I have the notebook on port 8889, the browser calls it at localhost:8888

I solved this problem by myself. My solution is using Windows Subsystem for Linux (WSL). This offers (virtual?) Linux console like Ubuntu. I just use ssh with -L option on it.

Follow the steps below.
step1- Download putty.
step2- Insert ip address or hostname.
step3- Go to SSH and expand.
step4- Add address of jupyter-notebook to destination column ex: localhost:6666. Add local port such as 8000 to source and press add button. Then connect, it should work.

I wanted to use the VPN Server feature of my cable box to enable remoting into my network, especially to run jupyter notebook. For my situation, probably not quite the same as anyone elses, this works fine.
On the cable box, be sure to enable the VPN Server and enable external access.
On the remote Windows 10 computer, add a PPTP VPN specifying cable box's external IP. Connect to the VPN. Verify you can access the network. e.g. You should be able to see the cable box's webpage.
On the Jupyter serving computer, in Windows Defender Firewall, you need to create a new Inbound Rule for a Port.
3.1. General-> Enabled, Allow the connection
3.2. Protocols and Ports-> TCP, 8888
3.3. Scope-> Private
On the Jupyter serving computer, invoke Jupyter (e.g 192.168.0.1, port 8888):
jupyter-notebook --ip 192.168.0.1 --port 8888 --no-browser
On the remote computer, you should now be able to access your Jupyter server by browsing to http://192.168.0.8:8888/tree

Related

Why can not conntect to the IP provided by my WSL console when i trying to use static-server for testing on mobile

I am using NODE and npm static-server to display my .html files on the local network.
I have no problems when I use Git Bash to deploy static-server. I was able to access from my mobile device using the ip that I got with ipconfig (the option LAN adapter Wi-Fi).
The problem is when I try to do the same process but from my WSL Terminal (Windows Subsystem for Linux).
The IP obtained with the ip address command allows me to access it from my own computer, but I cannot access it from my mobile device.
In the Git Bash environment the command ipconfig shows me several IPs including the Wi-Fi LAN adapter, and using it I was able to connect effectively. But in the WSL environment I only get one IP, and it does not work to access from my mobile through the Wi-Fi network, I just can access to it from the computer.
Does the NODE version have something to do with it? or should i use a different command in the WSL environment to obtain Wi-Fi LAN adapter IP? In this case, which command? Thanks
Commparative image Basch vs WSL and NODE version

How can I have different ip for differnt distrubutions on wsl2?

I am running 5 different Ubuntu distro on wsl2 but all are having the same ip address.For example Ubuntu 18.04 and Ubuntu 20.04 are having the same ip. Is it possible to have different ips on each Ubuntu versions?
Full disclosure: This answer does not address networking between to wsl2 instances. Rather, it presents - as requested from a commenter - an alternative way to have two guest operating systems to each have their own IP address within a network that is "inside" the host OS.
The following allows for two VMs (rather than wsl2 instances) to have different IP addresses within a network within a host Windows 10 operating system:
Prerequisites in no particular order:
Disable the Hyper-V Windows Feature. This page describes a variety of ways to go about it, but I went the Control Panel route.
Install VirtualBox
Set up a network for the VMs to share:
Open VirtualBox
Click File > Preferences
Click Network
Click the icon with a plus sign (+) in it to add a new network
Create your VMs and connect them to this network
Create the VM and give it an operating system as you would otherwise
Shut down the VM
Select the VM in the main VirtualBox window, click the Settings/gear button
Click Network
Select NAT Network for "Attached to"
Select the name of the network you created above. (A sample that worked for me is below.)
Customize the overall network settings for the VMs
Return to main VirtualBox window > File > Preferences > Network
Click gear icon to edit the network
Click Port Forwarding
Enter details (such as the following, but modified for you needs) to direct traffic from local host to certain IP addresses/ports within this network
You can create new processes with new network namespaces, so you can achieve network isolation.
ip netns add net1
ip netns exec net1 ip addr add 192.168.99.10/24 dev sit0
ip netns exec net1 exec bash
Reference: https://blogs.igalia.com/dpino/2016/04/10/network-namespaces/
May you can try this solution: https://superuser.com/a/1715457/860784, with which I managed to get multiple IPs. And I can ping each other.
However, after reboot these IPs lost, and I still get my distros the same IP, which is exact the windows ip.
May you can sovle your problem and my problem. :)

Remote access to a Jetson Nano

I am trying to remotely access a Jetson Nano from my mac. So far I have done the following:
I installed microsoft Remote Desktop on my mac
I connected the nano with my mac through the Micro-usb Port
In network I could see the connection "linux for Tegra" where my nano would be 192.168.55.1
With this I still cannot remote access the nano
So I open a terminal and typed
>ssh username#192.168.55.1
and I could access the nano terminal.
So I think now, I have to do
>sudo apt install xrdp
in order to be able to remotely access the GUI.
However, the nano does not have internet connection.
Is there a way that it can use the internet connection of my mac to do this?
(I am reading a tutorial on Rasppi with windows and apparently this is possible)
One of the approaches is to install X server for mac and then use ssh -Y username#192.168.55.1. You will get the command line shell first but you can type in commands like gedit - they windows will show up on the host.
192.168.55.1 is the same network as any other. All tools supposed to work over TCP/IP should work with it as well.
USB is a Serial connection by default.
On windows use a putty based tool.
For example start with MobaXterm > New session > Serial #11500
Login
Password
It won't forward internet by default.
Best simple way is to plug in your phone as USB network sharing and plug in to the laptop via micro-USB.
For Linux, Ubuntu, use a serial ("COM" related stuff) tool.
If you want to do ssh through USB it will require custom editing of networking file.
By default Nano is using a bridge called L4TBRO on 192.168.55.1, laptop is client in .100.
DNS server is on Nano's side.
You would have to create a new interface but using your laptop as DCHP and DNS servers.
Note that usb can power the Jetson Nano for continuous execution on a recent laptop. Some recommends not to and it may crash if you run a compilation on all cores. (if it crashes, just disable 2 cores via nvpmodel -m 1)

Windows 10 update then can't connect to guest vm

I'm a beginner in vm, I always used a working vm :D but today I've a big problem... :?
I've just updated my system windows 10 with the new available and suggested update, but now I can't connect to my guest vm.
Before (after windows update) I runned virtualbox 5.1.14 and it doesn't work, now I installed virtualbox 5.1.30 with the same result.
Before window's update it worked.
Initially I had one problem, host-only network doesn't works and the vm didn't start, so I deleted the old host-only network and created a new one and now the vm start, but I can't connect to the machine, that has a static ip (192. 168. 109. 151), with putty via ssh port 22, and also via http.
I used this ip address to connect to vm via browser.
The vm can ping google, and in virtualbox command line I can log in and make everything.
Some one know why I can't connect with my vm?
In virtualbox preferences I have set host-only network with this values:
IPV5 address 219.168.56.1
DHCP: 192.168.56.102
mask: 255.255.255.0
lower: 192.168.56.103
upper: 192.168.56.254
ok, now I can access via putty to port 22. I needed to add the static ip of the vm to virtualbox host-only network net in windows control panel, to tcp/ip protocol.
Now I need to acces via browser. For the moment it doesn't works

Connect to remote iPython notebook

I want to connect to existing notebooks via ssh tunnel / vpn on a remote linux machine.
I can not log in to the remote desktop viewing them,
but can generally log into another desktop session via Windows Remote Desktop (Win7, Linux with xrdp), so that I found the *.json files containing the ports (see similar questions 1, though I have no experience in finding the correct job/file).
After connecting a vpn and putty ssh tunnel (port A), I tried to access localhost:A by opening that in Firefox. Also I tried to run ipython notebook --existing kernel-B.json.
This did not work.
Do notebooks have to be on the tunneled port?
Or is there a way to connect (not start as in 2), or should I open a tunnel for every notebook port?
Similar questions:
Connecting to a remote IPython instance
Connect ipython-notebook via SSH tunnel from a remote location
Read this:
How do I add a kernel on a remote machine in IPython (Jupyter) Notebook?
Remote jupyter kernel/kernels administration utility (the rk) here:
https://github.com/korniichuk/rk
Should I open a tunnel for every notebook port?
Yes!