-2

When I do ip addr show show I get this:

3: wlan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group 57841 qlen 1000
    link/ether 2c:cf:67:27:0b:c3 brd ff:ff:ff:ff:ff:ff
    inet 10.0.0.140/24 brd 10.0.0.255 scope global noprefixroute wlan0
       valid_lft forever preferred_lft forever
    inet 10.0.0.243/24 brd 10.0.0.255 scope global secondary dynamic noprefixroute wlan0
       valid_lft 49873sec preferred_lft 49873sec

So it looks like I have two IP addresses? 10.0.0.140 and 10.0.0.243?

The 10.0.0.140 is the static IP address I assigned to the Raspberry Pi 5 by going to the network status icon in the top right and then clicking on Advanced Options -> Edit Connections... -> Wireless -> preconfigured -> IPv4 Settings).

I can (usually) SSH into both IP addresses but, overall, it just seems like a waste, having 2x IP addresses for the same nic. So how can I disable the assignment of this secondary IP address?

neubert
  • 143
  • 6

1 Answers1

1

You can see that the second ip address has the secondary and dynamic flags.

It means that this IP is an alias and that it was dynamically attributed by a dhcp client.

Concurrent dhcp clients ?

You might have a dhcp client running in concurrence with NetworkManager. To find out if you do you can use the following command in a terminal :

pgrep -l dhc

It will list all processes whose name contains 'dhc'.

If you find that you have such processes as 'dhcpcd' or 'dhclient', you can try to terminate this process (via systemctl) to see if the secondary ip is still set.

You should also be able to remove that secondary address manually with nmcli in a terminal (adapting 'Wireless' to your actual configuration name ):

nmcli con mod "Wireless" -ipv4.addresses "10.0.0.243"

but that does not tell us why you get this secondary ip in the first place.

Raspberry pi OS script specific setup

From your question, I suspect you're using Raspberry Pi OS with a graphical environment and used the custom made utility from that to edit your settings.

I am not familiar with this utility but it might be a case of that utility setting things up that way for whatever reason.

We might find ou more if you show us your profile for this connection, which you should find in /etc/NetworkManager/system-connections/, e.g : (One more time, make sure to adapt the profile's name to your case)

sudo cat /etc/NetworkManager/system-connections/wireless.nmconnection

Feel free to post the results of the suggested commands if you struggle to make things work the way you want.

FiguredIT
  • 96
  • 5