how to obtain ipv4 address of ubuntu server running in virtual box along with ipv6?
Solution 1
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
or
sudo ip link set eth0 up
or
sudo nmcli nm enable true
or enable using GUI
network-manager--> Enable Networking and connect wired connection
or
if you still face problem then it means your wifi dhcp not providing ip to VM then you can change mode bridge
to NAT
for internet then you will get private ip and will able to connect internet
Solution 2
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:
Open /etc/default/grub
In this file, find this line:
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
and change it to:
GRUB_CMDLINE_LINUX_DEFAULT="ipv6.disable=1 quiet splash"
Save the file and update GRUB by running:
sudo update-grub
Now reboot the VM. Next time it comes up with appropriate ipv4 address.
Related videos on Youtube
Akhil Varma
Updated on September 18, 2022Comments
-
Akhil Varma over 1 year
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
-
Akhil Varma over 8 yearscheck this out link
-
Akhil Varma over 8 yearsokay thanks for ur patience!...still the webpage is waiting??