Loading ...

How to assign static ip in virtual machine in VirtualBox | Debugging Code

How to assign static ip in virtual machine in VirtualBox

Avg: 0 / 5 (0votes)

To assign static ip address on your VirtualBox VM instance, you’ll first need to setup a Host-Only network in VirtualBox Network Settings, add a new adapter in network of VM instance, assign static ip configuration in the OS present in VM instance.

Step 1: Set up a Host-Only network in VirtualBox Network

  • Select File > Preferences (Please do not select the settings of a vm instance, you need to go to virtual box settings).
  • Select Network in the list on the left pane.
  • Select "Host-only Networks" tab
  • Initially "Host-only Networks" tab use to be empty. Click the topmost one (with a green plus symbol) to add a new network. Clicking it will create a new Host-only network.

Add Host-only Networks details

Click Host only network details icon:

In the Adapter tab add the following details:

IPv4 Address:
IPv4 Network Mask:

You can have IP of your own choice.

In the DHCP Server tab add the following details:

Server Address:
Server Mask:
Lower Address Bound:
Upper Address Bound:

You can have IP of your own choice but the series should match what you entered in previous step.

Save the settings. Now we are going to edit the Network settings of specific VM instance.

Step 2: Add a new "Host-only Adapter" in network

Select your VM instance and then got settings of that instance.

Keep the "Adapter 1" setting as "NAT" only.

Go to "Adapter 2" setting and select "Host-only Adapter" option and then select the network you created in the first step.

We are all done with the settings of Host machine. We are going to play with settings of OS inside VM instance.

Step 3: Assign Static IP to TCP/IP settings inside OS of VM instance.

Go to Control Panel\All Control Panel Items\Network and Sharing Center of your Windows

Click "Ethernet 2" adapter.

In the TCP/IPv4 settings add the following settings:

IP address:

Subnet mask:

Default gateway:

Preferred DNS server:

Do note that I have added the settings based on the IP/ IP range we set in the adapter of Host. After setting the IP you can access your VM machine instance with the static ip you assigned. 

You can confirm the connection by pinging it from Host machine:

You can further check by connecting it via Windows Explorer of Host machine:

Comments (no comments yet)

Top Posts