NAT Network mode internet not working

Discussions about using Windows guests in VirtualBox.
Post Reply
hari001
Posts: 5
Joined: 6. Jan 2020, 16:58

NAT Network mode internet not working

Post by hari001 »

I am using Vbox Version 6.0.4 r128413 (Qt5.6.2) with windows 7 and windows 10 as vm but nat network config is not working for me.
I am not able to access internet on any of the vms but when I am switching to nat/bridge internet is working. can someone pls suggest what I have missed.
--------------------------------------------------------
vbox nat network details:

Code: Select all

C:\Program Files\Oracle\VirtualBox>VBoxManage list natnets
NetworkName:    192.168.15Nat
IP:             192.168.15.1
Network:        192.168.15.0/24
IPv6 Enabled:   No
IPv6 Prefix:    fd17:625c:f037:2::/64
DHCP Enabled:   Yes
Enabled:        Yes
loopback mappings (ipv4)
        127.0.0.1=2 
-------------------------------------------------------
windows 7 VM interface details: [DHCP enabled for Nat Network mode]

Code: Select all

Ethernet adapter Local Area Connection:

   Connection-specific DNS Suffix  . :
   Description . . . . . . . . . . . : Intel(R) PRO/1000 MT Desktop Adapter
   Physical Address. . . . . . . . . : 08-00-27-19-F9-01
   DHCP Enabled. . . . . . . . . . . : Yes
   Autoconfiguration Enabled . . . . : Yes
   Link-local IPv6 Address . . . . . : fe80::XXXXXX(Preferred)
   IPv4 Address. . . . . . . . . . . : 192.168.15.4(Preferred)
   Subnet Mask . . . . . . . . . . . : 255.255.255.0
   Lease Obtained. . . . . . . . . . : Monday, January 06, 2020 6:37:00 PM
   Lease Expires . . . . . . . . . . : Monday, January 06, 2020 10:50:34 PM
   Default Gateway . . . . . . . . . : 192.168.15.1
   DHCP Server . . . . . . . . . . . : 192.168.15.3
   DHCPv6 IAID . . . . . . . . . . . : 235405351
   DHCPv6 Client DUID. . . . . . . . : 00-01-00-01-25-A5-A1-85-08-00-27-19-F9-01

   DNS Servers . . . . . . . . . . . : 192.168.43.1
   NetBIOS over Tcpip. . . . . . . . : Enabled 
---------------------------------------------------------
Host machine Interface details:

Code: Select all

Wireless LAN adapter Wireless Network Connection:

   Connection-specific DNS Suffix  . :
   Description . . . . . . . . . . . : Dell Wireless 1702 802.11b/g/n
   Physical Address. . . . . . . . . : E4-D5-3D-7A-A8-E7
   DHCP Enabled. . . . . . . . . . . : Yes
   Autoconfiguration Enabled . . . . : Yes
   Link-local IPv6 Address . . . . . : fe80::4165:ad58:1347:905d%16(Preferred)
   IPv4 Address. . . . . . . . . . . : 192.168.43.145(Preferred)
   Subnet Mask . . . . . . . . . . . : 255.255.255.0
   Lease Obtained. . . . . . . . . . : Monday, January 06, 2020 6:37:00 PM
   Lease Expires . . . . . . . . . . : Monday, January 06, 2020 10:50:34 PM
   Default Gateway . . . . . . . . . : 192.168.43.1
   DHCP Server . . . . . . . . . . . : 192.168.43.1
   DHCPv6 IAID . . . . . . . . . . . : 635753789
   DHCPv6 Client DUID. . . . . . . . : 00-01-00-01-21-1B-58-2F-E4-D5-3D-7A-A8-E7

   DNS Servers . . . . . . . . . . . : 192.168.43.1
   NetBIOS over Tcpip. . . . . . . . : Enabled 
===================================
Problems which I am facing on guest when trying to use NatNetwork mode.
  • 1. I am not getting internet on guest vms which I believe should work.
    2. I am not able to ping the default gateway 192.168.15.1 on guest machine which I believe should work.
    3. I am not able to ping the DNS ip 192.168.43.1 on my guest machine which is my host machine default gateway IP as per Nat Networking configuration.
