Problem setting up fixed IP address for host-only adapter on Windows host

Discussions related to using VirtualBox on Windows hosts.

Problem setting up fixed IP address for host-only adapter on Windows host

Postby dma_k » 5. Apr 2019, 18:26

Dear community,

I observe strange behaviour on my Windows Host when I try to set an IP address of host-only adapter. What I did on WindowsA box running Windows7:
  • Downloaded VirtualBox v5.2.26 and installed it on the top of existing 5.x version.
  • Removed existing host-only Ethernet adapter.
  • Created new host-only Ethernet adapter, selected "Configure Adapter Manually" and configured as following:
    Adapter:
    IP address: 192.168.5.1
    Network: 255.255.255.0
    DHCP Server:
    Address: 192.168.5.10
    Network: 255.255.255.0
    Lower Address Bound: 192.168.5.20
    Upper Address Bound: 192.168.5.50
  • I clicked "Apply" button and unexpectedly the radio button is switched to "Configure Adapter Automatically" plus IP address is set to 192.168.5.21 (input field is disabled / greyed out).
Is there something I did wrong while setting up the IP address? Even if something went wrong when setting the fixed IP address, why VirtualBox cannot show the error message? Why the address is selected 192.168.5.21 (it looks like it is taken from DHCP range...)
After above steps, the configuration was the following:
Code: Select all   Expand viewCollapse view
C:\Program Files\VirtualBox> VBoxManage list dhcpservers
NetworkName:    HostInterfaceNetworking-VirtualBox Host-Only Ethernet Adapter
IP:             192.168.5.10
NetworkMask:    255.255.0.0
lowerIPAddress: 192.168.5.20
upperIPAddress: 192.168.5.50
Enabled:        Yes

C:\Program Files\VirtualBox> VBoxManage list hostonlyifs
Name:            VirtualBox Host-Only Ethernet Adapter
GUID:            4dbda501-a436-4de5-903a-dcb01da7f3ef
DHCP:            Enabled
IPAddress:       192.168.5.21
NetworkMask:     255.255.255.0
IPV6Address:     fe80::d84c:e50c:7e39:49eb
IPV6NetworkMaskPrefixLength: 64
HardwareAddress: 0a:00:27:00:00:20
MediumType:      Ethernet
Wireless:        No
Status:          Up
VBoxNetworkName: HostInterfaceNetworking-VirtualBox Host-Only Ethernet Adapter

I thought: OK, it's not good that IP address is taken from DHCP range. So I set Lower Address Bound to 192.168.5.30, hit apply, and (or magic) the IP address of the adapter was set to 192.168.5.31:
vmbox_screenshot4.png
vmbox_screenshot4.png (52.24 KiB) Viewed 1905 times

I decided not to experiment further. I have created a new virtual machine & installed Debian Buster which I could access via host-only adapter and vice versa, for example, there is how I could connect to host port:
Code: Select all   Expand viewCollapse view
user@debian:~$ ping 192.168.5.31
PING 192.168.5.31 (192.168.5.31) 56(84) bytes of data.
64 bytes from 192.168.5.31: icmp_seq=1 ttl=128 time=0.843 ms
64 bytes from 192.168.5.31: icmp_seq=2 ttl=128 time=0.467 ms
^C
--- 192.168.5.31 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 4ms
rtt min/avg/max/mdev = 0.467/0.655/0.843/0.188 ms
user@debian:~$ telnet 192.168.5.31 445
Trying 192.168.5.31...
Connected to 192.168.5.31.
Escape character is '^]'.
blabla
Connection closed by foreign host.

I was happy only until the reboot when IP address was set to 169.254.73.235 and I couldn't access Debian guest anymore:
Code: Select all   Expand viewCollapse view
C:\Program Files\VirtualBox> VBoxManage list hostonlyifs
Name:            VirtualBox Host-Only Ethernet Adapter
GUID:            4dbda501-a436-4de5-903a-dcb01da7f3ef
DHCP:            Enabled
IPAddress:       169.254.73.235
NetworkMask:     255.255.0.0
IPV6Address:     fe80::d84c:e50c:7e39:49eb
IPV6NetworkMaskPrefixLength: 64
HardwareAddress: 0a:00:27:00:00:20
MediumType:      Ethernet
Wireless:        No
Status:          Up
VBoxNetworkName: HostInterfaceNetworking-VirtualBox Host-Only Ethernet Adapter

