Sunday, August 7, 2011

VirtualBox VBoxManage


In NAT mode, the guest network interface is assigned to the IPv4 range 10.0.x.0/24 by default where x corresponds to the instance of the NAT interface +2. So x is 2 when there is only one NAT instance active. In that case the guest is assigned to the address 10.0.2.15, the gateway is set to 10.0.2.2 and the name server can be found at 10.0.2.3.

If, for any reason, the NAT network needs to be changed, this can be achieved with the following command:

VBoxManage modifyvm "VM name" --natnet1 "192.168.61/24"

This command would reserve the network addresses from 192.168.61.0 to 192.168.61.254 for the first NAT network instance of "VM name". The guest IP would be assigned to 192.168.61.15 and the default gateway could be found at 192.168.61.2.





VBoxManage startvm "New Saratele"

Waiting for the VM to power on...
VM has been successfully started.


Port forwarding with NAT



As the virtual machine is connected to a private network internal to VirtualBox and invisible to the host, network services on the guest are not accessible to the host machine or to other computers on the same network. However, like a physical router, VirtualBox can make selected services available to the world outside the guest through port forwarding. This means that VirtualBox listens to certain ports on the host and resends all packets which arrive there to the guest, on the same or a different port.


Network Interface in Virtual Machine ( Windows Server 2008 - guest ) has IP = 192.168.61.15
Network Interface on the HOST Machine has IP = 192.168.101.22 
ping from guest to host is OK , but from host to guest KO ... 












From Linux : to acces  port 80 ( IIS service ) on the Windows Server 2008  guest : 
1.  VBoxManage modifyvm "New Saratele" --natpf1 "guest_iis,tcp,192.168.101.22,8000,192.168.61.15,80"


2. From host Browser : 
http://192.168.101.22:8000






Network & sharing in VirtualBox - Full tutorial


VBoxManage modifyvm




No comments:

Post a Comment