Hi,
it probably will depend on device. But for example ASA can do this with command
crypto isakmp peer {address {ipv4-address | ipv6 ipv6-address} | hostname fqdn-hostname}
and IOS router with this command
crypto isakmp key keystring hostname peer-hostname
Best regards,
Jan