5

I have launched Ubuntu16.04 in Oracle virtual box on windows 10 machine. I have used two type of adapters: NAT and Bridge Connection. The ip address on Bridge connection is getting IPv6 address and not IPv4. I have already tried updating preference in /etc/gai.conf file. But this change is not making any difference. Not sure what is happening.

I am connecting over (home or office) wifi.

This is what i am getting when i do ifconfig

osboxes@osboxes:~$ ifconfig
enp0s3    Link encap:Ethernet  HWaddr 08:00:27:9f:b2:ae  
          inet addr:10.0.2.15  Bcast:10.0.2.255  Mask:255.255.255.0
          inet6 addr: fe80::d279:a2f3:ceec:7c63/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:4 errors:0 dropped:0 overruns:0 frame:0
          TX packets:58 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:930 (930.0 B)  TX bytes:6645 (6.6 KB)

enp0s8    Link encap:Ethernet  HWaddr 08:00:27:f1:ae:d5  
          inet6 addr: fe80::1bc:78a1:8d5e:90ab/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:10 errors:0 dropped:0 overruns:0 frame:0
          TX packets:29 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:1083 (1.0 KB)  TX bytes:4363 (4.3 KB)

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:32 errors:0 dropped:0 overruns:0 frame:0
          TX packets:32 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:2386 (2.3 KB)  TX bytes:2386 (2.3 KB)

However, strange part is when i connect over wifi on mobile tethering, i am getting IPv4 for enp0s8

osboxes@osboxes:~$ ifconfig
enp0s3    Link encap:Ethernet  HWaddr 08:00:27:9f:b2:ae  
          inet addr:10.0.2.15  Bcast:10.0.2.255  Mask:255.255.255.0
          inet6 addr: fe80::d279:a2f3:ceec:7c63/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:12 errors:0 dropped:0 overruns:0 frame:0
          TX packets:65 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:1919 (1.9 KB)  TX bytes:7121 (7.1 KB)

enp0s8    Link encap:Ethernet  HWaddr 08:00:27:f1:ae:d5  
          inet addr:192.168.43.175  Bcast:192.168.43.255  Mask:255.255.255.0
          inet6 addr: fe80::1bc:78a1:8d5e:90ab/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:28 errors:0 dropped:0 overruns:0 frame:0
          TX packets:52 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:2751 (2.7 KB)  TX bytes:6492 (6.4 KB)

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:48 errors:0 dropped:0 overruns:0 frame:0
          TX packets:48 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:3402 (3.4 KB)  TX bytes:3402 (3.4 KB)

Please suggest how can i get IPv4 over Wifi connection.

Munish Mehta
  • 151
  • 1
  • 1
  • 2

2 Answers2

1

This thread is old but I figured it might help someone else out there...

I also faced the same issue just now. What I did to fix it was to switch to NAT mode in the server settings and then restart networking on the virtual machine. service networking restart and the just check if it you got a IPv4 address from Virtualbox.

After checking just go into the settings again and switch back to the bridged connection and restart your network on the VM --> service networking restart

Not sure why but this solved the issue for me.

Meintjes
  • 111
  • 4
  • My god.. This does work.. Sounds like a weird workaround, but it solved the problem.. Virtualbox should really look into this issue.. – Haris Apr 17 '20 at 18:21
0

The same happens to me when I change my host connection from Wifi to wired, But I was still using WiFi settings in VirtualBox adapter, I solved this changing the VirtualBox adapter for the name of my wired adapter.

VirtualBox Connections

Goerman
  • 123
  • 6