Find out if the IP address is DHCP or static

im trying to get into c programming (LINUX), what type of ip do I have DHCP or static. Does anyone know how to do this? I retrieve my ip using struct ifaddrs; It would be nice to find out if this structure can provide information. thanks in advance:)

+3
source share
1 answer

This property is not something that you can only infer statically from an IP address.

You can probably make an assumption by indicating that the IP address is in the β€œnon-routable” series (10.xyz or 192.168.xy), but the address can also be assigned manually.

, DHCP- () , IP-.

+5

Source: https://habr.com/ru/post/1790744/


All Articles