Vagrant not forwarding ports on to host

16 views
Skip to first unread message

Zac Harvey

unread,
Jun 13, 2019, 4:09:51 PM6/13/19
to Vagrant
I have the following Vagrantfile:

    Vagrant.configure("2") do |config|
      config.vm.box = "bento/ubuntu-18.04"
      config.vm.network "forwarded_port", guest: 4200, host: 4200
    end

That is, super simple Ubuntu 18.04 and I will be running a web service on it that uses port 4200. I want to be able to go to http://localhost:4200 on a browser on my host machine and hit this service running inside the Vagrant box.

So I run vagrant up && vagrant ssh and I start the service, and I absolutely see it running. I can curl http://127.0.0.1:4200 and get HTML output back in the response right there inside the VM.

But, back on my host, if I point my browser to http://localhost:4200 I get a "The site can't be reached" error. Is there anything in my Vagrantfile that would prevent port 4200 on the vagrant machine from forwarding to port 4200 on my host?

Thanks!

Alvaro Miranda Aguilera

unread,
Jun 17, 2019, 1:50:34 PM6/17/19
to vagra...@googlegroups.com
hello

whats the output of

netstat -anp | grep 4200 

in the guest vm ?



--
This mailing list is governed under the HashiCorp Community Guidelines - https://www.hashicorp.com/community-guidelines.html. Behavior in violation of those guidelines may result in your removal from this mailing list.
 
GitHub Issues: https://github.com/mitchellh/vagrant/issues
IRC: #vagrant on Freenode
---
You received this message because you are subscribed to the Google Groups "Vagrant" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vagrant-up+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vagrant-up/6949a747-6e77-4ad4-8d69-885834f464f7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


--
Alvaro

Reply all
Reply to author
Forward
0 new messages