Do this.I've had a surprisingly hard time finding an up-to-date answer to how to do this... It was very easy with dhcpcd, but with the nmcli switch It's a whole lot more opaque and much more of a pain to set up. I've seen lots of answers that say the official getting started guide says:
Assign a static IP address
To allocate a static IP address to your Raspberry Pi, reserve an address for it on your router. Your Raspberry Pi will continue to have its address allocated via DHCP, but will receive the same address each time. A "fixed" address can be allocated by associating the MAC address of your Raspberry Pi with a static IP address in your DHCP server.
and that you shouldn't assign a static IP address, but should have your router do it for you, but that's NOT the answer I'm looking for. My Pi *is* going to be the router (and another two as a fixed address wireless to wired bridge), so they absolutely require a static IP address.
Does anyone have a guide or some quick instructions on setting this up with nmcli? Both for wired and wireless connections? Do I have to use a series of nmcli commands too, or is there preferably a set of configuration files that I could change instead like for dhcpcd. That's much easier to set up with Ansible when I inevitably have to rebuild the system or make another.
Thanks in advance!
Code:
sudo nmcli connection modify 'Wired connection 1' ipv4.method manual ipv4.addresses 192.168.1.10/24 ipv4.gateway 192.168.1.1# assumes the local domain is lan and you have a dns at 192.168.1.11sudo nmcli connection modify 'Wired connection 1' ipv4.dns 192.168.1.11 ipv4.dns-search lan# reload to savesudo nmcli connection reload 'Wired connection 1'# down interface followed by up to refresh the interfacesudo nmcli connection down 'Wired connection 1'sudo nmcli connection up 'Wired connection 1'Statistics: Posted by kmacdchap — Tue Dec 09, 2025 11:59 am