Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Documention on Forwarding Ports is invalid #58

Open
darkn3rd opened this issue May 10, 2024 · 5 comments
Open

Documention on Forwarding Ports is invalid #58

darkn3rd opened this issue May 10, 2024 · 5 comments

Comments

@darkn3rd
Copy link

The current documentation (README.md) indicates that this functionality currently works, but with Macbook M1 (ARM64) with hvf, this is not working:

config.vm.network "forwarded_port", guest: 80, host: 8080

Please document exactly where this will work and where it does not. If it doesn't work for any solution, including q35 emulators, then maybe document that it doesn't work? Also, if there is a workaround through the qemu tool, then could this workaround be documented?

@ppggff
Copy link
Owner

ppggff commented May 11, 2024

It works, and I tested with a simple box:

Vagrantfile:

Vagrant.configure("2") do |config|
  config.vm.box = "ppggff/centos-7-aarch64-2009-4K"
  config.vm.network "forwarded_port", guest: 80, host: 8080
end

Port works as following pic:
Screenshot 2024-05-11 at 18 27 39

@darkn3rd
Copy link
Author

I am running into problems with blocked ports and SMB. I am not sure how/why SMB is turned on by default.

cat << EOF > Vagrantfile
Vagrant.configure("2") do |config|
  config.vm.box = "ppggff/centos-7-aarch64-2009-4K"
  config.vm.network "forwarded_port", guest: 80, host: 8080
end
EOF

vagrant up --provider=qemu

I also get an issue that port 8080 is already used when I use --debug. But sudo lsof -nP -i4TCP:8080 shows nothing. So I changed the host port to 8081, and re-ran vagrant up --provider=qemu, which yields:

==> default: Preparing SMB shared folders...
    default: You will be asked for the username and password to use for the SMB
    default: folders shortly. Please use the proper username/password of your
    default: account.
    default:
    default: Username (user[@domain]):

@darkn3rd
Copy link
Author

This seems to work using an alternative image. The the other issues with issue #40 have to deal with private networks and/or multi-machine? I have then some confusion between where this won't work, especially given the message (https://github.com/ppggff/vagrant-qemu/blob/master/locales/en.yml#L18-L21) that is splashed on vagrant up.

  1. Vagrantfile
    Vagrant.configure("2") do |config|
      config.vm.box = "perk/ubuntu-2204-arm64"
      config.vm.network "forwarded_port", guest: 80, host: 8082
      config.vm.provider "qemu" do |qe|
        qe.ssh_port = "50022" # change ssh port as needed
      end
    end
  2. On Guest: sudo python3 -m http.server 80
  3. On Host: curl -is localhost:8082 | head -5 works:
    HTTP/1.0 200 OK
    Server: SimpleHTTP/0.6 Python/3.10.12
    Date: Sun, 12 May 2024 01:11:20 GMT
    Content-type: text/html; charset=utf-8
    Content-Length: 626
    

@darkn3rd
Copy link
Author

darkn3rd commented May 19, 2024

If there are scenarios where this should not be expected to work, it would be great to document that. If these are always expected to work, then maybe remove or modify the warning, as the setting was not ignored:

 Warning! The QEMU provider doesn't support any of the Vagrant
 high-level network configurations (`config.vm.network`). They
 will be silently ignored.

@ppggff
Copy link
Owner

ppggff commented May 20, 2024

The warning comes from vagrant, I will investigate how to remove it or change it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants