When running jupyter notebook inside a conda virtual enviornment in wsl (Windows subsystem for linux), copy pasting the url wont work. It always shows "It took too long to respond" or "Connection timed out".
• Try in another browser (e.g. if you normally use Firefox, try with Chrome). This helps pin down where the
problem is.
• Try disabling any browser extensions and/or any Jupyter extensions you have installed.
• Some internet security software can interfere with Jupyter. If you have security software, try turning it off
temporarily, and look in the settings for a more long-term solution.
• In the address bar, try changing between localhost and 127.0.0.1. They should be the same, but in some
cases it makes a difference.
I ran into a similar problem but I wasn't using a virtual environment. Are you trying to connect to the server from the host computer? And are you using the private IP address or localhost address to connect?
I couldn't connect to the server on WSL from the local or remote network.
Apparently, WSL 2 uses a virtual network adapter that has its own IP address. It also changes the IP address every time the server is restarted. I had to write a script that forwarded the network traffic from the virtual machine to the host computer. This allowed me to access the server using the private IP address of the host computer.
I wrote an article about how to do it to make it easier for everyone:
How to Set Up the Jupyter Notebook Home and Public Server On Windows Subsystem for Linux 2 (WSL2)
Related
It's not enough for me to bind WSL ports to localhost because I need to run applications in WSL which must be run in and from my local network. Attempt to switch WSL virtual switch to external in Hyper-V manager leads to Access-denied error (when wsl instance is running) with following big problems with host's and/or WSL's network as a result until I reboot the host. When WSL distro is not running WSL virtual switch is invisible in Hyper-V manager (Virtual switch manager).
I have 2 question and will be very appreciated if someone could help me with that:
Is it a normal behavior - having got problem with network attempting to configure WSL virtual switch directly? As I recall there were no such problems with Hyper-V virtual machines - maybe just short losing of connectivity, not more.
Is there a way to configure WSL such way so it starts with WSL external switch any time I run it? Files .wslconfig and /etc/wsl.conf look to be useless for this - I haven't managed to find the solution in google.
Yes you can convert it to external from Hyper-v Manager. Just start the Hyper-v Manager as Administrator
It is indeed possible to get this configuration to work with IPV4. This is quite tricky, as you need to act on the Network configuration to set an IP address in the external network, and this requires systemd to be enabled.
Install WSL and Ubuntu distribution
First ensure that you have WSL2 installed, and install it if this is not the case
https://learn.microsoft.com/fr-fr/windows/wsl/install
WSL documentation:
https://learn.microsoft.com/en-us/windows/wsl/
It is key to have Ubuntu installed for WSL2, as the KDE installation is not compatible with WSL1.
wsl --install Ubuntu-20.04
It is important to have a recent version of WSL (1.0 as of this writing), as it allows you to use systemd.
Configure networking
By default, WSL installs with NAT and a dynamic IP which changes each time WSL is restarted.
There are also very limited options to access network services brought by WSL, as only TCP ports can be proxied with netsh, not UDP ports. This causes all sorts of issues with X, as it is using UDP ports, and I have been totally unable to make X windows desktops work, despite HOWTOs online claiming success.
If you need additional tools, now is the time to install them, as you are going to lose network connectivity for some time.
apt install net-tools
Change from internal to external network (Hyper-V manager)
You need to open Hyper-V manager and go to the virtual switch management. There is a WSL switch which by default is configured as “Internal network”. You need to change it to “External network”.
You also need to select which physical adapter you are going to connect to, Ethernet or Wifi.
At this point and until you finish network configuration, you no longer have any network connectivity.
Your virtual network card is now connected to the external network, but it is not configured, which we are going to do now by means of systemd.
Configure you virtual network card
From within WSL, edit file /etc/wsl.conf so that it contains:
[network]
generateResolvConf = false
[boot]
systemd=true
Create a file named /etc/systemd/network/26-fixed-ip.network containing (example):
[Match]
Name=eth0
[Network]
Address=192.168.1.60/24
Gateway=192.168.1.1
DNS=192.168.1.30
Select a fixed IP address in your external network range, and adapt the above parameters according to your case.
Configure DNS resolution
We have already instructed WSL not to generate resolv.conf each time it is started, as seen above.
It is now time to configure /etc/resolv.conf to contain:
nameserver 192.168.1.30
nameserver 192.168.1.5
domain xxxxxxxx.net
Check connectivity
Stop and start wsl (from a Windows cmd prompt):
wsl --shutdown
wsl
When wsl is restarted, it gets the fixed IP address, instead of a random one. You may ping any IP address and it works. You may also ping your ip address from another host on your LAN:
ping 192.168.1.60
Yes you can, but it seems to work only in IPv6 in my situation:
When I ran wsl --shutdown and opened Hyper-V Manager, the WSL switch appeared in Virtual Switch Manager, and can be successfully changed to external.
However, the IPv4 address could not be changed, and it's unable to access the Internet via IPv4 either. So I have to assign a NAT IPv6 network (fd68::/64 in my case) to make it work.
Maybe you should do some repair to your system if you can't reproduce this.
Note: if switch WSL is changed to external, your main adapter will become vEthernet (WSL) or something similar.
I've got an IBM-Server inside my Network (IP= 192.168.178.10, running on ESXI 5.5)<
Inside this host, I've got 3 VMs running (IPs = 192.168.178.97 - 192.168.178.99, Each Windows Server 2012)
Inside these VMs I've got XAMPP Apache Servers running.
My question is:
How do I make the XAMPP pages visible to the home network? Because every time I open the IPs inside my browser of my laptop (IP = 192.168.178.26), Chrome says that the Server is unavailable.
Strangely - If I type exactly same IP inside the browser of one VM, I can open the pages...
I can also access my Laptop XAMPP Server from inside the VM.
OK - I found the solution myself:
Apache seems to have opened the ports in the firewall, but somehow windows partly blocked the network communication - don't ask me how exactly, but I solved the problem by resetting the firewall, windows network settings and apache/xampp
I have started 2 virtual machines in my computer (using VirtualBox on Windows 8.1) in same time. On first i have Linux Debian with Apache http server. On second running Windows XP. Both networks are set as NAT.
Http request must have specific URL (for example: "xxx.local"). So when I try connect from my real computer to virtual machine with Linux server its easy and its work, there I add only redirect for domain "xxx.local" to virtual machine IP and everything working fine.
But I need send request and receive reply from second virtual machine with Windows XP.
Is there any way to do that?
You can add additional network adapters to both VMs attached to one host-only network.
Ok I got it. There is important to set "host only network adapter" for both virtual machines (but not the same one!) with same IP radius. Then you set IP of server machine to target domain in host file and that is all.
Works fine :-)
I run an ASP.NET Development Server (that came with MS Visual Studio 2010) on my Windows 7 machine. I'm currently developing an ASP.NET C# web application and to test it on Windows 7 machine I need to navigate my web browser to an address like this:
http://localhost:59215/Default.aspx
I also have the VMware Workstation 8 installed on that Windows 7 with other OS as virtual machines. I need to try to load my web app from those virtual machines, but when I type the above address there I get "Cannot display page" error in a browser. Note that I can access internet from a virtual machine itself, but for some reason localhost on the main machine is not accessible.
Any ideas how to set this up?
OK, I got it!
For those who're interested, here's how:
Say, my developement URL on the host computer is:
http://localhost:59215/Default.aspx
Download this util, called tcpTrace and run it on a host machine. When it starts configure it as follows:
Listen to port #: 80
Destination Server: localhost
Destination Port #: 59215 (which will be different in your case)
Click OK and let tcpTrace run on the host computer.
On the virtual machine navigate the browser to the IP address of the host computer, for instance in my case:
http://192.168.0.4/Default.aspx
and it will work!
PS. To get an IP address on the host machine, run ipconfig there (in a command prompt window). Your IP will be presented in the "IPv4 Address" line for network you're connected on.
PS2. Also my Windows 7 (host) doesn't come with any third-party anti-virus or firewall. It has a built-in Windows firewall and MS Security Essentials as an AVP. So if your setup is different one needs to open the incoming port 80.
PS3. Speaking of the VMWare Workstation, the virtual machine's network adapter setting is set on "NAT: Used to share the host's IP address" as it came out-of-box when you install it.
localhost is the local machine (to the OS).
I'm not sure if the VS dev server will allow external connections, you may want to install IIS - either way, you'll have to open up the Windows Firewall to allow external connections.
I'm no VMWare user but each OS will have its own IP address(?) - and that's how you'd connect to the Windows 7/IIS image. http://the.ip.address.of.the.win7.image/
I am using VMWare Player 3.1.0 on Host OS Windows 7 Professional 64-bit. My guest is is SUSE Linux ES 10. My guest OS (SUSE) runs JBoss App Server which I access from host using HTTP. I used a "Bridged" connection to set up all this.
My problem:
When I am connected to network on the Host (using wired network adapter) I can connect to the http server on the Guest OS and browse the application. However, when I am disconnected from the network on Host (unplugged the wire), I cannot access to the guest OS app server and browse the application. I use the guest OS ifconfig command to find out ip address of the guest OS. This ip address does not change whether connected or disconnected. I have even tried using Wireless Data card, but that does not work either.
I have tried "NAT" as well as "Host Only" connection and rebooted the guest but it does not work either. I think for some reason the guest OS can only recognize the physical network card (which is disconnected).
I need to run this machine (my laptop) independently of the network because I use this for demo and need to be able to connect from my host OS to Guest OS.
I am not sure I understand exactly what you are trying to do, but I do know setting up a working NAT configuration will offer you the most flexibility.
Click the networking icon and select settings, Select NAT.
Follow these steps on your Unix OS
cd /etc/sysconfig/network-scripts
Make a backup of your ethernet adapter configuration
cp ifcfg-eth0 ifcfg-eth0.bak
Next modify the settings to look like the following:
DEVICE="eth0"
BOOTPROTO="dhcp"
HWADDR="What ever was here on your system"br/>
NM_CONTROLLED="yes"
ONBOOT="yes"
Save your changes
Restart your network adapters
/etc/init.d/network restart
Try nslookup www.google.com
You should now be able to connect back and forth from your Windows Host and Linux guest.
theJay28
-p.s. I had screenshots, but I do not have the 10 points yet to post images.
I figured that the solution is to restart the VM after making the changes to the NetWork setting on the VMWare. I selected Network for the VM as "Host Only" shutdown the VM and started it again. After that I was able to do what I wanted to do (i.e. browse the web application on guest from the browser in the host machine) without connecting the host to the network.
So key to the solution in my case was to make the network changes and restart the VM.
Any comments suggestions welcome...