My system is Linux. I use udhcpd tool to build a dhcp server. I want to know what method(static or dhcp) is used for connected device on my linux server How can I do? do have any cmd can reach this goal?
Thank you!!
My system is Linux. I use udhcpd tool to build a dhcp server. I want to know what method(static or dhcp) is used for connected device on my linux server How can I do? do have any cmd can reach this goal?
Thank you!!
You can use the ip
tool. This tells your whether the IP is dynamic
or not.
Below is an example output which shows the keyword dynamic
. This means there was some dynamic process (e.g. DHCP) to fetch the IP.
$ ip address
...
4: wlp3s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
link/ether aa:aa:aa:aa:aa:aa brd ff:ff:ff:ff:ff:ff
inet 192.168.1.184/24 brd 192.168.1.255 scope global dynamic noprefixroute wlp3s0
valid_lft 65779sec preferred_lft 65779sec
In addition you can list all your interfaces/IPs which have dynamic
(or permanent
) IP addresses with e.g. ip address show dynamic
. See also https://manpages.debian.org/unstable/iproute2/ip-address.8.en.html