Virtual machine is connected to a different subnet than the host

Discussions related to using VirtualBox on Windows hosts.
Somayyah
Posts: 9
Joined: 18. Oct 2019, 16:51

Virtual machine is connected to a different subnet than the host

Post by Somayyah »

I have Centos7 VM installed on virtualbox and it works fine, but when I use the command

Code: Select all

ip address
I get the ip as 192.168.0.X, the host machine (Windows 10) is on 192.168.100.X why is that?
I have the interface on Bridged adapter mood and I've never had this issue before with the same appliance when I tried it on a different PC, I tried installing the machine and VBox many times but without success, what is the issue?
scottgus1
Site Moderator
Posts: 20945
Joined: 30. Dec 2009, 20:14
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Windows, Linux

Re: Virtual machine is connected to a different subnet than the host

Post by scottgus1 »

Let's confirm your network setup.

Please run this command on the Windows host PC, and post the output as text in a

Code: Select all

 tag:

[color=#800080]ipconfig /all[/color]

Please run this command on the Centos guest, and post the output as text in a [code] tag:

[color=#800080]ifconfig[/color]

Open the guest's folder, zip up the guest's .vbox file, and post the zip, using the forum's Upload Attachment tab.
Somayyah
Posts: 9
Joined: 18. Oct 2019, 16:51

Re: Virtual machine is connected to a different subnet than the host

Post by Somayyah »

OK

//outpot after running ip address command on guest machine CentOS

Code: Select all

[root@wazuhmanager ~]# ip address
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether 52:54:00:8a:fe:e6 brd ff:ff:ff:ff:ff:ff
    inet 192.168.0.129/24 brd 192.168.0.255 scope global noprefixroute dynamic eth0
       valid_lft 5268sec preferred_lft 5268sec
    inet6 fe80::5054:ff:fe8a:fee6/64 scope link
       valid_lft forever preferred_lft forever
[root@wazuhmanager ~]#
//ipconfig /all outpot on Windows host

Code: Select all

Windows IP Configuration

   Host Name . . . . . . . . . . . . : Data-center
   Primary Dns Suffix  . . . . . . . :
   Node Type . . . . . . . . . . . . : Hybrid
   IP Routing Enabled. . . . . . . . : No
   WINS Proxy Enabled. . . . . . . . : No

Ethernet adapter VirtualBox Host-Only Network:

   Connection-specific DNS Suffix  . :
   Description . . . . . . . . . . . : VirtualBox Host-Only Ethernet Adapter
   Physical Address. . . . . . . . . : 0A-00-27-00-00-0B
   DHCP Enabled. . . . . . . . . . . : No
   Autoconfiguration Enabled . . . . : Yes
   Link-local IPv6 Address . . . . . : fe80::b81a:fd01:1b5d:23f%11(Preferred)
   IPv4 Address. . . . . . . . . . . : 192.168.56.1(Preferred)
   Subnet Mask . . . . . . . . . . . : 255.255.255.0
   Default Gateway . . . . . . . . . :
   DHCPv6 IAID . . . . . . . . . . . : 185204775
   DHCPv6 Client DUID. . . . . . . . : 00-01-00-01-25-17-CD-79-8C-EC-4B-CB-1A-4E
   DNS Servers . . . . . . . . . . . : fec0:0:0:ffff::1%1
                                       fec0:0:0:ffff::2%1
                                       fec0:0:0:ffff::3%1
   NetBIOS over Tcpip. . . . . . . . : Enabled

Ethernet adapter ‏‏Ethernet:

   Connection-specific DNS Suffix  . :
   Description . . . . . . . . . . . : Intel(R) Ethernet Connection (7) I219-LM
   Physical Address. . . . . . . . . : 8C-EC-4B-CB-1A-4E
   DHCP Enabled. . . . . . . . . . . : No
   Autoconfiguration Enabled . . . . : Yes
   Link-local IPv6 Address . . . . . : fe80::e58a:83a0:fe8c:12f4%3(Preferred)
   IPv4 Address. . . . . . . . . . . : 192.168.100.36(Preferred)
   Subnet Mask . . . . . . . . . . . : 255.255.255.0
   Default Gateway . . . . . . . . . : 192.168.100.250
   DHCPv6 IAID . . . . . . . . . . . : 109898827
   DHCPv6 Client DUID. . . . . . . . : 00-01-00-01-25-17-CD-79-8C-EC-4B-CB-1A-4E
   DNS Servers . . . . . . . . . . . : 192.168.100.20
                                       4.2.2.3
   NetBIOS over Tcpip. . . . . . . . : Enabled

C:\Users\Data center>
VBOX zip file
Attachments
vm_wazuh 2.zip
(1.47 KiB) Downloaded 8 times
Martin
Volunteer
Posts: 2561
Joined: 30. May 2007, 18:05
Primary OS: Fedora other
VBox Version: PUEL
Guest OSses: XP, Win7, Win10, Linux, OS/2

Re: Virtual machine is connected to a different subnet than the host

Post by Martin »

Looks like you have configured your host manually to 192.168.100.36 and the guest is getting a 192.168.0.x addresss from a DHCP server somewhere on your network.
scottgus1
Site Moderator
Posts: 20945
Joined: 30. Dec 2009, 20:14
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Windows, Linux

Re: Virtual machine is connected to a different subnet than the host

Post by scottgus1 »

I concur with Martin. See the guest:
Somayyah wrote:
eth0:
inet 192.168.0.129/24 brd 192.168.0.255.....dynamic
and the host:
Somayyah wrote:
Intel(R) Ethernet Connection (7) I219-LM
DHCP Enabled. . . . . . . . . . . : No
IPv4 Address. . . . . . . . . . . : 192.168.100.36(Preferred)
The guest is Bridged to the host's physical LAN, and the guest gets IP from the physical LAN's DHCP server.
The host has static IP, and is looking for network traffic in a different IP address range.
Somayyah
Posts: 9
Joined: 18. Oct 2019, 16:51

Re: Virtual machine is connected to a different subnet than the host

Post by Somayyah »

Hmmm

So the solution is to enable DHCP on the Host or static IP on the guest.....

Is this right?
scottgus1
Site Moderator
Posts: 20945
Joined: 30. Dec 2009, 20:14
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Windows, Linux

Re: Virtual machine is connected to a different subnet than the host

Post by scottgus1 »

That depends. Your guest appears to be getting its IP address from a DHCP server "somewhere" on the host's LAN, as Martin puts it. You host appears to be out in left field, so to speak.

Is your host able to get internet and see other PCs on the LAN?

Maybe you could describe your host's LAN? big office, simple house network with a router? etc.
socratis
Site Moderator
Posts: 27329
Joined: 22. Oct 2010, 11:03
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Win(*>98), Linux*, OSX>10.5
Location: Greece

Re: Virtual machine is connected to a different subnet than the host

Post by socratis »

To the thread participants... please vote for your favorite final resolution of the thread:
  • [Invalid]
  • [WorksForMe]
:)

Joking aside, 'Somayyah' you seem to have chosen to have your host having a static IP address. Any reason behind that decision?
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.
Somayyah
Posts: 9
Joined: 18. Oct 2019, 16:51

Re: Virtual machine is connected to a different subnet than the host

Post by Somayyah »

scottgus1 wrote:Maybe you could describe your host's LAN? big office, simple house network with a router? etc.
Well it's a client's network, but they have all the PC's connected on 192.168.100.X for some reason and IP's are pre assigned by their administrator and I can't change anything in them, but I can assign a static IP address though.

I've looked over on how to assign a static IP to the guest machine when the host uses a static IP but nothing seems to help :|
Somayyah
Posts: 9
Joined: 18. Oct 2019, 16:51

Re: Virtual machine is connected to a different subnet than the host

Post by Somayyah »

socratis wrote:Joking aside, 'Somayyah' you seem to have chosen to have your host having a static IP address. Any reason behind that decision?
Well it wasn't my choice but as client's request. I think I need to assign a static IP to the machine but no tutorial seems to help....
socratis
Site Moderator
Posts: 27329
Joined: 22. Oct 2010, 11:03
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Win(*>98), Linux*, OSX>10.5
Location: Greece

Re: Virtual machine is connected to a different subnet than the host

Post by socratis »

Somayyah wrote:IP's are pre assigned by their administrator
Aha! We have a rogue admin then! :D
Somayyah wrote:I think I need to assign a static IP to the machine but no tutorial seems to help
Yes you do. And what "tutorial" are you referring to? Just look at the guest's network configuration, and instead of DHCP-based/dynamic, change it to a static one, filling in the IP, Router, Netmask and DNS entries.

Ask the admin for the specific values, you don't want to assign a duplicate IP to your, trust me...
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.
Somayyah
Posts: 9
Joined: 18. Oct 2019, 16:51

Re: Virtual machine is connected to a different subnet than the host

Post by Somayyah »

Already did but didn't work.....
machine is bridged adapter BTW
Attachments
Capture.PNG
Capture.PNG (27.11 KiB) Viewed 2858 times
Last edited by socratis on 20. Oct 2019, 23:07, edited 1 time in total.
Reason: Removed unnecessary verbatim quote of the whole previous message.
socratis
Site Moderator
Posts: 27329
Joined: 22. Oct 2010, 11:03
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Win(*>98), Linux*, OSX>10.5
Location: Greece

Re: Virtual machine is connected to a different subnet than the host

Post by socratis »

Somayyah wrote:Already did but didn't work
Which part didn't work? I don't get it...


BTW, can you please use the "Preview" before hitting the "Submit" button? That way you're going to see that the attached picture is barely visible. And it's usually easier, more convenient, smaller size, searchable and quotable, if you simply paste the text, instead of posting the image... ;)
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.
Somayyah
Posts: 9
Joined: 18. Oct 2019, 16:51

