VirtualBox Port Forwarding on Windows 7 not Working

后端 未结 3 1264
时光说笑
时光说笑 2021-02-15 11:33

VirtualBox Port Forwarding on Windows 7 not Working

Im trying to ssh onto my VirtualBox from my Windows 7 host via port forwarding, but VirtualBox wont open the port for

相关标签:
3条回答
  • 2021-02-15 12:10

    I used this article to ssh into my Raspberry pi3 VM.

    Using this command ssh -p 2222 pi@localhost.

    Originally, I had kept trying to use ssh pi@10.0.2.x -p 2222, but it didn't work and kept returning a "Connection timed out." My port number is 2222, but yours could be different depending what you set in your VirtualBox.

    I am using a Windows 10 into a Debian Raspberry Pi VM (VirtualBox).

    0 讨论(0)
  • 2021-02-15 12:20

    I found the solution in a hypernode-vagrant issue: VirtualBox fails to establish the port forwarding for SSH on Vagrant's standard port 2222, but higher ports work. In that issue, ports >= 4000 worked, whereas ports <= 3500 would fail. On my machine running Windows 10, I found 2380 to be the first port for which the TCP redirect can be established.

    The port on the host used for forwarding can be changed by adding the following lines to your Vagrantfile (where you may have to replace 4000 by a higher number):

    config.vm.network :forwarded_port, guest: 22, host: 2222, disabled: true
    config.vm.network :forwarded_port, guest: 22, host: 4000, id: "ssh"
    

    I have no idea what the root cause for this behavior could look like, but the workaround has been working reliably so far.

    0 讨论(0)
  • 2021-02-15 12:26

    Did you set forwarding in machine settings ?

    1. To forward ports in VirtualBox, first open a virtual machine’s settings window by selecting the Settings option in the menu.

    2. Select the Network pane in the virtual machine’s configuration window, expand the Advanced section, and click the Port Forwarding button. Note that this button is only active if you’re using a NAT network type – you only need to forward ports if you’re using a NAT.

    3. Use VirtualBox’s Port Forwarding Rules window to forward ports. You don’t have to specify any IP addresses – those two fields are optional.

    Also here: http://www.howtogeek.com/122641/how-to-forward-ports-to-a-virtual-machine-and-use-it-as-a-server/

    0 讨论(0)
提交回复
热议问题