NAT not working for Windows 10 guest on Windows 7 host

Discussions about using Windows guests in VirtualBox.
Post Reply
gbburkhardt
Posts: 5
Joined: 21. Mar 2015, 19:09

NAT not working for Windows 10 guest on Windows 7 host

Post by gbburkhardt »

Using VirtualBox-5.1.26-117224, with extension pack installed.

I've turned on both a NAT and host only network adaptor in the guest, but can't access other machines on the network. This does work with a Linux guest running on the same host. Oddly, the two network adaptors are given IP addresses on the same subnet. Ping works to 192.168.56.1 on the guest, but doesn't on the host to either Win10 guest IP address. Ping on the host works to the 192.168.56.x address of the Linux guest.

Shouldn't this be straightforward and "just work"?

Code: Select all

$ ipconfig
Windows IP Configuration

Ethernet adapter Ethernet:

   Connection-specific DNS Suffix  . :
   Link-local IPv6 Address . . . . . : fe80::cd49:8fdd:78f8:865d%13
   IPv4 Address. . . . . . . . . . . : 192.168.56.100
   Subnet Mask . . . . . . . . . . . : 255.255.255.0
   Default Gateway . . . . . . . . . : 192.168.56.1

Ethernet adapter Ethernet 2:

   Connection-specific DNS Suffix  . :
   Link-local IPv6 Address . . . . . : fe80::6831:a6fc:fe3d:726a%7
   IPv4 Address. . . . . . . . . . . : 192.168.56.101
   Subnet Mask . . . . . . . . . . . : 255.255.255.0
   Default Gateway . . . . . . . . . :
The routing table is:

Code: Select all

IPv4 Route Table
===========================================================================
Active Routes:
Network Destination        Netmask          Gateway       Interface  Metric
          0.0.0.0          0.0.0.0     192.168.56.1   192.168.56.100    281
        127.0.0.0        255.0.0.0         On-link         127.0.0.1    331
        127.0.0.1  255.255.255.255         On-link         127.0.0.1    331
  127.255.255.255  255.255.255.255         On-link         127.0.0.1    331
     192.168.56.0    255.255.255.0         On-link    192.168.56.100    281
     192.168.56.0    255.255.255.0         On-link    192.168.56.101    281
   192.168.56.100  255.255.255.255         On-link    192.168.56.100    281
   192.168.56.101  255.255.255.255         On-link    192.168.56.101    281
   192.168.56.255  255.255.255.255         On-link    192.168.56.100    281
   192.168.56.255  255.255.255.255         On-link    192.168.56.101    281
        224.0.0.0        240.0.0.0         On-link         127.0.0.1    331
        224.0.0.0        240.0.0.0         On-link    192.168.56.100    281
        224.0.0.0        240.0.0.0         On-link    192.168.56.101    281
  255.255.255.255  255.255.255.255         On-link         127.0.0.1    331
  255.255.255.255  255.255.255.255         On-link    192.168.56.100    281
  255.255.255.255  255.255.255.255         On-link    192.168.56.101    281
===========================================================================
Persistent Routes:
  Network Address          Netmask  Gateway Address  Metric
          0.0.0.0          0.0.0.0     192.168.56.1  Default
===========================================================================
The host has a suitable routing table entry:

Code: Select all

     192.168.56.0    255.255.255.0         On-link      192.168.56.1    266
Curiously, the Linux guest has different subnets for the NAT and host adaptor:

Code: Select all

glenn.burkhardt@ms110dev:~$ ifconfig
enp0s3    Link encap:Ethernet  HWaddr 08:00:27:ca:14:08  
          inet addr:10.0.2.15  Bcast:10.0.2.255  Mask:255.255.255.0
          inet6 addr: fe80::bc0a:568b:31c3:8d96/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:19 errors:0 dropped:0 overruns:0 frame:0
          TX packets:27 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:2984 (2.9 KB)  TX bytes:2712 (2.7 KB)

enp0s8    Link encap:Ethernet  HWaddr 08:00:27:e4:56:3c  
          inet addr:192.168.56.102  Bcast:192.168.56.255  Mask:255.255.255.0
          inet6 addr: fe80::18ea:c58a:b5c3:81ab/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:3 errors:0 dropped:0 overruns:0 frame:0
          TX packets:10 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:1262 (1.2 KB)  TX bytes:1308 (1.3 KB)
