i have installed ubuntu server on virtual box. When i execute the "ifconfig" command it shows the info of eth0 and loopback with inet6 address .but i want ipv4 address instead of ipv6 and i am not sure about the network adapter configuration of virtualbox as iam using wifi on my pc. Please help me
As i can guess you did bridge mode for Internet but , your dhcp not providing IP address to your port or you have not enabled networking. so , it showing like this
eth0 Link encap:Ethernet HWaddr e8:11:32:db:1b:a5 inet6 addr: fe80::ea11:32ff:fedb:1ba5/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:68323 errors:0 dropped:0 overruns:0 frame:0 TX packets:51953 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:82498217 (82.4 MB) TX bytes:4621046 (4.6 MB) 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:9075 errors:0 dropped:0 overruns:0 frame:0 TX packets:9075 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:916870 (916.8 KB) TX bytes:916870 (916.8 KB)
Solution: start your network-manager using
sudo service network-manager start
or use if already started
sudo service network-manager restart
sudo ip link set eth0 up
sudo nmcli nm enable true
or enable using GUI
network-manager--> Enable Networking and connect wired connection
if you still face problem then it means your wifi dhcp not providing ip to VM then you can change mode
NAT for internet then you will get private ip and will able to connect internet
Apart from the bridged mode, I had to disable ipv6 as per this post to get it working: https://superuser.com/questions/1146122/ubuntu-virtualbox-guest-does-not-get-ipv4-in-bridged-mode/1148247#1148247?newreg=7c77aaf0882540148a3700242cd05d0b
Pasting the steps from above:
In this file, find this line:
and change it to:
GRUB_CMDLINE_LINUX_DEFAULT="ipv6.disable=1 quiet splash"
Save the file and update GRUB by running:
Now reboot the VM. Next time it comes up with appropriate ipv4 address.
Could you ensure that you have set up your virtual interface with bridged mode?
If you are using a wireless connection, Vbox is not going to support IPv6 in bridged mode as you can see in Vbox manual:
Hope this helps.