My further attempts to set the fixed IP address of host-only adapter where unsuccessful: all the time the radio button was switching back to "Configure Adapter Automatically" and some random address was chosen.

Further things got more interesting. On WindowsB box (also running Windows7) I have:
  • Uninstalled VirtualBox.
  • Uninstalled anti-virus Microsoft Security Essentials v4.x.
  • Installed VirtualBox v5.2.26.
  • Created host-only Ethernet adapter with same settings as above.
This time when I pressed "Apply" button, the IP address of host-only adapter was persisted. However when I've started the same virtual machine created above, Debian was able to get DHCP addresses for two network interfaces (10.0.2.15 and 192.168.5.50 correspondingly), and:
  • I can ping guest (192.168.5.50) from host and connect to it.
  • I cannot ping host (192.168.5.1) from guest, neither connect to it.
  • When I start Wireshark, host-only adapter is not in the list of adapters I can capture from (I have sort of DejaVu with my previous post but I then was able to capture IP packets).
Further I came across this post which relates to the same problem as far as I can see, at least somebody was able to reproduce the problem.

It could be related to some Windows7 update and/or missing update... I don't have (and never had) any VPN software. I tried running VirtualBox as normal user, as administrator – all fails this way or another.

I am puzzled. Any feedback is welcomed.
dma_k
 
Posts: 19
Joined: 4. May 2010, 14:38
Primary OS: MS Windows 7
VBox Version: OSE other
Guest OSses: Linux Debian [stretch]

Re: Problem setting up fixed IP address for host-only adapter on Windows host

Postby BillG » 6. Apr 2019, 08:35

You set up a host only network with a DHCP server enabled to issue addresses between 192.168.5.20 and 192.168.5.50. Why were you surprised to get an IP address of 192.168.5.21? You then changed the lower bound to 192.168.5.30 and got an IP of 192.168.5.31, again as expected.

Why do you want a static IP address on a host only adapter? What do you hope to achieve with a static IP which cannot be achieved with an address from the DHCP server you configured? The host only adapter is for communicating between the host and guest only. It cannot be routed to any other network.
Bill
BillG
Volunteer
 
Posts: 4200
Joined: 19. Sep 2009, 04:44
Location: Sydney, Australia
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Windows 7,8,Server

Re: Problem setting up fixed IP address for host-only adapter on Windows host

Postby dma_k » 8. Apr 2019, 09:07

Thanks for the answer.
BillG wrote:You set up a host only network with a DHCP server enabled to issue addresses between 192.168.5.20 and 192.168.5.50. Why were you surprised to get an IP address of 192.168.5.21? You then changed the lower bound to 192.168.5.30 and got an IP of 192.168.5.31, again as expected.

When I click on "Apply" button, the radio group which I've set to "Configure Adapter Manually" is switched to "Configure Adapter Automatically". Is it as expected?
Why do you want a static IP address on a host only adapter? What do you hope to achieve with a static IP which cannot be achieved with an address from the DHCP server you configured? The host only adapter is for communicating between the host and guest only. It cannot be routed to any other network.

I want to set the static IP address on a host because I want to access the host using fixed address. For example I would like to access the WebServer running on host:8080 (host=192.168.5.1) from all guest OSes. How can I achieve that?
Last edited by dma_k on 9. Apr 2019, 10:40, edited 1 time in total.
dma_k
 
Posts: 19
Joined: 4. May 2010, 14:38
Primary OS: MS Windows 7
VBox Version: OSE other
Guest OSses: Linux Debian [stretch]

Re: Problem setting up fixed IP address for host-only adapter on Windows host

Postby socratis » 8. Apr 2019, 12:32

dma_k wrote:When I click on "Apply" button, the radio group which I've set to "Configure Adapter Manually" is switched to "Configure Adapter Automatically". Is it as expected?

