How to route packets from a windows VM, through a linux VM, to another windows VM?
Hi there,
This is my first time posting, so I apologize if I break any rules. I'm trying to simulate a WAN using netem and Openstack VMs only. The plan is to route traffic between 2 windows machines through an Ubuntu box with netem installed so I can add delay, packet-loss, etc.
I spun up 2 windows instances and 1 Ubuntu instance on Openstack, all connected to the same network.
- Windows PC #1: 10.40.243.36,
- Windows PC #2: 10.40.243.37,
- Ubuntu box: 10.40.243.41
on Windows PC #1, I ran:
route add 10.40.234.37 mask 255.255.255.255 10.40.243.41
on Windows PC #2, I ran:
route add 10.40.234.36 mask 255.255.255.255 10.40.243.41
on the Ubuntu Box, I changed the following:
echo 1 > /proc/sys/net/ipv4/ip_forward
When I tracert PC2 from PC1, the first hop makes it to the Ubuntu Box, but after that, the requests keep timing out. It seems that the Ubuntu Box is unable to route the packets to PC2. Is this type of configuration allowed in Openstack?
Edit: On the Ubuntu Box, I turned
net.ipv4.conf.default.rp_filter=0
and
net.ipv4.conf.all.rp_filter=0
I also added a masquerade rule to the postrouting chain:
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
Now if I do a tcpdump on the Ubuntu Box, I see the following:
19:10:57.994991 IP 10.40.243.36 > 10.40.243.37: ICMP echo request, id 1, seq 77, length 40
19:10:57.995036 IP 10.40.243.41 > 10.40.243.37: ICMP echo request, id 1, seq 77, length 40
19:10:57.995716 IP 10.40.243.37 > 10.40.243.41: ICMP echo reply, id 1, seq 77, length 40
19:10:57.995745 IP 10.40.243.37 > 10.40.243.36: ICMP echo reply, id 1, seq 77, length 40
but my ping on Windows PC#1 still shows
Pinging 10.40.243.37 with 32 bytes of data:
Request timed out.
Ping statistics for 10.40.243.37:
Packets: Sent = 1, Received = 0, Lost = 1 (100% loss)
So it looks like a reply is being sent back to PC#1, but it doesn't actually arrive.
Please, any help would be greatly appreciated!
Thanks!
Did you find a way to do this? Im looking to do the same thing.