Re: Virtual machine is connected to a different subnet than the host

Post by Somayyah »

Oh sorry my bad, I'm working on the host server via teamviewer and it's hard to get the screenshots readable.

So anyways here is the eth0 interface configuration I did:

Code: Select all

DEVICE="eth0"
BOOTPROTO="static"  #changed to static
ONBOOT="yes"
TYPE="Ethernet"
PERSISTENT_DHCLIENT="yes"
IPADDR = "192.168.100.2"  #added line
GATEWAY = "192.168.100.250" #added line
NETMASK = "255.255.255.0" #added line
DNS SERVER ="8.8.8.8" #added line
when I restart the network service I don't see any ip set to the eth0

is the image clear? the interface is eth0 not eth1, I've lost the capture image and need sometime to re-access teamviewer but it's the same I guess :/
Attachments
Capture.PNG
Capture.PNG (4.27 KiB) Viewed 2838 times
Last edited by socratis on 21. Oct 2019, 10:07, edited 1 time in total.
Reason: Removed unnecessary verbatim quote of the whole previous message.
socratis
Site Moderator
Posts: 27329
Joined: 22. Oct 2010, 11:03
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Win(*>98), Linux*, OSX>10.5
Location: Greece

Re: Virtual machine is connected to a different subnet than the host

Post by socratis »

Somayyah wrote:when I restart the network service I don't see any ip set to the eth0
At this point it looks to me like a guest OS configuration problem, not a VirtualBox one...
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.
Post Reply