Last edited by socratis on 18. Aug 2017, 08:16, edited 1 time in total.
Reason: Enclosed the information in [code] tag for better readability
scottgus1
Site Moderator
Posts: 20945
Joined: 30. Dec 2009, 20:14
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Windows, Linux

Re: NAT not working for Windows 10 guest on Windows 7 host

Post by scottgus1 »

gbburkhardt wrote:Shouldn't this be straightforward and "just work"?
if your goal is to:
gbburkhardt wrote:access other machines on the network
then this:
gbburkhardt wrote:I've turned on both a NAT and host only network adaptor
will not get you where you want to be. So, no.
gbburkhardt wrote:the two network adaptors are given IP addresses on the same subnet.
Which two adapters?
gbburkhardt wrote:192.168.56.x address of the Linux guest.
I didn't know Linux has 'x' as the last part of an IP address. I figured it would have been a number. Who knew? (Please don't obfuscate.)
gbburkhardt wrote:Ping works to 192.168.56.1 on the guest, but doesn't on the host to either Win10 guest IP address.
Response to Ping on Windows is disabled in the firewall. You need to enable it.
gbburkhardt wrote:Curiously, the Linux guest has different subnets for the NAT and host adaptor:
It's not that curious when you know how NAT and Host-Only work.

See the manual, section 6, especially the table in 6.2, for the correct network type to get your desired connection. (Hint, I have a Bridge in Brooklyn for sale.)
gbburkhardt
Posts: 5
Joined: 21. Mar 2015, 19:09

Re: NAT not working for Windows 10 guest on Windows 7 host

Post by gbburkhardt »

Bridge adapters don't work either.
All the IP addresses of the two VMs are listed in the original post.
I suspect that the NAT or bridge adapters in the Windows VM are not working properly because they are given IP addresses that are on the host adapter subnet. The host adapter is working as expected.
I don't believe a bridge adapter is what I want, since the NAT adapter in the Linux VM is working as expected and gives me what I want (a gateway to the local network on my host machine).
scottgus1
Site Moderator
Posts: 20945
Joined: 30. Dec 2009, 20:14
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Windows, Linux

Re: NAT not working for Windows 10 guest on Windows 7 host

Post by scottgus1 »

gbburkhardt wrote:All the IP addresses of the two VMs are listed in the original post.
So the Linux guest's IP address really does end in 'x'? Wow.

Respectfully, you will be spinning your wheels until you know what the various forms of Virtualbox networking do. Did you read the manual? Can you tell us what you think each form does?
gbburkhardt wrote:I suspect that the NAT or bridge adapters in the Windows VM are not working properly

They're working fine for a tremendously large number of other folks, so it must be something on your PC or a setup that you arranged that is causing your troubles.

NAT acts like a house router. It will allow access to the host and the physical network via IP address. Your house router does the same between your local private physical network and the internet.
gbburkhardt wrote:NAT or bridge adapters in the Windows VM . . . are given IP addresses that are on the host adapter subnet.
NATted guests start with 10.0.2.15. Host-Only defaults to 192.168.56.1 on the host, and if DHCP is enabled on the Host-Only, 192.168.56.###'s on the guests. NAT won't give a Host-Only address unless the host operator forces it. Bridged guests get DHCP-served addresses from the physical network router. The only way Bridged can get a Host-Only address is if the physical router is serving the same IP range as the Host-Only, which is very uncommon, or if the Bridged guest's IP address is set statically into the Host-Only IP range. Any of these manual settings will break stuff. Unfortunately we can't tell from here if you have set any manual IP addresses.

Windows guests have a long record of working with NAT, Host-Only, and Bridged* just fine. There must be a misconfiguration, due to mistake or misunderstanding, that is interfering with your guests. Try to get a grasp on the manual's Networking section.

* Bridged does not always work with Wi-Fi, regardless of host or guest OS.
BillG
Volunteer
Posts: 5104
Joined: 19. Sep 2009, 04:44
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Windows 10,7 and earlier
Location: Sydney, Australia

Re: NAT not working for Windows 10 guest on Windows 7 host

Post by BillG »

In the original post, the Linux guest appears to have one NIC set to host only and one to NAT (as stated) but the Windows guest appears to have two NICs both set to host only.

Bridged will only work "out of the box" if the host is on a LAN which has a DHCP server. We have never seen any details of the host networking apart from the host only NIC config.

