No Internet connection for new installation

I am using different distros via VirtualBox. I stumbled on Arch Linux as a natural platform to do that. However, I am having the following issue:

On my non-root account, post-installation…

Attempting to ping -c 3 www.google.com results in “ping:unknown host www.google.com”.

Attempting to ping -c 3 8.8.8.8 results in “Network is unreachable”.

Attempting to sudo pacman -S alsa-utils results in “error: failed retrieving file ” from : Could not resolve host: ” for all files.

I am running a Windows 7 64-bit host and VirtualBox 4.3.28. I have a motherboard with an Intel ethernet NIC (this is the only one connected to my router and the only host OS-enabled adapter), a third-party ethernet NIC, and a WiFi adapter. Network settings in VirtualBox are defaults. Internet works for the host, all other VMs, and for the Arch Linux (2015.07.01) live installation (ping and downloads worked pre-installation).

Here are the exact actions and commands I executed during installation (ignoring my notes). Edit: Pastie redacted the important line (46) xD; it reads “systemctl enable dhcpcd@eth0.service“. These steps were taken from the Arch Linux Beginners’ Guide and Lifehacker.

Original thread

Asked By: Polite Master

||

Make sure your virtual box has a network interface provided to the virtual OS. (Settings > Network > Adapter 1 > Attached to NAT). It is for sure not the only way to do it but it might be the easiest for you.

Also make sure that your that your network adapter is up and uses DHCP. For example the file “interfaces” could look about like that

$ cat /etc/network/interfaces
auto eth1
iface eth1 inet dhcp

Check if you have an IP address using “ifcongfig” (look for “inet addr”)

$ ifconfig 

eth1      Link encap:Ethernet  HWaddr 00:03:2d:23:2d:0f  
          inet addr:10.159.15.214  Bcast:10.159.15.255  Mask:255.255.255.128
          inet6 addr: fe80::203:2dff:fe23:2d0f/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:494587 errors:0 dropped:0 overruns:0 frame:0
          TX packets:423021 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:305034072 (305.0 MB)  TX bytes:77050307 (77.0 MB)
          Interrupt:18 Memory:f7b00000-f7b20000
Answered By: Merlean

I found that eth0 was not the name of my interface. systemctl enable dhcpcd@enp0s3.service solved the problem. Thank you very much.

Answered By: Polite Master