Pls let me know if any other info required
Thanks in advance...
Last edited by hari001 on 8. Jan 2020, 16:11, edited 2 times in total.
mpack
Site Moderator
Posts: 39134
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Mostly XP

Re: NAT network internet not working

Post by mpack »

hari001 wrote: windows 7 VM interface details:
C:\Users\Admin>ipconfig /all
...
IPv4 Address. . . . . . . . . . . : 192.168.15.4(Preferred)
...
AFAIK, not a NAT address. Implies that you have overridden the default configuration somehow.

I don't consider myself a networking expert. Perhaps someone else will recognize where you went wrong.
hari001
Posts: 5
Joined: 6. Jan 2020, 16:58

Re: NAT network internet not working

Post by hari001 »

mpack wrote:
hari001 wrote: windows 7 VM interface details:
C:\Users\Admin>ipconfig /all
...
IPv4 Address. . . . . . . . . . . : 192.168.15.4(Preferred)
...
AFAIK, not a NAT address. Implies that you have overridden the default configuration somehow.

I don't consider myself a networking expert. Perhaps someone else will recognize where you went wrong.
===================
IPv4 Address. . . . . . . . . . . : 192.168.15.4(Preferred) is coming as I am using nat network as 192.168.15.0/24. you can find the nat network details in the original question.

IP address is comming correct as per nat network configuration but not sure why I am not able to brows internet.
jorgensen
Posts: 583
Joined: 20. Oct 2009, 01:22
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Windows, LinuxMint

Re: NAT network internet not working

Post by jorgensen »

You are trying to set up a NAT Network that is very difficult and obvious not knowing what you are doing.
For instance using the DHCP server is strange.
The easiest way to get such a network to work is to use standard bridge networking, lock the ip's in the router and disable guest firewalls.
hari001
Posts: 5
Joined: 6. Jan 2020, 16:58

Re: NAT network internet not working

Post by hari001 »

jorgensen wrote:You are trying to set up a NAT Network that is very difficult and obvious you are not knowing what you are doing.
For instance using the DHCP server is strange.
The easiest way to get such a network to work is to use standard bridge networking, lock the ip's in the router and disable guest firewalls.
==========
Thanks for your suggestion Jorgensen but my requirement do not fit in normal bridge networking mode and sorry to disappoint you but I know what I am trying to do lets not discuss about my understanding on networking(or)security. Let focus on the problem which i am facing in configuring Nat Networking mode.

1. I am not able to access internet from guest vms which I believe should work.
2. I am not able to ping the default gateway x.x.x.1 as per nat network configuration.
3. I am not able to ping the DNS ip which is my host machine default gateway IP as per Nat Networking configuration.
4. I am perfectly able to ping dhcp server ip x.x.x.3 as per nat networking configuration.
5. I am perfectly able to ping guest vm to guest vm.

Plz let me know if I need to start some service or configure something to make this work.
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 network internet not working

Post by scottgus1 »

Not really that much on networks myself, but I see a couple things:
(list natnets) Network: 192.168.15.0/24
(guest ipconfig) DNS Servers . . . . . . . . . . . : 192.168.43.1
If I'm right, doesn't the '/24' mean a mask of 255.255.255.0, and that the network can only access network services on 192.168.15.###, and therefore DNS wouldn't be available (third octet .43)? Seems unusual.

Also, the nat network name '192.168.15Nat': Virtualbox has at times had unexpected issues with unusual characters. Could you try without the dots in the Nat network name? like '192d168d15Nat' ('d' stands for 'dot')?

Please make a new Nat network without changing any defaults. It should come up 10.0.2.0/24 with DHCP enabled and no IPv6. Also make a new guest where nothing has been done inside the guest OS's network settings. Leave everything default. Attach this new guest to the new NAT network and see if you get internet.
hari001
Posts: 5
Joined: 6. Jan 2020, 16:58

Re: NAT network internet not working

Post by hari001 »

scottgus1 wrote:Not really that much on networks myself, but I see a couple things:
(list natnets) Network: 192.168.15.0/24
(guest ipconfig) DNS Servers . . . . . . . . . . . : 192.168.43.1
If I'm right, doesn't the '/24' mean a mask of 255.255.255.0, and that the network can only access network services on 192.168.15.###, and therefore DNS wouldn't be available (third octet .43)? Seems unusual.

