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?
Windows Subsystem for Linux (WSL) allows you run a Linux enviroment on Windows, using your favourite Linux distribution. You can even install multiple types of distributions side-by-side. However, there is no out-of-the-box way to install multiple instances of the same distribution.
WSL 2 has a virtualized ethernet adapter with its own unique IP address.
Set default Linux distro on WSL2Open Start on Windows 10. Search for Command Prompt, right-click the top result, and select the Run as administrator option. Quick tip: You can also write the command like this: wsl -l . In the command, replace DISTRO-NAME for the name of the distro to set it as default (see step No.
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:
+
) in it to add a new networkYou 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/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With