Page MenuHomePhabricator
Paste P8697

ICMP redirection issue
ActivePublic

Authored by akosiaris on Jul 2 2019, 10:08 AM.
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure("2") do |config|
config.vm.box = "debian/contrib-stretch64"
config.vm.box_check_update = false
config.vm.provision "shell" do |s|
s.inline = "apt update && apt upgrade -y && apt install -y iproute2 iptables tcpdump"
end
config.vm.define "client1" do |c1|
c1.vm.hostname = "client1"
c1.vm.network "private_network", ip: "192.168.10.3", virtualbox_intnet: "c1-r1-r2"
c1.vm.provision "shell" do |s|
s.inline = "ip route add 192.168.11.0/24 via 192.168.10.2 || /bin/true"
end
end
config.vm.define "router1" do |r1|
r1.vm.hostname = "router1"
r1.vm.network "private_network", ip: "192.168.10.1", virtualbox_intnet: "c1-r1-r2"
r1.vm.network "private_network", ip: "192.168.11.1", virtualbox_intnet: "r1-d1"
r1.vm.provision "shell" do |s|
s.inline = "sysctl -w net.ipv4.ip_forward=1"
end
end
config.vm.define "router2" do |r2|
r2.vm.hostname = "router2"
r2.vm.network "private_network", ip: "192.168.10.2", virtualbox_intnet: "c1-r1-r2"
r2.vm.provision "shell" do |s|
s.inline = "sysctl -w net.ipv4.ip_forward=1 && ip route add 192.168.11.0/24 via 192.168.10.1 ; iptables -t nat -A PREROUTING -p tcp --dport 2048 -j DNAT --to-destination 192.168.11.2:2048 || /bin/true"
end
end
config.vm.define "dest1" do |d1|
d1.vm.hostname = "dest1"
d1.vm.network "private_network", ip: "192.168.11.2", virtualbox_intnet: "r1-d1"
d1.vm.provision "shell" do |s|
s.inline = "ip route add 192.168.10.0/24 via 192.168.11.1 || /bin/true"
end
end
end

Event Timeline

akosiaris created this paste.Jul 2 2019, 10:08 AM