Velvet Star Monitor

Standout celebrity highlights with iconic style.

updates

Cannot ping Google on VirtualBox with NAT routing set up

Writer Andrew Henderson

I am using VirtualBox right now with NAT. I'm not able to ping It says: "Name or service not known."

Alright, so the problem is with DNS maybe?

Here is my output for ifconfig:

eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet6 fe80::a00:27ff:fe89:3db prefixlen 64 scopeid 0x20<link> ether 08:00:27:89:03:db txqueuelen 1000 (Ethernet) RX packets 3 bytes 1240 (1.2 KiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 22 bytes 2434 (2.3 KiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536 inet 127.0.0.1 netmask 255.0.0.0 inet6 ::1 prefixlen 128 scopeid 0x10<host> loop txqueuelen 1000 (Local Loopback) RX packets 16 bytes 960 (960.0 B) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 16 bytes 960 (960.0 B) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

Ok, so I don't have an IP address for eth0. Maybe that is the problem? But I still don't have one after I try dhclient -r.

Also, maybe I don't understand VirtualBox networking. Why don't I have an interface for wifi? My host machine is only using WiFi and not ethernet.

4

1 Answer

Ok, so I don't have an IP address for eth0. Maybe that is the problem?

Yes, and you don't have DNS servers in resolv.conf either. You need to get both using DHCP.

But I still don't have one after I try dhclient -r.

The -r option tells dhclient to release (give back) any address leases it currently has. It is the opposite of getting an IP address. Instead you want just dhclient eth0 – obtaining a new lease is already the program's default mode of operation.

Also, maybe I don't understand VirtualBox networking. Why don't I have an interface for wifi? My host machine is only using WiFi and not ethernet.

VirtualBox emulates an entire machine, including the motherboard, disks, GPUs, and of course network interfaces. (Mostly by necessity: you can't easily share a random PCI device between two machines; enterprise Ethernet adapters allow this using SR-IOV, but Wi-Fi adapters would additionally need a separate radio and a separate antenna for each machine using it...)

So what you're seeing is not your host machine's Ethernet – it's a virtual Ethernet card, often based on Intel e1000 series. How it is attached to a real network depends on your VirtualBox settings for each VM.

(In "NAT" mode, VirtualBox itself acts like a router and provides DHCP – the VM is in a virtual subnet. Don't be surprised if the IP addresses will be different from your real LAN.)

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy