NAT mode will not let you do that. In this mode:
The "router", in this case, is the VirtualBox networking engine,
which maps traffic from and to the virtual machine transparently. In
VirtualBox this router is placed between each virtual machine and the
host. This separation maximizes security since by default virtual
machines cannot talk to each other.
Note there's an isolation between each virtual machine, so they will be unable to connect to each other.
What you need is to configure your virtual machines (go to settings, network, look at the network modes) to use either internal networking or host-only networking.
Internal networking will allow virtual machines to communicate only with other virtual machines. Host-only networking will also allow VMs to communicate with the host system.
Read here about what each mode does and how to configure them:
- configure both your virtual machines' networks to be "Internal network". Select "eth0" for "attached to" (this means the VM's network interface that will be connected to this network) and select the same "name" for the network (think of each name as a "hub" to which virtual machines are connected). The default of intnet is fine.
- Boot your VMS, and manually assign IP addresses. I tried with 10.0.0.1 for one and 10.0.0.2 for the other.
- You should be able to ping 10.0.0.1 from 10.0.0.2. It works for me!