Link-local with fixed IP



Hello together,

is it possible to use a fixed (static?) IP on a network interface when it is configured as "Link-local"?

Let me explain my problem first and the background (Why I want this) after.

I am on a RaspberryOS (Pi4 with two interfaces: LAN and WLAN). Network-Manager is not installed by default so I did it via "apt". Via nmtui I setup the "eth0" with Link-local as you can see on the screenshot [1].

I tried to setup a fixed IP on "eth0" and used the dhcpd.conf for that.

$ cat /etc/dhcpcd.conf
interface eth0
static ip_address=169.245.228.100
noipv6

When I connect another PC (a Win10 Laptop) to "eth0" I can see in the /var/log/syslog that this fixed IP is used at the first step. But after it another random IP is setup. At the end the IP is not overridden but "eth0" got two IPs. I was not aware that this is possible.

2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
    link/ether e4:5f:01:5d:1c:b8 brd ff:ff:ff:ff:ff:ff
inet 169.254.232.113/16 brd 169.254.255.255 scope link noprefixroute eth0
       valid_lft forever preferred_lft forever
inet 169.245.228.100/16 brd 169.245.255.255 scope global noprefixroute eth0
       valid_lft forever preferred_lft forever
    inet6 fe80::e65f:1ff:fe5d:1cb8/64 scope link
       valid_lft forever preferred_lft forever

But from the Win10 PC the Pi is reachable (SSH) only via the second (random) IP. What can I do to setup a fixed IP?

Now let me explain some background because you will ask why I need this. ;) I am not very familiar with network things and also "Link-local" is totaly new for me. But in my understanding it is that what I need for my use case without setting up an DHCP Server on the PI. My use-case is that I want to connect (via "eth0") the Pi headless(!) to a LAN Port of Windows 10 PC. There is no device (router, switch, ...) between the Pi and the Win - only a LAN cable. There is absolutely now way to do any network configurations on the Windows machine! It is setup to listen on every DHCP by default. No way to change that!

But I found out that the Windows machine takes an IP address when the "opposite machine" (the Pi on the other end of the LAN cable) is setup to Link-local. This saves me from setup an DHCP server on the Pi -which I tried but did not succeeded. I think a DHCP server would be overhead because the Pi only connects to this one machine.

Why a fixed IP? As told the Pi is headless. When I connect the Win machine I do not know the IP of the Pi. There is no usual way to find out the Pi's IP without doing any network scans. But I also have no monitor on the Pi to look into its log files or network status appletts. Btw: I know that in most situations a Pi is reachable via "raspberrypi.local" by default. This works here on my case. But I do not want to trust on that. I would sleep better when I would have the real IP. The "raspebbrypi.local" did not help me to get the IP behind it because when I ping it I just get a IPv6 look-a-like address back - no IPv4. Even if there is a way to get the IPv4 IP behind "raspberrypi.local" from the Windows machine it would be a workaround because I would have to do it on every connection. I would prefer a static/fixed always known IP.

Btw: As you can see there is also a IPv6 address on "eth0" but I tried to deactivate IPv6 via "noipv6" in dhcpcd.conf; but it is ignored or overridden.

Kind regards

[1] -- <https://debianforum.de/forum/gallery/image/3365/medium>


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]