Funny thing... VirtualBox is doing this on Windows only, not on Linux or OSX that I tested. Haven't tested a Solaris host, don't have one. I really don't know why it's doing that.

Maybe because the HostOnly NIC is visible under Windows (not so on the other two) and it's set as a DHCP-enabled NIC? And VirtualBox tries to sync the dual personality of the NIC? Which means that it's set to Automatically, just because it's DHCP-enabled from the Windows side? Got to ask the devs about it...
Do NOT send me Personal Messages (PMs) for troubleshooting, they are simply deleted.
Do NOT reply with the "QUOTE" button, please use the "POST REPLY", at the bottom of the form.
If you obfuscate any information requested, I will obfuscate my response. These are virtual UUIDs, not real ones.
socratis
Site Moderator
 
Posts: 27427
Joined: 22. Oct 2010, 11:03
Location: Greece
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Win(*>98), Linux*, OSX>10.5

Re: Problem setting up fixed IP address for host-only adapter on Windows host

Postby BillG » 9. Apr 2019, 01:44

dma_k wrote:I wan to set the static IP address on a host because I want to access the host using fixed address. For example I would like to access the WebServer running on host:8080 (host=192.168.5.1) from all guest OSes. How can I achieve that?

On the host? I am confused. I assumed that you were talking about a guest, since you were getting an IP from the host only DHCP server. The IP address of the host only interface on the physical machine should never change from 192.168.5.1 in your case. It is set by VirtualBox when you define the DHCP server. Why would you try to change it? The DHCP server itself does not get its IP from DHCP!

169.254.73.235 is not some random address. It is an APIPA address, which Windows will allocate if the NIC is set to get its config automatically, but a DHCP server is not available.
Bill
BillG
Volunteer
 
Posts: 4200
Joined: 19. Sep 2009, 04:44
Location: Sydney, Australia
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Windows 7,8,Server

Re: Problem setting up fixed IP address for host-only adapter on Windows host

Postby socratis » 9. Apr 2019, 09:30

@dma_k
Shut down VirtualBox, locate the file "C:\Users\<you>\.VirtualBox\VirtualBox.xml" (note the "."). ZIP that file and attach it here.
Do NOT send me Personal Messages (PMs) for troubleshooting, they are simply deleted.
Do NOT reply with the "QUOTE" button, please use the "POST REPLY", at the bottom of the form.
If you obfuscate any information requested, I will obfuscate my response. These are virtual UUIDs, not real ones.
socratis
Site Moderator
 
Posts: 27427
Joined: 22. Oct 2010, 11:03
Location: Greece
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Win(*>98), Linux*, OSX>10.5

Re: Problem setting up fixed IP address for host-only adapter on Windows host

Postby dma_k » 10. Jul 2019, 02:05

BillG wrote:On the host? I am confused. I assumed that you were talking about a guest, since you were getting an IP from the host only DHCP server. The IP address of the host only interface on the physical machine should never change from 192.168.5.1 in your case. It is set by VirtualBox when you define the DHCP server. Why would you try to change it? The DHCP server itself does not get its IP from DHCP!

169.254.73.235 is not some random address. It is an APIPA address, which Windows will allocate if the NIC is set to get its config automatically, but a DHCP server is not available.

I am confused not less than you.
  • Here is the video which hopefully explains more than words. In the video I am trying to set the IP address of host-only adapter and it does not work. In this configuration I cannot address guest from host, because it's IP address (169.254.73.235) is not fixed. Question: Why VirtualBox does not allow me to set IP address manually? E.g. why shouldn't it show what went wrong?
  • This video was captured after I have started Debian guest and shut it down. After that when I run "ipconfig" on Windows host, it shows IP address 192.168.5.20. Note that I haven't tried to set this IP address. Note also that it is not refreshed in VirtualBox and get refreshed after I try to set it up manually. Question: Why it was set to lower boundary of DHCP for guest? Co-incidence?
Nevertheless after few trials everything is working as expected, i.e. I can connect to guest from host. However from fresh Windows host boot I have troubles...
socratis wrote:@dma_k
Shut down VirtualBox, locate the file ".VirtualBox\VirtualBox.xml" (note the "."). ZIP that file and attach it here.

