S
S
speedvm2020-09-21 10:37:21
Command line
speedvm, 2020-09-21 10:37:21

How to find out if the address is dynamic or static on a machine?

Good afternoon!
There is a locale in which machines on Linux (350-400 pieces) receive ip-addresses using a dhcp server. There was a period of my absence, when the dhcp-server was bent, and the Enikes urgently put up addresses by hand. Naturally, in the best traditions of the genre, no one recorded anything anywhere. There were 25-30 addresses. Almost everyone was found. But from time to time bad addresses slip through the DHCP server. Users by machines have a muzzle to NetworkManager. Through it set up statics.
The question is, how, having access to wheelbarrows via ssh, from the console to determine: a static address at the interface or a dynamic one?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
E
Evgeny Komarov, 2020-09-21
@speedvm

What if so?

ip a show dev %device_name% | grep inet | awk {'print $1 " " $7'}

S
support_alteros, 2020-09-21
@support_alteros

A couple more options, maybe one will fit
1) nmcli con show %eth_con_name% | grep ipv4.method
if just nmcli con show will show list
2) grep -ri bootproto /etc/sysconfig/network-scripts/ifcfg*

V
Valdemar Smorman, 2020-09-21
@smorman

huh
hostname -I | awk '{print $1}'
?
Why $1?
If, for example, there is a virtual machine on the machine, etc., then if you simply execute it, it
hostname -I
will display all the IPs in the local area.
And so it will be the first from the list and it will always be the IP of the machine

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question