Can't get Nat Network to work

This is for discussing general topics about how to use VirtualBox.
Post Reply
srv1973
Posts: 59
Joined: 16. Jan 2008, 17:57

Can't get Nat Network to work

Post by srv1973 »

Hi all,

I can't for the life of me get the "NAT Network" networking to work for me. See below for details.

Note that if I replace Adapter 1 with one of type "NAT" (instead of "NAT Network"), everything works fine.

Virtualbox 5.1.18
Host: Windows 10 Professional
Host "external IP": 10.17.0.65, netmask 255.255.252.0
Guest: RHEL 6.7
VM Interfaces:
Adapter 1: NAT Network "NatNetwork"
Adapter 2: Host-only Network

Code: Select all

C:\Program Files\Oracle\VirtualBox>VBoxManage.exe list natnets
NetworkName:    NatNetwork
IP:             10.0.2.1
Network:        10.0.2.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

Code: Select all

C:\Program Files\Oracle\VirtualBox>VBoxManage.exe list dhcpservers
NetworkName:    HostInterfaceNetworking-VirtualBox Host-Only Ethernet Adapter
IP:             192.168.56.100
NetworkMask:    255.255.255.0
lowerIPAddress: 192.168.56.101
upperIPAddress: 192.168.56.254
Enabled:        Yes

NetworkName:    NatNetwork
IP:             10.0.2.1
NetworkMask:    255.0.0.0
lowerIPAddress: 10.0.2.100
upperIPAddress: 10.0.2.200
Enabled:        Yes

Code: Select all

> ifconfig -a
eth1      Link encap:Ethernet  HWaddr 00:0C:29:E5:0F:C4
          inet addr:10.0.2.100  Bcast:10.255.255.255  Mask:255.0.0.0
          inet6 addr: fe80::20c:29ff:fee5:fc4/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:2 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:1180 (1.1 KiB)  TX bytes:1272 (1.2 KiB)

eth2      Link encap:Ethernet  HWaddr 08:00:27:54:71:A8
          inet addr:192.168.56.10  Bcast:192.168.56.255  Mask:255.255.255.0
          inet6 addr: fe80::a00:27ff:fe54:71a8/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:52 errors:0 dropped:0 overruns:0 frame:0
          TX packets:63 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:7669 (7.4 KiB)  TX bytes:8822 (8.6 KiB)

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:12 errors:0 dropped:0 overruns:0 frame:0
          TX packets:12 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:920 (920.0 b)  TX bytes:920 (920.0 b)

Code: Select all

> netstat -rn
Kernel IP routing table
Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface
192.168.56.0    0.0.0.0         255.255.255.0   U         0 0          0 eth2
169.254.0.0     0.0.0.0         255.255.0.0     U         0 0          0 eth1
169.254.0.0     0.0.0.0         255.255.0.0     U         0 0          0 eth2
10.0.0.0        0.0.0.0         255.0.0.0       U         0 0          0 eth1
0.0.0.0         10.0.2.1        0.0.0.0         UG        0 0          0 eth1

Code: Select all

> ssh devuser@10.17.0.4
ssh: connect to host 10.17.0.4 port 22: No route to host
I've also tried with changing the DHCP Server network mask to 255.255.255.0, which made the output of netstat -rn look better (i.e. after that change it didn't have the line for 10.0.0.0 anymore), but still no luck (yes, I rebooted the host).

I'm at a loss. Does anybody have any ideas?

Maarten
BillG
Volunteer
Posts: 5106
Joined: 19. Sep 2009, 04:44
Primary OS: MS Windows 10
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Windows 10,7 and earlier
Location: Sydney, Australia

Re: Can't get Nat Network to work

Post by BillG »

I cannot see any evidence that you have ever created a NATnetwork. All I can see is the host only network, and that is not routable.

Read through this recent post and then post back if you still have problems.

viewtopic.php?f=1&t=82686
Bill
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: Can't get Nat Network to work

Post by socratis »

BillG wrote:I cannot see any evidence that you have ever created a NATnetwork.
Actually I believe there is evidence for that:
srv1973 wrote:
VBoxManage list natnets
NetworkName:    NatNetwork
IP:             10.0.2.1
Network:        10.0.2.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

