|
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.4 |
|
ip link add vxlan5 type vxlan id 5 dstport 4789 srcport 4789 4790 |
|
ip addr add 192.168.5.2/24 dev vxlan5 |
|
ip link set up vxlan5 |
|
bridge fdb add 00:00:00:00:00:00 dev vxlan5 dst 192.168.40.5 |
|
SHELL |
|
end |
|
|
|
config.vm.define :node3 do |node| |
|
node.vm.network :private_network, ip: "192.168.30.3", virtualbox__intnet: "L" |
|
node.vm.provision :shell, inline: <<-SHELL |
|
ip route add 192.168.40.0/24 via 192.168.30.4 |
|
ip link add vxlan5 type vxlan id 5 dstport 4789 srcport 4789 4790 |
|
ip addr add 192.168.5.3/24 dev vxlan5 |
|
ip link set up vxlan5 |
|
bridge fdb add 00:00:00:00:00:00 dev vxlan5 dst 192.168.40.5 |
|
SHELL |
|
end |
|
|
|
config.vm.define :node4 do |node| |
|
node.vm.network :private_network, ip: "192.168.30.4", virtualbox__intnet: "L" |
|
node.vm.network :private_network, ip: "192.168.40.4", 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 :node5 do |node| |
|
node.vm.network :private_network, ip: "192.168.40.5", virtualbox__intnet: "R" |
|
node.vm.provision :file, source: "vxlan_hp.py", destination: "vxlan_hp.py" |
|
node.vm.provision :file, source: "vxlan_hp.c", destination: "vxlan_hp.c" |
|
node.vm.provision :shell, inline: <<-SHELL |
|
echo "deb [trusted=yes] https://repo.iovisor.org/apt/xenial xenial-nightly main" > /etc/apt/sources.list.d/iovisor.list |
|
apt-get update -y |
|
apt-get install -y bcc-tools |
|
apt-get install -y linux-headers-`uname -r` python-setuptools |
|
easy_install pyroute2 |
|
ip link add vxlan5 type vxlan id 5 dstport 4789 srcport 4789 4790 |
|
ip addr add 192.168.5.5/24 dev vxlan5 |
|
ip link set up vxlan5 |
|
SHELL |
|
end |
|
end |
Small typo in vxlan_hp.c, ";" missing
replace BPF_HASH(host2nat, u64, struct peer4_t) // mac -> nat
by BPF_HASH(host2nat, u64, struct peer4_t); // mac -> nat