This procedure is only with cable, not for wifi
First check that your interface is up with the command “sudo ifconfig” :
If like in this screenshot you do not see an interface named “ethXXX“, you have to start the interface manually.
To found which of eth0, eth1, … your network card is, you can type “dmesg | grep eth”
We see here that the card “Intel Pro/1000” takes the “eth0” interface name. But it’s later renamed to “eth1“.
So our interface here is eth1, to bring it up, simply run “sudo ifconfig eth1 up”.
You may not have an IP Adress automatically like in this screenshot. If it’s the case, simply type “sudo dhclient eth1” to get one with DHCP.
If it doesn’t work, try to directly ping an IP address like google’s dns server 220.127.116.11 with the command “ping 18.104.22.168“. If it works, you probably have a nameserver problem. Simply add the line “nameserver 22.214.171.124” in /etc/resolv.conf
On ubuntu, if your system boots without network in failsafe mode, it will wait a long time for network to be available. In many case, this won’t help much…
Moreover, if you’re trying to do things like kernel compiling and for some reason you can’t see the boot log (including this “Waiting for network configuration” message), you’ll have the impression of being stuck with a bad kernel, but in fact it is just waiting 120 seconds…
Just edit the file sudo vi /etc/init/failsafe.conf and remove all “sleep” instructions. The message will be displayed but it won’t wait any time.
To repair you network problems, you might want to check this post and this post.