-
-
Save legale/bc95bc492603ffb22aceb766b7dfdb4f to your computer and use it in GitHub Desktop.
Linux vxlan nat traversal example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Vagrant.configure(2) do |config| | |
| config.vm.box = "minimal/xenial64" | |
| config.vm.synced_folder ".", "/vagrant", disabled: true | |
| config.vm.define :node2 do |node| | |
| node.vm.network :private_network, ip: "192.168.30.2", virtualbox__intnet: "L" | |
| node.vm.provision :shell, inline: <<-SHELL | |
| ip route add 192.168.40.0/24 via 192.168.30.3 | |
| SHELL | |
| end | |
| config.vm.define :node3 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 | |
| apt-get install -y iptables | |
| iptables -t nat -A POSTROUTING -s 192.168.30.0/24 -j MASQUERADE | |
| sysctl net.ipv4.ip_forward=1 | |
| SHELL | |
| end | |
| config.vm.define :node4 do |node| | |
| node.vm.network :private_network, ip: "192.168.40.4", virtualbox__intnet: "R" | |
| node.vm.provision :shell, inline: <<-SHELL | |
| SHELL | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment