Starting network connection from Ubuntu recovery?

Solution 1:

Do you normally get your IP address from DHCP server ?

$ ifconfig eth0 up 
$ sudo dhclient eth0

To set IP address you want (for example 192.168.0.1) type:

ifconfig eth0 192.168.0.1 netmask 255.255.255.0 up
route add default gw GATEWAY-IP eth0

If you have a problem with gdm during the boot, switch to the real console:

Use the Ctrl-Alt-F1 shortcut keys to switch to the first console.

To switch back to Desktop mode (gdm), use the Ctrl-Alt-F7 shortcut keys.

Solution 2:

To start networking, /etc/init.d/networking start should do the trick. I'd say that if Gnome isn't starting, you've got X config problems. If you disable gdm from starting on boot, then you should be able to get to a regular console prompt and do diagnosis from there (check /var/log/Xorg.0.log and so on).


Solution 3:

In newer versions of Ubuntu name resolution does not work via /etc/resolv.conf anymore. Thus you need to do something like

dhclient eno1
systemctl start systemd-resolved

Solution 4:

Step by step with ip

  1. Get the name of the network interface with the ip link command. The name may differ with motherboards. It should be different from lo, the virtual local interface.
# ip link
  1. Assuming the network interface is called eth0, the following command will bring the interface up. This should now be visible when executing the command ip link once more.
# ip link set eth0 up
# ip link
  1. Next, a local IP address needs to be obtained from the router. The second command is again for checking.
# dhclient eth0
# ip addr show dev eth0
  1. Finally, a temporary domain name server (DNS) is required to translate URLs to IP addresses. This can be either the router in the LAN (if previously/automatically properly configured), the DNS of the ISP or —if you still trust them— Google's DNS at 8.8.8.8 This requires editing a system configuration file that normally should not be edited. However, any changes made will automatically disappear when rebooting.
# nano /etc/resolv.conf

Add a line containing, for example:

nameserver 192.168.178.1

Some more helpful commands

Personally, I ended up in this dire situation by replacing an NVidia video card with a much older model. Once the networking established, the following set of commands allowed me to successfully install the proper NVidia card driver.

# update-drivers autoinstall
# update-initramfs -k all -u
# update-grub