VBoxManage list dhcpservers
NetworkName:    NatNetwork
IP:             10.0.2.1
NetworkMask:    255.0.0.0
lowerIPAddress: 10.0.2.100
upperIPAddress: 10.0.2.200
Enabled:        Yes
Now, on my NATservice, the DHCP server has a .3 address, so I don't know why this one doesn't. Plus the NetworkMask is set to 255.0.0.0.

The other thing is that 10.0.2.0/24 is the default for the NAT network (not the NATservice network), so I'm not sure if there's some interference there. For comparisone, here are mine related information:
$ VBoxManage list natnets
NetworkName:    VBoxNATNetwork
IP:             192.168.40.1
Network:        192.168.40.0/24
IPv6 Enabled:   No
IPv6 Prefix:    fd17:625c:f037:a828::/64
DHCP Enabled:   Yes
Enabled:        Yes
loopback mappings (ipv4)
        127.0.0.1=2

$ VBoxManage list dhcpservers
NetworkName:    VBoxNATNetwork
IP:             192.168.40.3
NetworkMask:    255.255.255.0
lowerIPAddress: 192.168.40.4
upperIPAddress: 192.168.40.254
Enabled:        Yes
My suggestion? Re-create the NATservice network. Accept the defaults.
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.
srv1973
Posts: 59
Joined: 16. Jan 2008, 17:57

Re: Can't get Nat Network to work

Post by srv1973 »

socratis wrote:The other thing is that 10.0.2.0/24 is the default for the NAT network (not the NATservice network), so I'm not sure if there's some interference there.
Actually, when I create a new NatNetwork through the GUI, the proposed defaults are 10.0.2.0/24, so that's a bit strange.

When changing the defaults to your values (192.168.40.0/24), the NatNet is created, but no DHCP server. I've manually created one as:
C:\Program Files\Oracle\VirtualBox>VBoxManage.exe dhcpserver add --netname NatNetwork --ip 192.168.40.3 --netmask 255.255.255.0 --lowerip 192.168.40.100 --upperip 192.168.40.200 --enable
On the host side, things now look like:

C:\Program Files\Oracle\VirtualBox>VBoxManage.exe list natnets
NetworkName:    NatNetwork
IP:             192.168.40.1
Network:        192.168.40.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
C:\Program Files\Oracle\VirtualBox>VBoxManage.exe list dhcpservers
NetworkName:    HostInterfaceNetworking-VirtualBox Host-Only Ethernet Adapter
IP:             192.168.56.100
NetworkMask:    255.255.255.0
lowerIPAddress: 192.168.56.101
upperIPAddress: 192.168.56.254
Enabled:        Yes

NetworkName:    NatNetwork
IP:             192.168.40.3
NetworkMask:    255.255.255.0
lowerIPAddress: 192.168.40.100
upperIPAddress: 192.168.40.200
Enabled:        Yes
Firing up the guest (using ssh over the HostOnly network to connect), I see:
$ ifconfig -a
eth1      Link encap:Ethernet  HWaddr 00:0C:29:E5:0F:C4
          inet addr:192.168.40.100  Bcast:192.168.40.255  Mask:255.255.255.0
          inet6 addr: fe80::20c:29ff:fee5:fc4/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:3 errors:0 dropped:0 overruns:0 frame:0
          TX packets:121 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:1770 (1.7 KiB)  TX bytes:8916 (8.7 KiB)

eth2      Link encap:Ethernet  HWaddr 08:00:27:54:71:A8
          inet addr:192.168.56.10  Bcast:192.168.56.255  Mask:255.255.255.0
          inet6 addr: fe80::a00:27ff:fe54:71a8/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:416 errors:0 dropped:0 overruns:0 frame:0
          TX packets:268 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:34536 (33.7 KiB)  TX bytes:38276 (37.3 KiB)

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:79 errors:0 dropped:0 overruns:0 frame:0
          TX packets:79 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:7780 (7.5 KiB)  TX bytes:7780 (7.5 KiB)