Also, the nat network name '192.168.15Nat': Virtualbox has at times had unexpected issues with unusual characters. Could you try without the dots in the Nat network name? like '192d168d15Nat' ('d' stands for 'dot')?

Please make a new Nat network without changing any defaults. It should come up 10.0.2.0/24 with DHCP enabled and no IPv6. Also make a new guest where nothing has been done inside the guest OS's network settings. Leave everything default. Attach this new guest to the new NAT network and see if you get internet.
Hello Scottgus1,
I have Tryed changing the natnetwork name to :192d168d15Nat" and the IP to default 10.0.2.0/24 but the problem still the same.

My basic problem is I am not able to ping the default gateway in guest vm.
when I am starting nat network mode it should start the nat router automaticaly but I am asuming that the nat router is not getting started automaticaly and that the reason I am not able to ping nat network mode default gateway (x.x.x.1) in guest vm. if someone can let me know where to configure that in nat network mode it should start working.
jorgensen
Posts: 583
Joined: 20. Oct 2009, 01:22
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Windows, LinuxMint

Re: NAT network internet not working

Post by jorgensen »

Beneath is a guest network setting for a NAT Network with static IP setting (no DHCP server).
I can ping the host network 192.168.1.X from the guest.
I cannot ping the guest from the host, because there is no route to the subnet 192.168.15.X, which has to be added!
This is how it should be, as it is the idea behind NAT networking.
The guest has Internet connection through the DNS setting.

Code: Select all

Connection-specific DNS Suffix  . :
   Description . . . . . . . . . . . : Intel(R) PRO/1000 MT Network Connection
   Physical Address. . . . . . . . . : 08-00-27-6A-F8-55
   DHCP Enabled. . . . . . . . . . . : No
   Autoconfiguration Enabled . . . . : Yes
   Link-local IPv6 Address . . . . . : fe80::11de:2338:bc96:8477%12(Preferred)
   IPv4 Address. . . . . . . . . . . : 192.168.15.110(Preferred)
   Subnet Mask . . . . . . . . . . . : 255.255.255.0
   Default Gateway . . . . . . . . . : 192.168.15.1
   DHCPv6 IAID . . . . . . . . . . . : 302514215
   DHCPv6 Client DUID. . . . . . . . : 00-01-00-01-23-36-7D-56-08-00-27-6A-F8-55

   DNS Servers . . . . . . . . . . . : 192.168.15.1
   NetBIOS over Tcpip. . . . . . . . : Enabled
2020-01-08_10-33-41.png
2020-01-08_10-33-41.png (15.82 KiB) Viewed 37076 times
Trace from guest to host computer.

Code: Select all

C:\Windows\System32>tracert 192.168.1.5
Tracing route to 192.168.1.5 over a maximum of 30 hops
  1    <1 ms    <1 ms    <1 ms  192.168.15.1
  2     1 ms     1 ms     1 ms  192.168.1.5
Last edited by jorgensen on 8. Jan 2020, 12:49, edited 1 time in total.
hari001
Posts: 5
Joined: 6. Jan 2020, 16:58

Re: NAT network internet not working

Post by hari001 »

jorgensen wrote:Beneath is a guest network setting for a NAT Network with static IP setting (no DHCP server).
I can ping the host network 192.168.1.X from the guest.
I cannot ping the guest from the host, because there is no route to the subnet 192.168.15.X, which has to be added!
This is how it should be, as it is the idea behind NAT networking.
The guest has Internet connection through the DNS setting.

Code: Select all

Connection-specific DNS Suffix  . :
   Description . . . . . . . . . . . : Intel(R) PRO/1000 MT Network Connection
   Physical Address. . . . . . . . . : 08-00-27-6A-F8-55
   DHCP Enabled. . . . . . . . . . . : No
   Autoconfiguration Enabled . . . . : Yes
   Link-local IPv6 Address . . . . . : fe80::11de:2338:bc96:8477%12(Preferred)
   IPv4 Address. . . . . . . . . . . : 192.168.15.110(Preferred)
   Subnet Mask . . . . . . . . . . . : 255.255.255.0
   Default Gateway . . . . . . . . . : 192.168.15.1
   DHCPv6 IAID . . . . . . . . . . . : 302514215
   DHCPv6 Client DUID. . . . . . . . : 00-01-00-01-23-36-7D-56-08-00-27-6A-F8-55

   DNS Servers . . . . . . . . . . . : 192.168.15.1
   NetBIOS over Tcpip. . . . . . . . : Enabled
