How to set ip for the guest?

This is for discussing general topics about how to use VirtualBox.
Post Reply
eric-wu
Posts: 16
Joined: 24. Apr 2017, 14:06

How to set ip for the guest?

Post 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.
socratis
Site Moderator
Posts: 27329
Joined: 22. Oct 2010, 11:03
Primary OS: Mac OS X other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Win(*>98), Linux*, OSX>10.5
Location: Greece

Re: How to set ip for the guest?

Post 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?
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.
eric-wu
Posts: 16
Joined: 24. Apr 2017, 14:06

Re: How to set ip for the guest?

Post 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.*
socratis
Site Moderator
Posts: 27329
Joined: 22. Oct 2010, 11:03
Primary OS: Mac OS X other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Win(*>98), Linux*, OSX>10.5
Location: Greece

Re: How to set ip for the guest?

Post 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.
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: 27329
Joined: 22. Oct 2010, 11:03
Primary OS: Mac OS X other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Win(*>98), Linux*, OSX>10.5
Location: Greece

Re: How to set ip for the guest?

Post by socratis »

Also, check under VirtualBox preferences » Networks » Host-only network. What's there? Is the DHCP server enabled?
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.
eric-wu
Posts: 16
Joined: 24. Apr 2017, 14:06

Re: How to set ip for the guest?

Post 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
socratis
Site Moderator
Posts: 27329
Joined: 22. Oct 2010, 11:03
Primary OS: Mac OS X other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Win(*>98), Linux*, OSX>10.5
Location: Greece

Re: How to set ip for the guest?

Post by socratis »

That looks fine. I'd still like to see the log as instructed in the previous post.
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.
noteirak
Site Moderator
Posts: 5231
Joined: 13. Jan 2012, 11:14
Primary OS: Debian other
VBox Version: OSE Debian
Guest OSses: Debian, Win 2k8, Win 7
Contact:

Re: How to set ip for the guest?

Post by noteirak »

Not related to VirtualBox API, Moving to "Using VirtualBox"
Hyperbox - Virtual Infrastructure Manager - https://apps.kamax.lu/hyperbox/
Manage your VirtualBox infrastructure the free way!
eric-wu
Posts: 16
Joined: 24. Apr 2017, 14:06

Guest can't get ip from hostonly network

Post 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.*
socratis
Site Moderator
Posts: 27329
Joined: 22. Oct 2010, 11:03
Primary OS: Mac OS X other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Win(*>98), Linux*, OSX>10.5
Location: Greece

Re: How to set ip for the guest?

Post 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...
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.
eric-wu
Posts: 16
Joined: 24. Apr 2017, 14:06

Re: How to set ip for the guest?

Post by eric-wu »

i'm so sorry.
Attachments
Logs.rar
(35.23 KiB) Downloaded 9 times
socratis
Site Moderator
Posts: 27329
Joined: 22. Oct 2010, 11:03
Primary OS: Mac OS X other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Win(*>98), Linux*, OSX>10.5
Location: Greece

Re: How to set ip for the guest?

Post 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.
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.
eric-wu
Posts: 16
Joined: 24. Apr 2017, 14:06

Re: How to set ip for the guest?

Post 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.
socratis
Site Moderator
Posts: 27329
Joined: 22. Oct 2010, 11:03
Primary OS: Mac OS X other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Win(*>98), Linux*, OSX>10.5
Location: Greece

Re: How to set ip for the guest?

Post 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?
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.
eric-wu
Posts: 16
Joined: 24. Apr 2017, 14:06

Re: How to set ip for the guest?

Post by eric-wu »

i found the problem in the Guest OS , thank a lot
Post Reply