nat can ping gw, natnet can't-difference between nat&natnet?

Discussions related to using VirtualBox on Linux hosts.
Post Reply
stoRdo
Posts: 1
Joined: 1. Feb 2016, 23:16
Primary OS: Ubuntu 12.04
VBox Version: OSE Debian
Guest OSses: Kubuntu 14.04, Debian

nat can ping gw, natnet can't-difference between nat&natnet?

Post by stoRdo »

Host: Kubuntu 12.04.5 precise
Guest: Kubuntu 14.04 trusty
virtualbox: 5.0.14 r105127

$ vboxmanage list natnetworks
NetworkName: vboxnet0
IP: 192.168.0.1
Network: 192.168.0.0/24
IPv6 Enabled: No
IPv6 Prefix:
DHCP Enabled: Yes
Enabled: Yes
loopback mappings (ipv4)
127.0.0.1=2

$ vboxmanage list dhcpservers
NetworkName: vboxnet0
IP: 192.168.0.1
NetworkMask: 255.255.255.0
lowerIPAddress: 192.168.0.2
upperIPAddress: 192.168.0.100
Enabled: Yes


If I change a working bridged vm to use nat instead of bridged, IIRC, I get an ip of 10.0.2.15, gw 10.0.2.2, and all works as one would expect. i.e. Much as any physical computer connected to a home router connected to a provider. I can ping the gateway, get out to the net, and so on and so forth.

If I change that adapter to natnet using vboxnet0, I get an ip of 192.168.0.2 and gateway of 192.168.0.1, as expected. But I cannot even ping the gateway.

[I get there may be issues with such a common net as 192.168.0.0/24 (beyond the vbox sw/app itself, that is), but I expected to at least be able to ping the internal gw, as I can under nat (vs natnet). Not getting that far.]

I expected natnet to simply be a separate, named, nat (network). Evidently I am missing or misunderstanding something. Pointers to explanatory links?

How do I get a natnet to behave identically to nat (just in a thus separate, segregated, network)?

Further, is there any interface / any way to control '192.168.0.1'? i.e . Inherently these vm's are being routed via a network 'interface' internal to vbox. Is there any way to change, for example, the default gw? (I have not only my home router, but a separate physical openwrt that maintains an openvpn tunnel. It would be useful to be able to tell vbox to default route out that box instead of the default.)

Thanks for any thoughts.
Perryg
Site Moderator
Posts: 34369
Joined: 6. Sep 2008, 22:55
Primary OS: Linux other
VBox Version: OSE self-compiled
Guest OSses: *NIX

Re: nat can ping gw, natnet can't-difference between nat&nat

Post by Perryg »

Have you read the following in the users manual? http://www.virtualbox.org/manual/ch06.h ... at_service

Also make sure the address you choose is outside the actual address range of your local router or it will conflict.

If you need the scheme to be in the same subnet as the local LAN then use Bridged.
Post Reply