I've attached to this post.
Attachments
VirtualBox.zip
(1.37 KiB) Downloaded 12 times
dma_k
 
Posts: 19
Joined: 4. May 2010, 14:38
Primary OS: MS Windows 7
VBox Version: OSE other
Guest OSses: Linux Debian [stretch]

Re: Problem setting up fixed IP address for host-only adapter on Windows host

Postby fth0 » 13. Jul 2019, 23:41

On my macOS and Linux hosts with VirtualBox 5.2.x, I also struggled with the behavior of the dialogs when configuring a host-only adapter. It doesn't match your descriptions and videos exactly, but my findings may be nonetheless helpful to you:

1. After clicking the Create button, a vboxnet0 adapter is shown in the table with some IPv4 settings (e.g. 192.168.56.1/24). At this time, ifconfig shows the adapter, but without an IPv4 address.

2. When selecting vboxnet0 and clicking the Properties button, the vboxnet0 adapter details are shown containing the current settings. When I now change the IPv4 address of the proposal (e.g. from 192.168.56.1 to 192.168.57.1) and click the OK button, the displayed settings are immediately changed back to the previous values. At this time, ifconfig shows the adapter, already with the new (changed) IPv4 address (e.g. 192.168.57.1). Changing the IPv4 address a second time and clicking the OK button, the changes are now also displayed (the resistance has been broken :) ).

3. After switching to the DHCP Server tab, clicking the Enable Server checkbox fills in a proposal matching the currently displayed settings of the Adapter tab, not the currently active settings (according to ifconfig), but only the first time the checkbox ist set (when the settings have been 0.0.0.0). Therefore it is important to have successfully set the settings in the Adapter tab in the first step.

@dma_k:
Bottom line: Start from scratch (remove the host-only adapter first), use the OK button as often as possible and check the settings after every click of the OK button.

@socratis:
  • I have used the VirtualBox 5.2.26 GUI on macOS 10.13.6 to create the description above.
  • If I repeatedly change the 3rd octet of the IPv4 address (in step 2 above) to a new value like '57 OK 58 OK 59 OK', after each 'OK' the new value is in effect and the previous value is displayed. EDIT: VBoxManage list hostonlyifs and the VirtualBox.xml file also show the new values, only the VirtualBoxGUI app displays the previous values.
PS: The VirtualBox 5.2.x GUI also introduced other minor annoyances (not always behaving as expected), which I never bothered to report; they always happen on both macOS and Linux hosts for me.
Last edited by fth0 on 14. Jul 2019, 12:11, edited 1 time in total.
fth0
Volunteer
 
Posts: 313
Joined: 14. Feb 2019, 03:06
Location: Germany
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Linux, Windows 10, macOS, ...

Re: Problem setting up fixed IP address for host-only adapter on Windows host

Postby dma_k » 14. Jul 2019, 10:25

Thanks for the info, fth0.

fth0 wrote:Bottom line: Start from scratch (remove the host-only adapter first), use the OK button as often as possible and check the settings after every click of the OK button.

I have run experiment on fresh VirtualBox installation (uninstall i.e. host adapter was removed from Windows + install) and newly created virtual machine. And I need just one OK button click to work :)

Concerning my very issue I sum up with following:
  • Setting the IP address of host-only adapter does not work for me.
  • After the guest OS is booted, the IP address is set to 192.168.5.20, however this is not updated in VirtualBox interface, which still displays stale value 169.254.73.235. It is updated when I try to set up the IP address manually, hence I observed this strange IP address update.
  • Guest OS works fine after 1st boot (i.e. I can ping guest IP 192.168.5.23 from host ping host IP 192.168.5.20 from guest), however after guest reboot networking (ping) does not work anymore. This is still subject for my further investigation when it exactly happens (after guest reboot, or after guest shutdown + host hibernate and back + guest boot). The problem persists until I reboot the host.
dma_k
 
Posts: 19
Joined: 4. May 2010, 14:38
Primary OS: MS Windows 7
VBox Version: OSE other
Guest OSses: Linux Debian [stretch]


Return to VirtualBox on Windows Hosts

Who is online

Users browsing this forum: No registered users and 51 guests