Thinking Out Loud

January 7, 2011

VirtualBox Command Line

Filed under: VirtualBox — mdinh @ 4:20 am

I have manually configured VirtualBox Host-Only Ethernet Adapter for static IP.

However, the IP can change after reboot which affects connectivity with the Guest with static IP.

I have not been able able to figure out why.

However, one method to resolve this is to add the following commands in a batch file and have it executed at startup.

VBoxManage hostonlyif ipconfig “VirtualBox Host-Only Ethernet Adapter” –ip 192.168.56.1
VBoxManage dhcpserver modify –ifname “VirtualBox Host-Only Ethernet Adapter” –disable
VBoxManage list -l hostonlyifs

C:\>VBoxManage hostonlyif ipconfig "VirtualBox Host-Only Ethernet Adapter" --ip 192.168.56.1

C:\>VBoxManage dhcpserver modify --ifname "VirtualBox Host-Only Ethernet Adapter" --disable

C:\>VBoxManage list -l hostonlyifs
Name:            VirtualBox Host-Only Ethernet Adapter
GUID:            97cdbf73-e6e7-45d3-a8fe-ea4ee0fd5939
Dhcp:            Disabled
IPAddress:       192.168.56.1
NetworkMask:     255.255.255.0
IPV6Address:     fe80:0000:0000:0000:ecfc:c04f:b7dd:4054
IPV6NetworkMaskPrefixLength: 64
HardwareAddress: 08:00:27:00:98:7d
MediumType:      Ethernet
Status:          Up
VBoxNetworkName: HostInterfaceNetworking-VirtualBox Host-Only Ethernet Adapter

C:\>
Advertisements

2 Comments »

  1. I have the exact same problem. After installation of VirtualBox, and registration of the VM I would change the Host-Only adapter configuration via my install program. But after reboot the Host-Only adapter configuration changes, so I couldn’t communicate with the VM. In fact even if I manually tried to change the Host-Only adapter thru the GUI, it would just revert back as soon as I closed the window. I will try to use your solution in my program. I have been looking online for a while and had found nothing. Thanks

    Comment by Diane Medrano — June 19, 2012 @ 8:15 pm | Reply

    • Glad to be of help. Please let me know if the solution works for you. There has been serveral upgrades since as well.

      Comment by mdinh — June 21, 2012 @ 12:26 am | Reply


RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Create a free website or blog at WordPress.com.

%d bloggers like this: