I am trying to set up a VM in VirtualBox on Linux (Fedora 22). Its network must have the following properties:
- IP address is 192.168.1.2/24
- Default gateway is 192.168.1.1
- No DHCP
- Network connectivity to the outside world
It is not a requirement that other systems on my network be able to connect to the VM. The VirtualBox console will suffice for the time being.
I first tried the "NAT" driver, but I can't figure out how to make it use 192.168.1.1 as its default gateway. I have it serving DHCP addresses in 192.168.1.0/24, but it's insisting on using 192.168.1.2 as its gateway. I also tried using the "NAT Network" driver, using the network range 192.168.1.0/24 and DHCP disabled (as described at https://virtualbox.org/manual/ch06.html#network_nat_service); after manually setting the network address and default route in my VM, I get no upstream connectivity and I can't even ARP 192.168.1.1. If I use "NAT Network" with DHCP enabled, it again uses 192.168.1.2 as the default gateway, and I still don't get upstream connectivity. The "Bridged Adapter" driver isn't appropriate because the VM is hosted on a machine that uses a different network range (172.16.1.0/24).
At the moment, the OS inside the VM is a Gentoo installation CD image. The eventual purpose of this VM is to be a test environment for a production device; hence, it must use the same network configuration as the real device.
Any suggestions on how to get this working?
Edit: It seems that VirtualBox can't do this, at least without jumping through a lot of hoops like making changes to the host's network setup or adding a second VM to act as default gateway for the first. I guess I'll have to try some other VM manager.