Hello, The GW on each network is well known for the network admin people, but not for scripts or end users
there is no a rule to follow, you need to have it as information. If you add a bridged interface with dhcp, and there is dhcp on that network, the dhcp server will give you the correct one. On Sat, Apr 25, 2015 at 4:33 AM, Narada Hess <[email protected]> wrote: > So that leads to my next question. Is there a way from the VM to determine > the default gateway on the host? That is the route I need to add. It would > be nice to automate it in the provisioning script. traceroute does not show > it, and that seems like a hack anyways. > > Or maybe there is a vboxmanage command I could use? > > Cannot hard-code it since I am not sure of which subnet the VM would be > deployed on. Thanks. > > > On Thursday, April 23, 2015 at 7:35:54 AM UTC-7, Narada Hess wrote: >> >> If I create a VM using bridged networking from virtualbox directly, the VM >> IP address assigned is on the same subnet as my host and the VM can be >> pinged from any other host on the subnet. Good. ifconfig shows an IP >> address on eth0 within the normal external subnet range. There is no eth1. >> >> But if I create the VM from vagrant, I cannot ping the VM from other >> hosts. ifconfig now shows two adapters. eth0 has a 10.0.2.x address that >> does not match my actual subnet, and the route command shows 10.0.2.2 as the >> default gateway. eth1 now shows up, with an address that looks like a >> correctly allocated address from the real DHCP server. But pinging its >> address form an external host does not work. >> >> I have this command in Vagrantfile: >> config.vm.network "public_network", bridge: 'eth0', type: "dhcp" >> I have also tried: >> config.vm.network "public_network" >> and >> config.vm.network "public_network", bridge: 'eth0' >> >> I am using Ubuntu 14.04 and latest versions of vagrant (1.7.2) and >> virtualbox (4.3.26). I suspect the 10.0.2.x DHCP address is being generated >> locally (within my host) and thus is not registered with the real DHCP >> server (and is thus not being routed). >> >> Thanks to anyone who can help me with this. >> > -- > 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 [email protected]. > For more options, visit https://groups.google.com/d/optout. -- 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 [email protected]. For more options, visit https://groups.google.com/d/optout.
