Access Vagrant Box in Public Network

352 views
Skip to first unread message

Evanilson Abril

unread,
Feb 26, 2016, 8:32:59 PM2/26/16
to Vagrant
  
      Hello, 

          I have being struggling with this problem for 3 days now and I Can figure out the solution, please help me!!

          I want to setup a development environment for my company using vagrant. Each developer has an machine on the LAN network but I want to be able to make these machines available on the public network, what I mean by that is be able to ping these machines from a different network (for example ping this machines from another country). 

          I used the setup on the vagrantup.com documents but its not working, I am using the following setup 

          
 config.vm.network "public_network", ip: "192.168.0.17"
  # default router
  config.vm.provision "shell",
    run: "always",
    inline: "route add default gw 192.168.0.1"

  # default router ipv6
  config.vm.provision "shell",
    run: "always",
    inline: "route -A inet6 add default gw fc00::1 eth1"

  # delete default gw on eth0
  config.vm.provision "shell",
    run: "always"
    inline: "eval `route -n | awk '{ if ($8 ==\"eth0\" && $2 != \"0.0.0.0\") print \"route del default gw \" $2; }'`" 

But I am not able to access this machine. By the way I am able to access them from the host machine, but not from a different network 
Please can someone help me ?


Alvaro Miranda Aguilera

unread,
Feb 26, 2016, 8:48:44 PM2/26/16
to vagra...@googlegroups.com
Hello

Can you share the following please:

- Vagrantfile you are using
- Lan ip segment, ie 192.168.10.x
- It does dhcp or will be using fixed ip
- Whats the gateway there, if you don't now, can you see on your host computer
- How you will know what VM have what ip? how you will know how to connect to the one you want to connect?

With that, I can help you :)

Alvaro.


--
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/e9cead21-d77d-41d0-ad50-679682324851%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Evanilson Abril

unread,
Feb 26, 2016, 9:15:13 PM2/26/16
to Vagrant


Thank you for Replying Mr. Alvaro,

      I attached my VagrantFile and I am working on hp proliant dl360 g5 server and the ip address on this server is 68.180.x.x but on my mac the Lan IP is 192.168.2.4
      I am using dhcp 
      When I ping my server 68.180.x.x it respondes with no problem but when I assigned an ip for the vagrant box via dhcp it does not respond the ping from outside, it just responds the pings from the host machine (which is my server on 68.180.x.x)

     Please Mr. Alvaro help m, I am going crazy with this problem. I also tried to replace the nat interface using a bridge network but vagrant is not accepting.
Vagrantfile.txt

Trevor Roberts Jr

unread,
Feb 27, 2016, 10:00:41 AM2/27/16
to Vagrant
Evanilson, is your 68.x.x.x server able to ping your desktop?

Can you provide the following?
1. IP address, subnet mask, default gateway of your desktop machine that is running vagrant

2. IP address, subnet mask, default gateway of your Vagrant VM when it gets a DHCP address from public_network. NOT from when you set it to static.

Alvaro Miranda Aguilera

unread,
Feb 28, 2016, 12:22:26 AM2/28/16
to vagra...@googlegroups.com
Hi There,

We did work this off list, and found the GW was incorrect, so basically we did the same check :)

Alvaro.

--
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.
Reply all
Reply to author
Forward
0 new messages