Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 3552

Raspberry Pi OS • Re: How to setup PI 4 headless with static LAN IP?

$
0
0
I have scripts stored away for the couple of headless Pi4s running bookworm where I use statically assigned IP and DNS, so if I need to rebuild them, I let them initially boot up and get their address via dhcp, use an ip scanner to find the address, then I ssh to them, copy the script down with wget, and run it. e.g.:

Code:

#!/bin/baship add shownmcli connectionsudo nmcli connection modify 'Wired connection 1' ipv4.address 192.168.1.111/24sudo nmcli connection modify 'Wired connection 1' ipv4.gateway 192.168.1.1sudo nmcli connection modify 'Wired connection 1' ipv4.method manualsudo nmcli connection modify 'Wired connection 1' ipv4.dns '1.1.1.1 1.0.0.1'sudo nmcli connection modify 'Wired connection 1' ipv4.ignore-auto-dns yessudo systemctl restart NetworkManagersudo nmcli connection show 'Wired connection 1' | grep dns:

Statistics: Posted by NickJP — Wed Jan 17, 2024 11:04 pm



Viewing all articles
Browse latest Browse all 3552

Trending Articles