Skip to content

Configuración de enrutamiento de puertos entre WSL y una VM Hyper-V.

License

Notifications You must be signed in to change notification settings

AdalZanabria/WSL-Forwarding

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 

Repository files navigation

 _ _ _ _____ __       _____                         _ _         
| | | |   __|  |     |   __|___ ___ _ _ _ ___ ___ _| |_|___ ___ 
| | | |__   |  |__   |   __| . |  _| | | | .'|  _| . | |   | . |
|_____|_____|_____|  |__|  |___|_| |_____|__,|_| |___|_|_|_|_  |
                                                           |___|

Ejemplo de WSL Forwarding

Español:

Descripción:

WSL Forwarding es un script para realizar la configuración de enrutamiento de puertos entre una instancia de WSL con una máquina virtual de Hyper-V. Esto es útil para situaciones en que se requiere acceder por medio de SSH o SFTP a una máquina virtual ejecutándose en Hyper-V desde una distribución de GNU/Linux corriendo en WSL.

Instalación:

  1. Clona o descarga este repositorio en tu equipo host Windows (No dentro de Hyper-V o WSL).
  2. Ejecuta el archivo WSL-Forwarding.ps1 desde una ventana de Powershell corriendo como administrador.
    1. Si se tiene establecido Powershell como programa por defecto para ejecutar archivos con extensión .ps1, solo es necesario dar doble-clic al archivo y éste pedirá permisos de administrador antes de ejecutarse.
    2. Si no se tiene establecido Powershell como programa por defecto para ejecutar archivos con extensión .ps1, será necesario abrir como administrador una ventana de Powershell y navegar hasta el directorio que contenga el archivo descargado y ejecutarlo con ./WSL-Forwarding.ps1.

Preguntas:

  • ¿Porqué requiere de permisos de administrador el script?
    • El script hace uso del cmlet Set-NetIPInterface, el cual requiere permisos de administrador para funcionar.
  • ¿No es peligroso ejecutar scripts de Powershell como administrador?
    • Si lo es, y por eso te invito a revisar el código del repositorio antes de descargarlo y ejecutarlo para que estes tranquilo de que no contiene ningún código malicioso.
  • ¿Funciona para conectar WSL con otro hipervisor como VirtualBox o VMware?
    • WSL requiere del hipervisor de Microsoft Hyper-V, y generalmente no es posible usar mas de un hipervisor al mismo tiempo.
  • Reinicié la máquina virtual/maquina host y otra vez no puedo acceder a ella desde WSL
    • Al ser una máquina virtual el DHCP puede cambiar su IP o la configuración de puertos se puede reestablecer al reiniciar tu equipo host, es necesario volver a ejecutar el script. Se recomienda ejecutar el script cada vez que se vaya a conectar a una máquina virtual Hyper-V desde WSL.

English:

Description:

WSL Forwarding is a script to configure port forwarding between an instance of WSL with a Hyper-V virtual machine. This is useful in situations where you require to access a Hyper-V virtual machine via SSH or SFTP from a GNU/Linux distribution running on WSL.

Instalation:

  1. Clone or download this repository in your Windows host (Not in Hyper-V or WSL).
  2. Execute the file WSL-Forwarding.ps1 from Powershell running as administrator.
    1. If you have set Powershell as the default program to execute .ps1 files, you only need to double-click the file and it will ask to execute as administrator.
    2. If you don't have set Powershell as the default program to execute .ps1 files, you need open as administrator a Powershell window and navigate to the directory where you downloaded the files and run it with ./WSL-Forwarding.ps1.

Questions:

  • Why does this script needs to run as administrator?
    • The script uses the Set-NetIPInterface cmlet, which requires to be run as administrator to be able to work.
  • Isn't it dangerous to run Powershell scripts as administrator?
    • Yes it is, and for that I invite you to check the source code in the repository before downloading and executing it so you can be sure that it doesn't contain any malicious code.
  • Does this work to connect WSL with another hypervisor such as VirtualBox or VMware?
    • WSL requires the Microsoft Hyper-V hypervisor, and generally it is not possible to run more than one hypervisor at a time.
  • I restarted my virtual machine/host machine and I can't access it again from WSL
    • The DHCP can change the IP of the virtual machine, and the port configuration can be reset after restarting your host computer, you need to run the script again. It is adviced to run the script everytime you'll need to connect to a Hyper-V virtual machine from WSL.

About

Configuración de enrutamiento de puertos entre WSL y una VM Hyper-V.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published