4

I currently have my Debian VM using NAT and it is on subnet 10.0.2.x where my host is on 192.168.0.x how can I get my guest on the same subnet as my host?

Host:

Ethernet adapter VirtualBox Host-Only Network #2:

   Connection-specific DNS Suffix  . : 
   Link-local IPv6 Address . . . . . : fe80::b0cd:11de:7c85:f11a%16
   IPv4 Address. . . . . . . . . . . : 192.168.56.1
   Subnet Mask . . . . . . . . . . . : 255.255.255.0
   Default Gateway . . . . . . . . . : 

Ethernet adapter Ethernet 2:

   Media State . . . . . . . . . . . : Media disconnected
   Connection-specific DNS Suffix  . : 

Wireless LAN adapter Wi-Fi:

   Connection-specific DNS Suffix  . : 
   Link-local IPv6 Address . . . . . : fe80::f551:dcf4:fbf5:bf9e%3
   IPv4 Address. . . . . . . . . . . : 192.168.0.11
   Subnet Mask . . . . . . . . . . . : 255.255.255.0
   Default Gateway . . . . . . . . . : 192.168.0.1

Guest:

      eth0      Link encap:Ethernet  HWaddr 08:00:27:03:7c:ec  
           inet addr:10.0.2.15  Bcast:10.0.2.255  Mask:255.255.255.0
           inet6 addr: fe80::a00:27ff:fe03:7cec/64 Scope:Link
           UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
           RX packets:625 errors:0 dropped:0 overruns:0 frame:0
           TX packets:275 errors:0 dropped:0 overruns:0 carrier:0
           collisions:0 txqueuelen:1000 
           RX bytes:572004 (558.5 KiB)  TX bytes:36572 (35.7 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:88 errors:0 dropped:0 overruns:0 frame:0
           TX packets:88 errors:0 dropped:0 overruns:0 carrier:0
           collisions:0 txqueuelen:0 
           RX bytes:36209 (35.3 KiB)  TX bytes:36209 (35.3 KiB)
Nitro
  • 143
  • 1
  • 7
  • Can you please post the output of `ifconfig` from your host and vm machines? – ARG Nov 13 '15 at 22:37
  • Yes no problem. – Nitro Nov 13 '15 at 22:45
  • Did you set the guest networking settings to be in bridged mode? – ARG Nov 13 '15 at 22:51
  • No, I would like to make it on NAT or Host only if possible. – Nitro Nov 13 '15 at 22:53
  • Then I think you might be better off assigning static IPs. I have personally never done that before, but you can read up about it here https://www.vmware.com/support/ws5/doc/ws_net_advanced_ipaddress.html – ARG Nov 13 '15 at 22:58
  • No, really, if you want NAT rather than bridged mode then the VM should be on a different IP subnet. If you want the VM on the same IP subnet as the host, you should use bridged mode. – cas Nov 13 '15 at 23:10

1 Answers1

4

What you describe is the result of having the virtual machine's network adapter in "NAT" mode; in this mode your host machine is acting as a router for your VM.

If you want your VM to be on the same IP subnet as the host machine, the interface must be set in "bridged" mode; this allows network traffic to go seamlessly between the VM and other devices on the physical network.

DopeGhoti
  • 73,792
  • 8
  • 97
  • 133