On this page

How-to

Connect to the internet, by cable or Wi-Fi

Check that your server is online, and connect it by network cable or Wi-Fi: with the network icon on a computer with a desktop, or with commands in the terminal on one without. At the end, the server can reach the internet and you are ready to run the Run first script.

Before you begin

Check whether the server is online

  1. Enter this command and press Enter:
ping -c 3 debian.org
  1. Read what it prints: - Lines that end in a time, such as time=14.2 ms, and "0% packet loss": the server is online. You do not need the rest of this page. - "Temporary failure in name resolution" or "Network is unreachable": the server is not online. Follow the section for your connection in this article.

Connect with Wi-Fi on a desktop

On Linux Mint and on Raspberry Pi OS with the desktop, the network icon shows the Wi-Fi networks nearby.

  1. Select the network icon: in the panel on Linux Mint, in the taskbar on Raspberry Pi OS.
  2. Select your Wi-Fi network's name.
  3. Enter its password and select Connect. On Raspberry Pi OS, select OK.
  4. When the icon shows the Wi-Fi signal, the computer is online. It connects by itself every time it starts.

To check from a terminal, use the ping command in Check whether the server is online.

A cable is faster and more reliable than Wi-Fi for a server.

  1. Plug the cable into the server and into your router.
  2. Wait 10 seconds, then check again with the ping command. Most systems connect a cable by themselves.
  3. Debian with no desktop, if it is still not online: Debian sets up only the network it saw while it was being installed. List the server's network connections:
ip -br link

The cable's connection has a name such as enp3s0 or eno1: not lo, and not a name starting with wl, which is Wi-Fi. 4. Add it to Debian's network settings, with your connection's name in place of enp3s0 in both places. It asks for your password:

printf 'allow-hotplug enp3s0\niface enp3s0 inet dhcp\n' | sudo tee -a /etc/network/interfaces
  1. Start it, again with your connection's name:
sudo ifup enp3s0
  1. Check again with the ping command.

Connect with Wi-Fi in the terminal on Linux Mint or Raspberry Pi OS

These use a program called NetworkManager, which you control with the nmcli command. On Raspberry Pi OS Lite, sudo raspi-config also sets up Wi-Fi, under System Options then Wireless LAN.

  1. List the Wi-Fi networks the server can find:
nmcli device wifi list
  1. Connect to yours, with its name in place of My network. Keep the quotes:
nmcli --ask device wifi connect "My network"
  1. When it asks for the password, enter it and press Enter. Nothing appears as you enter it.
  2. Check again with the ping command. The server connects by itself every time it starts.

Connect with Wi-Fi in the terminal on Ubuntu Server

Ubuntu Server keeps its network settings in a file. If you set up Wi-Fi while installing Ubuntu, it is set up already.

  1. Find the Wi-Fi connection's name. It starts with wl, such as wlan0 or wlp2s0:
ip -br link
  1. Open a new settings file. It asks for your password:
sudo nano /etc/netplan/60-wifi.yaml
  1. Enter these lines, with your connection's name, your network's name and its password in place of wlan0, My network and my-wifi-password. The spaces at the start of each line matter: use spaces, not Tab:
network:
  version: 2
  wifis:
    wlan0:
      dhcp4: true
      access-points:
        "My network":
          password: "my-wifi-password"
  1. Save the file: press Ctrl and O, then Enter, then Ctrl and X to close it.
  2. Keep the password private to the administrator, then apply the settings:
sudo chmod 600 /etc/netplan/60-wifi.yaml
sudo netplan apply
  1. Check again with the ping command in Check whether the server is online.

Connect with Wi-Fi in the terminal on Debian

A minimal Debian has no Wi-Fi tools unless you set up Wi-Fi while installing it. Connect a network cable for now, with Connect with a network cable, then install NetworkManager:

sudo apt install network-manager

After that, follow Connect with Wi-Fi in the terminal on Linux Mint or Raspberry Pi OS. Keep the cable plugged in until Wi-Fi works.

Things to note

  • For a server, a network cable is better: Wi-Fi is slower, drops out more often, and can slow down films that are playing on other devices.
  • Give the server the same address every time, so your bookmarks keep working. Most routers call this an address reservation or a static lease.

If it does not work

  • ping works with 1.1.1.1 but not with debian.org: the server is online but cannot find the addresses for names. Restart it and try again; if it still fails, check the DNS setting on your router.
  • nmcli: command not found: this Linux does not use NetworkManager. Use the section for your Linux in this article.
  • "No Wi-Fi device found" or no name starting with wl: the server has no Wi-Fi, or its Wi-Fi needs extra files. Use a network cable.
  • "Error: Connection activation failed: Secrets were required": the password was not right. Run the connect command again and enter it carefully.

Find out more

This page on GitHub, where the help is written.