i'm trying to create a virtual testing environment. for purpose of testing, i'm going to send udp packets to application running inside the virtual machine. i want to control source ip of the packet when it is received by the application.
i tried different vagrant configurations:
config.vm.network "forwarded_port", guest: 1111, host: 11111, adapter: 2
or
config.vm.network "forwarded_port", guest: 1111, host: 11111, host_ip: "x.x.x.x"
but no success.
it seems to me that this can not be solved by Vagrant alone. unfortunately, i'm completely unfamiliar with iptables/route.
let me explain the problem in greater detail: ideal scenario is to be able to send this from within virtual environment itself - application is listening on some port P. then test script sends data to host1:port1 and it comes through one interface and application sees it's source ip as 1.1.1.1, and when script sends packets to host2:port2, application sees it as though it's coming from 2.2.2.2.
keeping it inside virtual environment is good because i can use just the image across QA local machines and build servers, as it will contain everything.
if this configuration is not possible (though i don't see why), configuring virtual box to have 2 (or more) ports forwarded via different interfaces, so that sending packets to them results in different source addresses.