2020-01-08_10-33-41.png
Hello jorgensen,
I am having few questions.
1. which version of virtualbox you are using.
2. are you able to ping Default Gateway . . . . . . . . . : 192.168.15.1 from your guest.
3. are you able to access internet from the guest vm.
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 network internet not working

Post by scottgus1 »

After tweaking things I got the same unpingable gateway & internet that you did, and found the solution.

5.2.28 Windows 7 host on 192.168.0.### ip range,
Windows XP guest, NAT network on manually-changed 192.168.15.0/24 range, DHCP on:
The guest got an IP address of 192.168.15.4, gateway 192.168.15.1, DHCP 192.168.15.3
ping 192.168.15.1, good
ping 192.168.15.3, no < pinging the NAT network DHCP server may not have been implemented on 5.2.#?
ping 192.168.15.4, good
ping host ip address 192.168.0.117, good
ping house network gateway & DNS server 192.168.0.1, good
ping internet 8.8.8.8, good

6.0.14 Windows 10 host on 192.168.0.### ip range,
Windows XP guest, NAT network on manually-changed 192.168.15.0/24 range, DHCP on:
The guest got an IP address of 192.168.15.4, gateway 192.168.15.1, DHCP 192.168.15.3
ping 192.168.15.1, good
ping 192.168.15.3, good
ping 192.168.15.4, good
ping host ip address 192.168.0.116, good
ping house network server ip address 192.168.0.117, good
ping house network gateway & DNS server 192.168.0.1, good
ping internet 8.8.8.8, good

6.1.0 Windows 10 host on 192.168.0.### ip range,
Windows XP guest, NAT network on 10.0.2.0/24 range, DHCP on:
The guest got an IP address of 10.0.2.4, gateway 10.0.2.1, DHCP 10.0.2.3
ping 10.0.2.1, good
ping 10.0.2.3, good
ping 10.0.2.4, good
ping host ip address 192.168.0.250, good
ping house network server ip address 192.168.0.117, good
ping house network gateway & DNS server 192.168.0.1, good
ping internet 8.8.8.8, good

However:
I changed the 6.1.0 host's NAT network address range to 192.168.15.### and restarted the guest. The old 10.0.2.# numbers still came up and the gateway couldn't be pinged. I switched to a new NAT network with 192.168.24.# range, and got a mix of 10.0.2.# and 192.168.24.#. I couldn't ping the gateway or the internet.

I shut down the guest and Virtualbox, waited 30 seconds for the Virtualbox services to clear, then restarted Virtualbox and the guest. The ipconfig /all shows this mix:
IP address 192.168.16.4
gateway 192.168.24.1
DHCP 192.168.16.3
no pings to gateway or internet.

I tried several permutations of disconnecting the guest network cable, shutting down the guest, switching the guest to NAT and back, the IP addresses are all mixed and that the gateway and internet cannot be pinged.

Solution:
Then I found in the main Virtualbox.xml that there are DHCP server entries aside from the NAT network entries and that changing the NAT network IP address setup after the NAT network has been used does not change the associated DHCP server, which causes bad gateway data and so no ping to gateway or internet. < this may be a bug or a not-programmed-for side effect.

Removing the DHCP server entries for each affected NAT network causes a reset of the DHCP server and restored gateway and internet access.

To change a NAT network's IP range after it has been used:

1. Remove all guests from the NAT network. Disconnect the Virtualbox "cable", switch to NAT, leave the "cable" disconnected.

2. Remove the DHCP server for the NAT network. Use this command in a command prompt:
VBoxManage dhcpserver remove --network=<NatNetworkname>
3. Change the NAT network IP range as desired.

4. Reset the guest(s) to the NAT network and connect the "cables".

(It appears that if the NAT network has not been used by any guest, the IP address range can be changed and everything Just Works. But if you change the IP address range after the NAT network has been used, you have to disconnect all guests from the NAT network and remove the associated DHCP server, then reconnect the guests, and you will then be good. (A disconnect & reconnect of the Virtualbox "cable" seems to be the official "recheck the IP configuration" step in my XP guest.)
Post Reply