Page 1 of 1

How to set ip for the guest?

Posted: 4. May 2017, 06:51
by eric-wu
Hello.
I'm currently using VBox API 5.0.14 in C++ via Com.
My host OS is Win 10 and my guest is a 32bit other Linux.
i'm using hostonly network, but the gust do not have an ipsddress.
so how to set a ipaddress by APIs directly or through virtualbox hostonly network adapter.

Re: How to set ip for the guest?

Posted: 4. May 2017, 07:03
by socratis
eric-wu wrote:i'm using hostonly network, but the gust do not have an ipsddress.
How can it NOT have an IP address? Did you disable the network in the guest? Did you disable the DHCP server on the VirtualBox? You were told again:
Perryg wrote:the guest receives a specific IP address in the range 192.168.56.* and if using DHCP it should be 192.168.56.101 by default unless you changed it.
So, the question is: why doesn't your guest have an IP address?

Re: How to set ip for the guest?

Posted: 4. May 2017, 08:50
by eric-wu
whin i use ifconfig, it shows
eth0 link encap:Ethernet HWaddr 08:00..
up broadcast running multicast mtu:1500 metric:1
rx packets:1 error:0 dro:0 overruns:0 frame:0
tx packets:0 ..
rx bytes:243(243.0 B) tx bytes:0(0.0 B)
interrupt:10 base address:0xd000

lo ...

and the network setting
adapter 1
(tick)enable network adapter
attach to Host-Only adapter
name:VirtualBox Host-Only Ethernet adapter
adavanced
adapter type:PCnet-FAST 3
promiscuous mode: deny
mac address ..
(tick)cable connect

i don't know why the guest can't receive a specific IP address in the range 192.168.56.*

Re: How to set ip for the guest?

Posted: 4. May 2017, 09:27
by socratis
Follow a "start the VM from cold-boot"/"observe error"/"shutdown the VM" cycle. With the VM shut down completely (not paused or saved), right-click on the VM in the VirtualBox Manager and select "Show Log". Save only the first "VBox.log", ZIP it and attach it to your response (see the "Upload attachment" tab below the reply form).

Do not obfuscate anything please.

Re: How to set ip for the guest?

Posted: 4. May 2017, 09:42
by socratis
Also, check under VirtualBox preferences » Networks » Host-only network. What's there? Is the DHCP server enabled?

Re: How to set ip for the guest?

Posted: 4. May 2017, 10:31
by eric-wu
hostonly network details
adapter:
ipv4 address:192.168.56.1
ipv4 networkmask :255.255.255.0
dhcpserver:
(tick)enableserver
server address:192.168.56.100
server mask: 255.255.255.0
lower address bound:192.168.56.101
upper address bound:192.168.56.254

Re: How to set ip for the guest?

Posted: 4. May 2017, 11:12
by socratis
That looks fine. I'd still like to see the log as instructed in the previous post.

Re: How to set ip for the guest?

Posted: 4. May 2017, 12:22
by noteirak
Not related to VirtualBox API, Moving to "Using VirtualBox"

Guest can't get ip from hostonly network

Posted: 4. May 2017, 12:35
by eric-wu
hello,
i'm using virsion 5.1.14
my Vm can't get the ip from hostonly network.

whin i use ifconfig, it shows
eth0 link encap:Ethernet HWaddr 08:00..
up broadcast running multicast mtu:1500 metric:1
rx packets:1 error:0 dro:0 overruns:0 frame:0
tx packets:0 ..
rx bytes:243(243.0 B) tx bytes:0(0.0 B)
interrupt:10 base address:0xd000

lo ...

and the network setting
adapter 1
(tick)enable network adapter
attach to Host-Only adapter
name:VirtualBox Host-Only Ethernet adapter
adavanced
adapter type:PCnet-FAST 3
promiscuous mode: deny
mac address ..
(tick)cable connect

hostonly network details
adapter:
ipv4 address:192.168.56.1
ipv4 networkmask :255.255.255.0
dhcpserver:
(tick)enableserver
server address:192.168.56.100
server mask: 255.255.255.0
lower address bound:192.168.56.101
upper address bound:192.168.56.254

i don't know why the guest can't receive a specific IP address in the range 192.168.56.*

Re: How to set ip for the guest?

Posted: 4. May 2017, 12:55
by socratis
eric-wu,
Do not create two different topics for the same exactly problem. Next time, I will not merge them, I'll simply delete the duplicate.

Now, I asked you 1) to not obfuscate things and 2) a complete VBox.log.zip after a complete run of the VM. I'm still waiting...

Re: How to set ip for the guest?

Posted: 4. May 2017, 13:20
by eric-wu
i'm so sorry.

Re: How to set ip for the guest?

Posted: 4. May 2017, 16:08
by socratis
I couldn't see anything, maybe others can from the logs. The only thing that looks a little suspicious is something that you have installed in "Program Files (x86)\Baidu\BaiduPinyin". I'm not sure why it wants to inject itself in every process, just like it does with VirtualBox, but it may be because it's filtering TCP/IP traffic for ad purposes? It's signed, but that doesn't mean it can interfere with your setup.

Finally, I didn't get from the logs the kind of your guest. Yes, it's a generic Linux, but any specifics? Anything we could try here? The reason I'm asking is that we haven't covered the following question: is your guest set so that it gets a DHCP address? If not, that's the problem.

Re: How to set ip for the guest?

Posted: 5. May 2017, 06:09
by eric-wu
i don't exactly understand what do you mean.
but the guest shows rx always be 0, means it doesn't receive any package
does this means the adapter have not connected to the guest?
if the guest receive a specific IP ,it must receive and sent packages.

Re: How to set ip for the guest?

Posted: 5. May 2017, 08:01
by socratis
socratis wrote:I didn't get from the logs the kind of your guest. Yes, it's a generic Linux, but any specifics? Anything we could try here?
socratis wrote:is your guest set so that it gets a DHCP address?

Re: How to set ip for the guest?

Posted: 12. May 2017, 05:26
by eric-wu
i found the problem in the Guest OS , thank a lot