It is narrated from Sayyiduna Abdullah bin Abbas (may Allah be pleased with them both) that a man came to him, and he asked him: "Who are you?" The man invoked a distant kinship, so he (may Allah be pleased with him) spoke to him with great gentleness and kindness, and said that the Messenger of Allah (peace and blessings be upon him) said: "Learn your lineages and family trees so that through them you may maintain ties with your relatives; for there is no nearness or closeness left in kinship when it is severed, however close the relation may outwardly be, and no distance hinders it when it is kept joined, however distant the relation may be."
This hadith is sahih (authentic).
Hadith Referenceالمطالب العالية بزوائد المسانيد الثمانية / كتاب البر والصلة / 2519
Hadith Gradingمحدثین:إسناده صحيح
Hadith Takhrij«حکم الحدیث المطالب العالیہ محققاً تنسیق د. سعد بن ناصر بن عبد العزيز الشَّثري- مکتبہ شاملہ :قال ابن حجر: صَحِيحٌ . » «أخرجه المستدرك للحاكم برقم: 300، وأخرجه السنن الكبرى للبيهقي برقم: 20648، وأخرجه مسند الطيالسي برقم: 2880»