Hello, Please bear in mind this is a workaround for this particular request.
Looking at the script I think even if there is no eth1 with ip, the ping should be valid since would be reach by the nat eth0 interface. give it a go, and let me know if works as expected. in case of issues, the final form of script should check eth1 ip exists and ping this new gw. but as is, for this vm should work fine. :) Alvaro On Sat, Sep 27, 2014 at 7:56 AM, <[email protected]> wrote: > That does the trick. Thanks Alvaro. I have seen you in this group > answering other's questions patiently too. You have been a great help. Good > to have you in the group. > > Here's what I ended up doing to my Vagrantfile. The route setting starts > to work after the second boot after provisioning. > > VAGRANTFILE_API_VERSION = "2" > > $update_rc_local = <<UPDATERCLOCAL > cat << EOFRCLOCAL > /etc/rc.local > #!/bin/sh -e > # > # rc.local > # > # By default this script does nothing. > echo "in rc.local" > ping -c4 10.1.10.1 > if [ $? -eq 0 ]; then > route add default gw 10.1.10.1 > route del default gw 10.0.2.2 > else > echo "Couldn't ping gateway 10.1.10.1... skipping" > fi > > exit 0 > EOFRCLOCAL > > Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| > config.vm.box = "ubuntu/trusty64" > config.vm.network "public_network", ip: "10.1.10.36", bridge: 'en1: > Ethernet Adaptor (en1)' > config.vm.provision "shell", inline: $update_rc_local > > ~S > > -- > 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.