$ netstat -rn
Kernel IP routing table
Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface
192.168.40.0    0.0.0.0         255.255.255.0   U         0 0          0 eth1
192.168.56.0    0.0.0.0         255.255.255.0   U         0 0          0 eth2
169.254.0.0     0.0.0.0         255.255.0.0     U         0 0          0 eth2
0.0.0.0         192.168.40.1    0.0.0.0         UG        0 0          0 eth1
$ cat /etc/resolv.conf
# Generated by NetworkManager
# removed confidential network names etc
domain mydomain
search mydomain
nameserver 10.17.0.4
nameserver 10.17.0.10
nameserver 10.80.49.117
# NOTE: the libc resolver may not support more than 3 nameservers.
# The nameservers listed below may not be recognized.
nameserver 10.80.48.87
$ sudo traceroute -d 10.17.0.4
traceroute to 10.17.0.4 (10.17.0.4), 30 hops max, 60 byte packets
CTRL-C
Still not working... tried various other network operations as well, like nslookup, ssh, wget,...

For completeness, 10.17.0.4 is on the same network as my host (heck, it's on the same switch).

Baffled.
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: Can't get Nat Network to work

Post by socratis »

srv1973 wrote:Actually, when I create a new NatNetwork through the GUI, the proposed defaults are 10.0.2.0/24, so that's a bit strange.
Yes, you're right, I created a new NATservice network, and they're the proposed defaults. I must have changed it to avoid any (imaginary) trouble.
srv1973 wrote:the NatNet is created, but no DHCP server.
The DHCP server is "created" the first time it's needed, so if you'd launched your VM with the NATservice enabled, you would have gotten your DHCP server.
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.
BillG
Volunteer
Posts: 5106
Joined: 19. Sep 2009, 04:44
Primary OS: MS Windows 10
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Windows 10,7 and earlier
Location: Sydney, Australia

Re: Can't get Nat Network to work

Post by BillG »

The ifconfig shows that the NIC now has a 192.168.40.x address, so DHCP is working (although I would have expected 192.168.40.4, not 100). I don't know why the routing table is still showing a route for APIPA addresses (169.254.0 0).

There is certainly something odd going on here. Could you try this with a different vm (perhaps with a different OS) to see what happens? I have never had a problem with natnetwork. I currently have a natnetwork on a Windows 10 guest with three vms and it works exactly like a similar physical network.
Bill
srv1973
Posts: 59
Joined: 16. Jan 2008, 17:57

Re: Can't get Nat Network to work

Post by srv1973 »

BillG wrote:The ifconfig shows that the NIC now has a 192.168.40.x address, so DHCP is working (although I would have expected 192.168.40.4, not 100). I don't know why the routing table is still showing a route for APIPA addresses (169.254.0 0).
I had manually created the DHCP Server, and had set --lowerip 192.168.40.100.
BillG wrote: There is certainly something odd going on here. Could you try this with a different vm (perhaps with a different OS) to see what happens? I have never had a problem with natnetwork. I currently have a natnetwork on a Windows 10 guest with three vms and it works exactly like a similar physical network.
Well I'll be damned. I tried with a Linux Mint 18 VM, same network configuration, and it works perfectly... So what's the deal with my RHEL 6.7 VM? I'll look more into this, at least I've got a working VM to compare with now.
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: Can't get Nat Network to work

Post by socratis »

Try to remove/delete the HostOnly interface.
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.
srv1973
Posts: 59
Joined: 16. Jan 2008, 17:57

Re: Can't get Nat Network to work

Post by srv1973 »

socratis wrote:Try to remove/delete the HostOnly interface.
I did. It's really weird. It's still not working. I'm running my other VM in parallel, netstat -rn output is identical, but on this RHEL6 VM I still get "Destination Host Unreachable".

I think I'm just going to give up on this one and use the NAT (as opposed to NAT Networking) type interface for this RHEL VM.
Martin
Volunteer
Posts: 2562
Joined: 30. May 2007, 18:05
Primary OS: Fedora other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: XP, Win7, Win10, Linux, OS/2

Re: Can't get Nat Network to work

Post by Martin »

Did you make sure that the firewall in your RHEL guest is off?
BillG
Volunteer
Posts: 5106
Joined: 19. Sep 2009, 04:44
Primary OS: MS Windows 10
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Windows 10,7 and earlier
Location: Sydney, Australia

Re: Can't get Nat Network to work

Post by BillG »

What was your reason for using a natnetwork in the first place? The only reason I can think of is to allow file sharing between the vms, but you only appear to have one anyway.
Bill
Post Reply