I think that what the OP really needs is the new NatNetwork setup.
Bill
gbburkhardt
Posts: 5
Joined: 21. Mar 2015, 19:09

Re: NAT not working for Windows 10 guest on Windows 7 host

Post by gbburkhardt »

Look, folks, I'm sorry I was lazy and used 'x' in the IP address, instead of using the actual number. But if you're willing to be a bit forgiving, the information was was listed in the original post. The host adapter address of the Linux guest is 192.168.56.102. And that address can be pinged from the Windows host.

As I stated earlier, the NAT adapter in the Windows guest has an IP address (viz., 192.168.56.100), that's on the same subnet as the host adapter, and makes me think that the NAT designation isn't working for some reason. But there aren't too many options I see in the NAT configuration that could affect that.
nat0.jpg
nat0.jpg (127.89 KiB) Viewed 12713 times
nat1.jpg
nat1.jpg (51.59 KiB) Viewed 12713 times
I don't see any place to set an IP address, and yes, I'd expect the NAT adapter IP address to be 10.0.2.15 or similar.

P.S. I have RTFM. It's always my first line of defense.
scottgus1
Site Moderator
Posts: 20945
Joined: 30. Dec 2009, 20:14
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Windows, Linux

Re: NAT not working for Windows 10 guest on Windows 7 host

Post by scottgus1 »

Computers can go crazy, get a bit wrong due to a stray cosmic ray or alien life form passing through, etc. So it is remoooooooootely technically possible that the NAT IP address could have gotten set by Virtualbox to be in the Host-Only IP range. But if so you're the first time I've heard of such in reading this forum in years. Others may be able to say different.

There aren't any settings in the NAT configuration that could cause such an IP address by user action in the main Virtualbox window guest settings. There might be via command line....

Could you please open the Windows guest's two network adapters and show me the IP address page from each adapter's IPv4 settings? It looks like this:
LAN IP address.PNG
LAN IP address.PNG (39.41 KiB) Viewed 12711 times
Please post a screenshot of the "Internet Protocol Version 4 (TCP/IPv4) Properties" window for each Windows guest Ethernet adapter.

Also, please attach the guest's .vbox 'recipe' file as a zip file because the .vbox extension isn't allowed on the forum, using the Upload Attachment tab under the textbox where you type new posts. You can find the guest's .vbox file by right-clicking the guest in the main Virtualbox window and choosing Show in Explorer. Be sure your host OS is set to show known extensions.

And please open a command window and enter this command:

Code: Select all

"C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" list hostonlyifs
Please paste the output of this command in CODE tags.

Further, could you please explain exactly what computers or guests the Windows and Linux guests are supposed to communicate with? Host? other PC's on the host's physical network? Internet? Are the host or other physical PCs or the internet supposed to be able to access shared folders, web servers, etc. on the guests?
gbburkhardt
Posts: 5
Joined: 21. Mar 2015, 19:09

Re: NAT not working for Windows 10 guest on Windows 7 host

Post by gbburkhardt »

Nat adapter:
nat-adapter.png
nat-adapter.png (16.57 KiB) Viewed 12681 times
Host Only adapter:
host-only-adapter.png
host-only-adapter.png (16.09 KiB) Viewed 12681 times
I noticed that the NAT adapter was set to fix the IP address to 192.168.56.100. I changed it to "Obtain an IP address automatically", and now everything is working properly. The guest can ping other computer on the local network that the host is on, and DNS lookups for those other computers works.

I have no idea how the IP address got set to a fixed address.

I've attached .vbox and log files anyway.

Thanks for getting me to look at the IPv4 properties.
Attachments
Win10.zip
(40.98 KiB) Downloaded 241 times
scottgus1
Site Moderator
Posts: 20945
Joined: 30. Dec 2009, 20:14
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Windows, Linux

Re: NAT not working for Windows 10 guest on Windows 7 host

Post by scottgus1 »

Sounds like you hit the jackpot! Congrats! Glad things are working now.

FWIW, the .vbox file shows you have a snapshot on your guest, and before that snapshot was taken, your guest has some info in it indicating an attempt to set a static IP on the guest NICs 0 and 1, which include your guest's NAT adapter. I don't know if that data came from setting static IP in the guest OS and got reflected in the .vbox, or if there was some command which sets the static IP from the host, but it was there. But if you have go things going then you should be able to ignore this.
Post Reply