FlightAware Discussions

DHCP to Static

Got my Pi’s running fairly sweet but want to make a iP change to make things a bit nicer on my LAN. Currently on DHCP and want to set a Static iP instead. I tried this once before and my feeds just stopped working. Can somebody point me at the best method to reconfigure without screwing things up.

Which image, piaware or Raspbian?

PRETTY_NAME=“Raspbian GNU/Linux 10 (buster)”

Which dhcp client?

pgrep dhcpcd
pgrep dhclient

pgrep dhcpcd = 535
pgrep dhclient = Nothing returned


You can check the current settings:
ip a

Just post what you would add to dhcpcd.conf so you don’t shut yourself out.

Sorry mate. You lost me there. I know what the config is. Just need to know what the best method is to change to static

You use dhcpd to configure the static ip.

As far as I know dhcpd.conf is for when the pi is the server and you might change that to set the parameters for the clients on the network. My dhcp server is my router. Sorry but im just making sure im understanding correctly

No you don’t understand.

dhcpcd is the dhcp client.
But it can easily set a static ip if you configure it for it.

Show current IP:

ip a

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eth0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc mq state DOWN group default qlen 1000
link/ether dc:a6:32:1c:e3:ef brd ff:ff:ff:ff:ff:ff
3: wlan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
link/ether dc:a7:16:1a:e4:c1 brd ff:ff:ff:ff:ff:ff
inet brd scope global dynamic noprefixroute wlan0
valid_lft 828277sec preferred_lft 720277sec
inet6 fe80::d68:8ca:9066:6f03/64 scope link
valid_lft forever preferred_lft forever

So you add this do /etc/dhcpcd.conf

interface wlan0
static ip_address=
static routers=
static domain_name_servers=

The router IP you need to adjust if it’s something different.
route -n should tell you the router IP.

After changing dhcpcd.conf you just:

sudo systemctl restart dhcpcd

Sorry for the delay. Had to go to sons school assembly.

All the above worked a treat and the address changed without impact to my feed. Thankyou

I have tried the same a few times on Stretch but that isnt working,

Solved it. Looked into my router to find that it was set to provide a static iP. Regardless what I did to the pi it was going to get the same address.

@wiedehopf Many thanks for you time. Appreciated

I never assign static IPs in devices because to change IPs one must touch those devices. Instead I make reservations (by mac address) for IP addresses in a router or other DHCP server. Then IP address maintenance for an entire network can be accomplished at a single point - the DHCP server. Another advantage of this method is if a device is moved to another network such as when traveling it will work without configuration changes.