How to set static IP address on Raspberry Pi OS and other Debian distributions:
In the June 10th 2023 Debian 12.0 Bookworm release, the Debian team has replaced DHCP, and setting a static IP by editing /etc/network/interfaces with nmcli (NetworkManager Command-Line Interface). This change has left many of us Raspberry Pi and other Debian users wondering how to set or change a static IP address. This guide will show how to set a static IP address using nmcli. See HOW TO: Use NMCLI for more nmcli commands and information.
List available connections:
nmcli connection show
Set a static IP address for the connection:
nmcli connection modify <connection_name> ipv4.addresses <static_ip>/<subnet_mask>
Here’s an example of how you would use NMCLI to set a static IP address:
nmcli connection modify "Wired connection 1" ipv4.method manual ipv4.addresses 192.168.0.100/24
Here’s an example of how you would use NMCLI to set a static IP address and Gateway using Cloudflare as a DNS:
nmcli connection modify "Wired connection 1" ipv4.method manual ipv4.addresses 192.168.0.100/24 ipv4.gateway 192.168.0.1 ipv4.dns 1.1.1.1 1.0.0.1
See HOW TO: Use NMCLI for for nmcli commands and information.