ssh port forwarding is ignored

Discussion in 'Parallels Provider for Vagrant' started by neywen1, Oct 14, 2021.

  1. neywen1

    neywen1 Bit poster

    Messages:
    2
    Hello there,
    I've been using vagrant for several years with VirtualBox, and I usually create a port forward for ssh service, which is convenient to do a lot of things, including accessing a VM from a remote machine. It still works without any problem today, with VirtualBox as a provider.
    Today I'm trying to use Parallels as a provider for vagrant, for the first time.
    And it seems the port forwarding for ssh is simply ignored.
    Code:
    config.vm.network "forwarded_port", guest: 22,   host: 2230, id: "ssh", auto_correct: false
    All the other forwarded ports are properly processed and are working.
    Even if I start the vagrant VM with a log level INFO, I still can not find any mention of the ssh port in the logs...
    My setup :
    - macBook Pro 2018, core i9, macOS 11.6
    - vagrant 2.2.18
    - Parallels 17.0.1
    - the guest OS : generic/debian11

    Does it ring a bell to anyone ?
    Thanks for any information,
    best,
    loïc.
     
  2. neywen1

    neywen1 Bit poster

    Messages:
    2
    I've sent a message to Parallels support to check this issue, no useful answer for now. Waiting for that to happen, I try and avoid what "seems to be a bug" :

    Code:
    $ prlsrvctl net list                                                                                   
    
    TCP rules:
        my-service-1 source port=8030 destination IP/VM id={[my GUID]} destination port=8888
        my-service-2 source port=5030 destination IP/VM id={[my GUID]} destination port=5020
        my-service-3 source port=3330 destination IP/VM id={[my GUID]} destination port=3306
        
    
    I see all my port forwardings, except the one for ssh.
    So, I try and add it manually:

    Code:
    prlsrvctl net set Shared --nat-tcp-add ssh,2230,[my GUID],22
    It seems ok :
    Code:
    $ prlsrvctl net list                                                                                   
    
    TCP rules:
        my-service-1 source port=8030 destination IP/VM id={[my GUID]} destination port=8888
        my-service-2 source port=5030 destination IP/VM id={[my GUID]} destination port=5020
        my-service-3 source port=3330 destination IP/VM id={[my GUID]} destination port=3306
        ssh source port=2230 destination IP/VM id={[my GUID]} destination port=22
    
        
    and then, using as usual :
    Code:
    $ ssh -p 2230 vagrant@localhost
    I'm able to connect to the VM. So at least I have a way to move forward, but I'm still interested in understanding what's going wrong in the automatic process. Again, event with vagrant --debug, there is no mention or error messages concerning the ssh port forwarding instruction.
     
  3. ChristophR6

    ChristophR6 Bit poster

    Messages:
    1
    I also have trouble with port forwarding.
    In my case it complains that every port is already in use by the host.

    Vagrant cannot forward the specified ports on this VM, since they would collide with some other application that is already listening
    on these ports. The forwarded port to 8081 is already in use on the host machine.


    But this is not correct. The ports are not used.
    If I try the same with --provider vmware_desktop or virtualbox, then it just works.
    Parallels seems to "think" that the port is in use, although it is not. Not sure how to debug this further.

    config.vm.provider "parallels" do |v|
    config.vm.box = "bento/ubuntu-18.04"
    config.vm.box_version = "202110.25.0"

    v.name = "vagrant_parallels"
    v.update_guest_tools = false
    v.memory = 6096
    v.cpus = 3
    end


    # Couchbase
    config.vm.network:)forwarded_port, guest: 8091, host: 8091)


    Support ticket is created. In case I hear something back, I will try to post here.
     

Share This Page