I think you are good to go, but can you please rephrase the statement "declared 'static ip' from the Pico is used successfully" and be more specific with exactly how and what command, and how you use it. I know you said it before, you said.Thank you for a series of well informed replies.
As I have said before it is all probably academic in that the declared 'static ip' from the Pico is used successfully.
The only problem MIGHT be that the router still has a DHCP address which has no updates and hence the lease will run out and then what?
I have a program which regularly loses communication every 30 minutes or so. I have solved this by resetting communication every 14 minutes via a timer and all appears well. Now there are many other possible reasons for the program to crash (and it is probably my bad programming as the code has got rather large), but COULD it be the lingering DHCP request? (I really have no idea!)
The router lease time should be somewhere in the DHCP settings. The client is the host that will request an address from the DHCP server (like on boot up), and the server will try to assign the previously used IP address. If this happens before the lease is up, then the lease time resets to zero and starts again. So if your lease is 24 hours (for example), but you reboot a client before that, then it will get that IP address again and the 24 hour count down will begin again. If you don't reboot before 24 hours, the lease expires, but the host will not potentially lose the IP address until it reboots again. Usually it will aquire the same IP address next boot, but not necessarily. The way to avoid all that yet still have the convenience of DHCP, is to make a DHCP reservation. If your DHCP pool is say .100 to .200 you can reserve an unused IP address in that range using the MAC address of the client host adapter. This makes the assumption a reservation is a feature of your DHCP server. Common alternative terms for DHCP reservations include:
Static DHCP
Reserved IP
Fixed Address Allocation
IP Reservation
Address Reservation
Permanent Lease
If you desire not relying on DHCP at all, then simply make your IP address, subnet mssk, gateway router, DNS servers, domain name, host name, WINS server, etc. settings manually (static) and as long as everything is correct, you can communicate with other hosts on your network and the internet (if desired).
In my example, you cannot choose an IP address in the DHCP pool range of .100 to .200, you must randomly pick an unused address of .101 to ..254 or .1 to .99 but usually your router is using .1 , this is all assuming a 24 bit mask, so if you set it up differently by adding or subracting bits, obviously the network address range changes lower or higher.
But don't worry about those subnetting details if you use 255.255.255.0 anyway.
Final note, the client horverst that has a DHCP assignment whose lease is not yet up can issue a DHCP release request to the DHCP server to relinquish and put back into the pool that IP address.
Statistics: Posted by breaker — Wed Jan 24, 2024 7:24 pm