Problem with static IP address / DHCP

Hi there,

I’m using Mikrotik RB4011iGS+5HacQ2HnD router and a Raspberry PI (with Raspbian) connected to it. I need to assign static IP address (I decided for. 192.168.88.251) to Raspberry. I tried 2 ways of doing this, without / with partial success:

  1. I set a static lease on DHCP in RouterOS - as seen on screenshot. The problem is that sometimes it works, sometimes it stops working. I’m pinging the IP and either I get “Request timeout for icmp_seq…” or “ping: sendto: Host is down” error. Lease status remains “Offered”.
    CleanShot 2020-09-27 at 10.06.12.png
    CleanShot 2020-09-27 at 10.08.42.png
    CleanShot 2020-09-27 at 10.10.14.png
  2. I removed static lease on DHCP and set static IP in raspbian in
/etc/dhcpcd.conf

:

interface wlan0
static ip_address=192.168.88.201/24
static routers=192.168.88.1
static domain_name_servers=192.168.88.1

This worked much better, but despite that partial success, 1-2 times per week the raspberry disconnects and doesn’t connect again - I don’t know why. When I restart router it works again.

I’m struggling with this problem one month. Could anybody give me an advice what to try / how to set it / how to get it working? Thanks a lot.

How exactly did you configure static lease via GUI? It is quite easy to miss something (DHCP server logs mention offering address 192.168.88.246 which is not what you configured). The easiest way is to let device obtain lease from dynamic pool, then find it on lease list, click “make static” and then edit lease to change address to intended one. Next time device wants to renew the lease it will get the right address.

But your final observation about connection instability even when setting IP address statically on Raspi indicates you have problem with wireless link stability. There are numerous possibilities, including: a) AP’s signal at Raspi is too weak, b) wireless signal is disturbed due to interference (possibly other APs nearby), c) wireless signal is too strong (if Raspi is really close to AP).

Last, but not least: upgrade ROS to latest long-term version (currently 6.46.7).