Skip to content

Instantly share code, notes, and snippets.

@hkwi
Last active January 24, 2017 07:15
Show Gist options
  • Save hkwi/607d899f5a5edc8526b6bf3f691979d8 to your computer and use it in GitHub Desktop.
Save hkwi/607d899f5a5edc8526b6bf3f691979d8 to your computer and use it in GitHub Desktop.
Simple routing
Vagrant.configure(2) do |config|
config.vm.box = "minimal/xenial64"
config.vm.synced_folder ".", "/vagrant", disabled: true
config.vm.define :nodeL do |node|
node.vm.network :private_network, ip: "192.168.30.2", virtualbox__intnet: "L"
node.vm.provision :shell, inline: <<-SHELL
ip route replace default via 192.168.30.3
SHELL
end
config.vm.define :nodeR do |node|
node.vm.network :private_network, ip: "192.168.40.2", virtualbox__intnet: "R"
node.vm.provision :shell, inline: <<-SHELL
ip route replace default via 192.168.40.3
SHELL
end
config.vm.define :nodeX do |node|
node.vm.network :private_network, ip: "192.168.30.3", virtualbox__intnet: "L"
node.vm.network :private_network, ip: "192.168.40.3", virtualbox__intnet: "R"
node.vm.provision :shell, inline: <<-SHELL
sysctl net.ipv4.ip_forward=1
SHELL
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment