If you are someone who has been using VirtualBox version 5.2.2 or higher versions. Then there is a chance that you might have noticed that when you fire up two VMs irrespective of their architecture, have the same IP address. Let it be Windows, Linux or Mac OS.
And in case you are into networking or hacking, this is one problem which you are going to face while trying to communicate or launching an attack from one VM to the other VMs.
Now, in this particular post, a solution to the problem has been provided using which you can assign two different IP address to virtual machines in VirtualBox. So please keep reading the full post to know how to fix this issue.
If you are into software development, networking, hacking, testing or any other field that requires testing, running experiments on different O.S. Then it’s better to run the OS virtually instead of running the experiments on your primary machine.
The reason being, running such experiments (especially launching attacks) on your primary machine may disrupt your primary machine hardware.
Then VirtualBox from Oracle is free virtualization software that lets you do precisely do that, without any hassle.
Moreover, based on your requirement you can run different OS VMs like Windows, Mac OS, Linux, etc. Apart from providing virtual storage, VirtualBox also provides virtual network and also actual network and devices access of your primary input devices.
How to assign different IP address to virtual machines in VirtualBox: –
The fix that has been provided in the below step will work on all platform whether its MAC, Linux or Windows.
Before getting started, the first thing you need to do is make sure that your primary machine has internet access.
- In your primary machine launch the terminal, or command prompt and type ‘ifconfig’ or ‘ipconfig’, copy the IPv4 address and close the terminal window.
- Now start the virtual machine from VirtualBox, but make sure that your virtual machine is attached to ‘Nat Network.’
- Once the VM loads up, launch the terminal or command prompt and type ‘arp -a’ to find out the gateway IP. Next go to settings to configure the network setting, for Windows, VM go to ‘Control Panel’ > ‘Network and Internet’ > ‘Network Connections’.Right-click on the desired adapter and click on ‘Properties’. Then double-click on ‘Internet Protocol Version 4’ > and then click on the second radio button stating the ‘Use the following IP address’ > enter an IP address that falls in the range of the default gateway > in the subnet mask section enter ‘255.255.255.0’.
In the default gateway section enter the default gateway IP. Last but not the least in the ‘Preferred DNS Server’ section enter the IPv4 address of your primary machine. Next click on the ‘ok’ button to set the current setting.
- In case you are using a Linux VM (Ubuntu, Kali, Fedora), go the upper right corner of the screen and click on the drop-down arrow > ‘Settings’> ‘Network’ > click on ‘Wired settings’. Next click on the ‘IPv4’ tab and then click on the ‘Manual’ radio button, and under the ‘Addresses’ section enter the IP address, followed by the Netmask and Default gateway. Once your done click on ’Apply’ to save the setting.
So that’s how you can assign two different IPs to virtual machines. The same method of manual configuring the IP address can also be implied on MAC virtual machines.
Now, you can not only communicate with the other VMs in the virtual network, but you can also access the internet from your VM without facing any issues or difficulties.
Also read: How to permanently delete files from your Windows PC
Hope you found this post informative and helpful, if you really liked reading it then please do share this post via social media accounts.
Anyway, if you have got any kind of queries reading assigning of IP address to VM, then please do mention it in the comment section below.