Connect to network RPi with Ubuntu

Computers like Raspberry Pi (RPi) can be connected to a network – to provide them an access to the Internet or connect to them remotely. This article describes how network connections can be configured on RPi with Ubuntu Mate 15.10 with GUI tools and in terminal mode.

Wired network connection

The easiest way to get connected to a network is using a network cable. Wired connection  usually does not require configuration and normally starts working when it is connected.

Default network interfaces contain: Local Loopback and wired network interface (later – to connect via network cable).
Command ifconfig shows existing network interfaces and its parameters



enx” is a prefix of wired network interface name, followed by MAC address. MAC address also presented by “HWaddr” (“hardware address”). In many articles and manuals interfaces have names eth1 or wlan0Predictable Network Interface Names.

hint Raspberry Pi 3 has build-in Wi-Fi adapter

Wireless network interface name of RPi 3 is wlan0


Connect the network cable to the wired network port and to the router. Run ifconfig to check the state of the network interfaces



The IP address was assigned to the wired network interface. Try to ping it from another computer connected to the same network



When remote computer is not connected to network with specified IP – ping reports “Destination Host Unreachable” (actually its possible to decline the request of ping with special settings, when needed, so ping is not always works)


If the router is connected to the Internet – RPi should have an access to the internet as well.

Wireless network connection

Plug-in to the RPi USB port a Wi-Fi adapter (also known as “Wi-Fi USB dongle”).

Connect to Wi-Fi network with GUI list of network connections

When RPi is connected to the wired network – the particular icon is shown (and notification when mouse hovers over this icon)


Unplug the network cable from the wired network port – the wireless network icon is shown. While RPi is not connected to any Wi-Fi networks – the icon is empty


Click with the left mouse button on the network icon to invoke the menu with a list of available Wi-Fi networks and click on the item with the name of preferred one (in this example myWiFiNet)


Enter the password in the “Wi-Fi Network Authentication Required” and hit on “Connect” button


Wait while the connection is established – network connection icon is changed


Click on the network connection icon invokes the menu with available Wi-Fi networks and some network operations


Command ifconfig shows a status of Wi-Fi network interface with an IP address assigned to it


Connect to Wi-Fi network with GUI tool Network Manager

Click with the right mouse button on the network icon to invoke the menu and click on the item ¨Edit Connections…¨


The dialog of the tool Network Manager is shown. Click on the button ¨Add¨ to create a new connection


Select “Wi-Fi” in the “Choose a Connection Type” dialog and click the button “Create…”


Enter some connection name for and type Wi-Fi connection name in the field “SSID”


hint Specify Wi-Fi adapter for connection

Particular adapter can be specified for the connection – select it from the list “Device MAC address”


On the tab “Wi-Fi Security” select required security type (usually “WPA & WPA2 Personal”) and type the password


Leave other parameters as is (e.g. on the tab “IPv4 Settings” leave “Automatic (DHCP)” to get IP automaticlly) and hit the button “Save”


If buttons on the Network Manager dialog are disabled (“grayed”)  – run the Network Manager from the terminal with sudo permissions

sudo nm-connection-editor
Direct connection Raspberry Pi and computer via network cable

Connection RPi to computer via a router reduce the speed of data-transfer. To connect RPi to a computer with network cable – change settings in wire network connection. Open the Network Manager, select a wired network connection  and hit the button “Edit”


In the tab “IPv4 Settings” select Method “Shared to other computers” and hit the button “Save”


Now plug the network cable to wired network ports of RPi and the computer. Check IP with the commang ifconfig. Notice the IP address is very different then in case of connection to a router


hint Data transfer speed examples

Copy of 522MB file from RPi to a computer (PC) with command scp (“secure copy”). In parallel system-monitor GUI was shown remotely from RPi (run command mate-system-monitor over SSH connection with option “-X”)

RPi -> network cable -> PC (direct connection between RPi and PC)



RPi -> network cable -> router -> Wi-Fi -> PC



RPi -> Wi-Fi (adapter #1) -> router -> Wi-Fi -> PC



RPi -> Wi-Fi (adapter #2) -> router -> Wi-Fi -> PC



RPi -> Wi-Fi (adapter #2) -> router -> network cable -> PC (without transferring system-monitor GUI remotely)


RPi -> Wi-Fi (adapter #2) -> router -> Wi-Fi -> PC (without transferring system-monitor GUI remotely)


Last two cases show not much difference.

Connect to Wi-Fi network in terminal mode
Create the connection with nmcli tool

Find the wireless interface name using ifconfig



wlx” is a prefix of wireless network interface name, followed by MAC address. Second plugged Wi-Fi adapter adds one more network interface


nmcli tool (“network manager client”) allows to check, add, delete, modify wireless connections (examples).

Find an available wireless network (option “d” stands for “device”, “dev” or “device” can be used as well)

nmcli d wifi list


Create a new connection for Wi-Fi network for Wi-Fi adapter – following two commands (separated with “&&”) adds the connection and also modifying its security settings to WPA-PSK

sudo nmcli c add con-name myWiFiNetConnection type wifi ifname wlx002401098bd4 ssid myWiFiNet && sudo nmcli c modify myWiFiNetConnection wifi-sec.key-mgmt wpa-psk

Start-up the created wireless connection and enter the requested password – this password will be stored in the connection parameters file

sudo nmcli --ask c up myWiFiNetConnection

Check that a file with connection settings has been created in the folder /etc/NetworkManager/system-connections

sudo ls /etc/NetworkManager/system-connections
sudo cat /etc/NetworkManager/system-connections/myWiFiNetConnection


Wait while wireless connection is established – it gets an IP address (check with ifconfig). If it is not connected – try to reboot the RPi or unplug the network cable from RPi, if it is connected.

Potential issues

  • When Wi-Fi adapter is replaced with another one – the existing connection would not work with this new adapter, because the network interface’s names contain their MAC addresses and created network connections bound to these unique interface names. In such case – a new similar connection can be created with another name – this allows to have connections for multiple Wi-Fi adapters.
  • When a network connection is created with Network Manager GUI tool, most likely it sets property permissions=user:user-name; Such connection is not started-up before this user user-name is not logged (in terminal mode as well). In such case – open the file with connection settings and remove the permissions.
Alternative solutions of terminal mode connections

Following approaches were tried but did not work well.

1. Specify network settings in the file /etc/network/interfaces  and use command dhclient wlan0

auto wlan0
iface wlan0 inet dhcp 
      wpa-ssid <network-ssid>
      wpa-psk <network-password>

2. Use console tool wicd and wicd-curses

sudo apt-get install wicd wicd-curses

3. Component wpa_supplicant implementing WPA key negotiation to provide improved layer of security for wireless networks.




Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.