Connecting to Wifi using static IP on BrainyPi Method 1
This method uses Network Manager configuration file, to connect to Wifi using static IP.
Step1 : Configure Network Manager
-
Create a new config file for the Wifi connection, by running command
sudo nano /etc/NetworkManager/system-connections/Wireless1.nmconnection
-
In the configuration file, add the following lines:
[connection] id=Wireless1 type=wifi interface-name=p2p0 permissions= [wifi] mac-address-blacklist= mode=infrastructure ssid=<WIFI_SSID_HERE> [wifi-security] key-mgmt=wpa-psk psk=<WIFI_PASSWORD_HERE> [ipv4] address1=<STATIC_IP_HERE>,<GATEWAY_IP_HERE> dns=<DNS_SERVER_IP_HERE>; dns-search= method=manual [ipv6] addr-gen-mode=stable-privacy dns-search= method=auto [proxy]
Replace the placeholders (<WIFI_PASSWORD_HERE>, <WIFI_PASSWORD_HERE>, etc…) with the appropriate values.
Sample configuration should look like this
[connection] id=Wireless1 type=wifi interface-name=p2p0 permissions= [wifi] mac-address-blacklist= mode=infrastructure ssid=MyWifi [wifi-security] key-mgmt=wpa-psk psk=12345678 [ipv4] address1=10.0.2.110/24,10.0.2.1 dns=1.1.1.1;8.8.8.8; dns-search= method=manual [ipv6] addr-gen-mode=stable-privacy dns-search= method=auto [proxy]
-
Set correct permissions for config file.
sudo chmod 600 /etc/NetworkManager/system-connections/Wireless1.nmconnection
-
Configuration done.
Step2: Apply configuration
-
Restart Network Manager
sudo systemctl restart NetworkManager
-
That’s it! Your WiFi connection should now be using the static IP address you specified in the configuration file.
-
If it does not connect automatically, then run the command,
sudo nmcli con up "Wireless1"