How to set up gateway of public network in vagrant

centos6, gateway, networking, vagrant, virtualbox

Solution

According to the (new) documentation, setting up a gateway, can be done by instructing the following, inside the Vagrantfile:

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

Read the complete example titled Default Router at http://docs.vagrantup.com/v2/networking/public_network.html.

Problem

I am setting up my Virtualbox Centos VM with vagrant. I am setting up with a public network. ``` config.vm.network :public_network, ip: "10.135.15.137" ``` How do I setup the GATEWAY along with this?

Original source