Skip to content

Instantly share code, notes, and snippets.

@switz
Forked from vfdev-5/Create_a_hotspot.md
Created March 6, 2018 18:23
Show Gist options
  • Save switz/71a7c402d5cc179d16b233ca29a29c52 to your computer and use it in GitHub Desktop.
Save switz/71a7c402d5cc179d16b233ca29a29c52 to your computer and use it in GitHub Desktop.
Raspberry Pi - Ubuntu 16.04 Mate - Wifi automatic connection and static IP in terminal

Notes on how to configure your Raspberry Pi Wifi connection using Network Manager in terminal

Tested on Ubuntu 16.04 Mate armhf installed on RPi 3. nmcli tool, version 1.2.2

TL;DR

  1. Show available wifi:
$ nmcli dev wifi

*  SSID                MODE   CHAN  RATE       SIGNAL  BARS  SECURITY    
*  myconnection        Infra  6     54 Mbit/s  91      ▂▄▆█  WPA2        
  1. Connect to a wifi (and create a new network connection)
$ sudo nmcli dev wifi con "myconnection" password "mypassword" name "myconnection"
  1. Setup manual static IP and automatic connection :
$ sudo nmcli con edit "myconnection"

===| nmcli interactive connection editor |===
...

nmcli> set ipv4.method manual
nmcli> set ipv4.addr 192.168.43.5/24, 192.168.43.7/24, 192.168.43.55/24
nmcli> set ipv4.gateway 192.168.43.1
nmcli> set ipv4.dns 8.8.8.8, 8.8.4.4
nmcli> set connection.autoconnect yes
nmcli> save persistent
nmcli> quit

$ sudo service network-manager restart

$ ifconfig

About

As I understand there are at least two possibilities to achieve to our goal:

  • with /etc/network/interfaces and a related service networking
  • with Network-Manager and using nmcli [2] [3]

Above the second method is described. If you want to proceed with /etc/network/interfaces then read [1] and google. And if you have an access to a monitor, than see [4].

References:

[1] Network Configuration in CommandLine

[2] Configure using NetworkManager

[3] NMCLI manual

[4] How to set up static IP address and why

sudo nmcli dev wifi hotspot ifname wlan0 con-name "my-hotspot" ssid "my-hotspot" password "My HotsPoT Strong Password"

More info here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment