like many programs, chrony just does a reverse-lookup of the IP address, which
results in a FQDN name (only) when a PTR record for the address is available in
DNS.
When you want to have that info you can use the chronyc -n sources command, and
then parse the output to extract the IP addresses and do a reverse lookup on
them,
and get the result with the length that you want.
I use this script to perform such lookups. I saved it as
/usr/local/bin/ip2host and then
you can use: chronyc -n sources | ip2host
Of course it destroys the layout of the output.
Rob
#!/usr/bin/perl -w
my ($ip,$host);
my @fields;
while (<>) {
chomp;
@fields = split /(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})/, $_;
foreach $ip (@fields) {
if ($ip =~ m!^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$!) {
if (defined $cache{$ip}) {
$host = $cache{$ip};
} else {
$host = (gethostbyaddr(pack('C4',$1,$2,$3,$4),2))[0] || $ip;
$cache{$ip} = $host;
}
if ($ip ne $host) {
$ip = $host.'['.$ip.']';
}
}
}
print @fields,"\n";
}
On 2024-06-26 20:37, Mike Hall wrote:
> Info in the /etc/chrony.conf file has IP addresses for the time servers.
> "chronyc -n sources" seems to be providing the IP addresses only.
>
> Should have mentioned in initial post that this version is the current
> RHEL 8 version. -- version 4.5 (+READLINE +SECHASH +IPV6 +DEBUG)
>
> On Wed, Jun 26, 2024 at 2:33 PM Josef 'Jeff' Sipek <[email protected]>
> wrote:
>
> On Wed, Jun 26, 2024 at 14:29:07 -0400, Mike Hall wrote:
> ...
> > Are there any other versions of the command that
> > would provide a full FQDN, and preferably all FQDN names.
>
> Does 'chronyc -n sources' do what you want? See the manpage for a full
> description.
>
> Jeff.
>
> --
> To unsubscribe email [email protected]
> with "unsubscribe" in the subject.
> For help email [email protected]
> with "help" in the subject.
> Trouble? Email [email protected].
>
>
>
> --
> Michael "Mike" Hall, Sr.
> Cell: 410-370-5901