0

Please note this is not a duplicate of How to disable the dynamic IP address after assigning a static IP in Bullseye? this previous problem occurred when a system that was updated from Buster to Bullseye.

I have a new install of Bullseye on Raspberry Pi 3B. It is connected to a TP-Link Archer AX50 router running stock firmware. I had a static IP address setup with the following addition to the file /etc/dhcpcd.conf:

interface eth0
static ip_address=192.168.0.65/24
static routers=192.168.0.1
static domain_name_servers=192.168.0.1

Following the advice of @Seamus, See this answer:

IP address missing from router DCHP table

I removed the last three lines and made the following change.

interface eth0
inform 192.168.0.65

Now I have two IP addresses. The command hostname I and sudo dhclient -vshow:

$ hostname -I
192.168.0.65 192.168.0.146

$ sudo dhclient -v
[sudo] password for sushenjit:
Internet Systems Consortium DHCP Client 4.4.1
Copyright 2004-2018 Internet Systems Consortium.
All rights reserved.
For info, please visit https://www.isc.org/software/dhcp/

RTNETLINK answers: Operation not possible due to RF-kill
Listening on LPF/wlan0/b8:27:eb:f9:be:df
Sending on   LPF/wlan0/b8:27:eb:f9:be:df
Listening on LPF/eth0/b8:27:eb:ac:eb:8a
Sending on   LPF/eth0/b8:27:eb:ac:eb:8a
Sending on   Socket/fallbackreceive_packet failed on wlan0: Network is down

DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 7
send_packet: Network is down
dhclient.c:2446: Failed to send 300 byte long packet over wlan0 interface.
DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 7
DHCPOFFER of 192.168.0.146 from 192.168.0.1
DHCPREQUEST for 192.168.0.146 on eth0 to 255.255.255.255 port 67
DHCPACK of 192.168.0.146 from 192.168.0.1
bound to 192.168.0.146 -- renewal in 2852 seconds.

$ ip address show
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 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether b8:27:eb:ac:eb:8a brd ff:ff:ff:ff:ff:ff
    inet 192.168.0.65/24 brd 192.168.0.255 scope global noprefixroute eth0
       valid_lft forever preferred_lft forever
    inet 192.168.0.146/24 brd 192.168.0.255 scope global secondary dynamic eth0
       valid_lft 4479sec preferred_lft 4479sec
    inet6 fe80::9f8c:f503:5a46:ab25/64 scope link 
       valid_lft forever preferred_lft forever
3: wlan0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000
    link/ether b8:27:eb:f9:be:df brd ff:ff:ff:ff:ff:ff

Note, the TP-Link Archer AX50 assigns dynamic IP addresses in the range of: 192.168.0.100-192.168.0.249.

I don’t want the dynamic IP address 192.168.0.146 assigned to my Pi. However, I only want the 192.168.0.65 IP address. How do I do this without reverting the change?

Edit: Output of systemctl status dhcpcd:

$ systemctl status dhcpcd
● dhcpcd.service - DHCP Client Daemon
     Loaded: loaded (/lib/systemd/system/dhcpcd.service; enabled; vendor preset: enabled)
     Active: active (running) since Thu 2022-03-31 17:22:10 EDT; 2h 30min ago
       Docs: man:dhcpcd(8)
    Process: 416 ExecStart=/usr/sbin/dhcpcd -b -q (code=exited, status=0/SUCCESS)
   Main PID: 490 (dhcpcd)
      Tasks: 2 (limit: 1597)
        CPU: 53min 45.506s
     CGroup: /system.slice/dhcpcd.service
             ├─490 /usr/sbin/dhcpcd -b -q
             └─556 wpa_supplicant -B -c/etc/wpa_supplicant/wpa_supplicant.conf -iwlan0

Mar 31 19:52:59 raspberrypi dhcpcd[490]: eth0: received approval for 192.168.0.65

Thanks

user68186
  • 420
  • 3
  • 13
  • 1
    I just checked, and if you start `dhclient` on an interface that already has a lease, the router offers it the existing address and it accepts it, so my premise was perhaps wrong (answer deleted), all apologies. However, note that `dhclient` does still keep running which may foul things up. You should check post boot that it is not being started for whatever strange reason: `ps -C dhclient`. – goldilocks Apr 01 '22 at 20:36
  • 1
    You can't delete the question (because there is already an accepted answer), and probably shouldn't, even if you can't reproduce the problem there is still some decent information here. WRT close votes, it's because it is about configuring networking apps that aren't unique to the Pi. We have a "gray area" of overlap w/ Unix & Linux and some other bigger exchanges. However, IMO these networking questions are reasonable because the default networking on Raspbian is a customization different from the Debian distro it is derived from, and we are all in the same custom boat here with that. – goldilocks Apr 01 '22 at 21:51

2 Answers2

0

inform only works if you want an IP Address outside the range managed by the DHCP server (and you should really add a CIDR suffix /24).
If this is the only entry you should probably also configure /broadcast_address.

If you want an IP Address within the range managed by the DHCP server you should use request.

IMO request is preferable, but for discussion see How to set up networking/WiFi

systemctl status dhcpcd should show what has happened.

PS I don't use either. I reserve addresses in the router; that way I always get the same IP on the Pi, even if I swap SD Cards between Pi.

Milliways
  • 54,718
  • 26
  • 92
  • 182
  • You may need to release the earlier request. Routers tend to retain allocations for some time (often 24 hours). This can be done by running restarting `dhcpcd -k` but it is probably easier to restart the router. My Archer only takes 60 seconds to reboot. – Milliways Apr 01 '22 at 00:06
  • I use the original format to set a static IP address providing there is no DHCP server or the address is outside of the DHCP server range. I never see secondary dynamic addresses. Important to ensure the address is unique though – SEWTGIYWTKHNTDS Apr 01 '22 at 10:47
  • Indeed the dhclient use was a (perhaps misguided) attempt at diagnosis. – user68186 Apr 02 '22 at 12:28
0
interface eth0
inform 192.168.0.65

This worked for me. I have multiple pies and there was a conflict after upgrading to bullseye.

# Example static IP configuration:   
interface eth0                           
inform 10.0.0.16                         
#static ip_address=10.0.0.16/24
#static routers=10.0.0.1
#static domain_name_servers=10.0.0.1 8.8.8.8   
 
user68186
  • 420
  • 3
  • 13