0

I'm trying to set up a really simple network topology, including two Ubuntu 16.04 as two hosts as follow:

VM1 <--> VM2

Both VMs are connecting to the VirtualBox host-only network with static IP address (10.0.0.1 and 10.0.0.2). The task here is that VM2 sends VM1 a packet with spoofed IP address (e.g., 10.0.0.3) and gets the returning packet. Sending a spoofed packet is easy, but I don't know how to get the returning packet because it will be sent to the spoofed address.

I'm thinking of having another VM acting as the router in the middle:

VM1 <--> Router <--> VM2

but not sure how to reroute all the outgoing traffic from VM1 to VM2?

Will appreciate any hint, including for the original problem because I stuck for few days and surprisingly there is no related question.

1
  • In common VMs will not use router until their addresses are in the same subnet. You can try to force your router to act as a bridge (which connects 2 segments of the same subnet) and add to each VM a route to another VM via Router's interface... but I'm not sure it will work on single virtual router.
    – Akina
    Oct 22, 2018 at 11:06

1 Answer 1

0

What you are doing violates networking convetions as I am sure you know. In order to get the desired behavior you need to do more spoofing. The problem is likely in Address Resolution Protocol (ARP). You have IP addresses and you have MAC addresses, and ARP translates between the two. More details in defalt's answer here. You need to spoof the ARP response to "who has 10.0.0.3" so that 2 thinks 1's MAC is 3's MAC. Then you will receive the packet at 1. I have not checked, but what happens if you configure 2 IP addresses on 1's interface? That may be the easiest way.

1
  • Yes, that seems to be the answer to this problem.
    – Muoi Tran
    Oct 23, 2018 at 0:10

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .