In Bamidbar 1:18 we read:
They gathered together the entire congregation on the first day of the second month (Rosh Chodesh Iyar) and they were registered by family ancestry according to the house of their fathers…
According to Rashi, B’nai Yisrael brought their genealogical documents as well as witnesses who verified the circumstances of their birth. This applied to each individual, to establish their kinship with the tribe.
Rabbi Yitzchak Zev Soloveitchik asks why these documents and witnesses were only requested here, in Parshat Bamidbar and not when B’nai Yisrael were counted elsewhere. He answers that here, each tribe was counted separately and therefore they needed proof that each person was from that specific tribe.
The Rambam, in Hilchot Melachim 12:3, explains what will happen in the future:
During the days of Melech HaMashiach, when he will be secure in his monarchy, and all of Israel will gather about him, everyone’s genealogy will be clarified by him by means of the Ruach Hakodesh, the Holy Spirit which will rest upon him, as it says, “And he shall sit as a purifier and refiner…” (Malachi 3:3). The Sons of Levi will be the first to be purified, and he will say, “this one has the pedigree of a Kohen, and this one has the pedigree of a Levi.” He will reject those who have no (true) lineage and make them Israelites, as it says, “And the Tirashoso said to them…until a Kohen will arise with the Urim and Tumim.” (Ezra 2:63) You have now learned that those with a pedigree will be confirmed, and lineage will be made known, by means of Ruach HaKodesh. He will not ascertain the ancestry of Israel except regarding which tribe they are from, and inform us that this one is from such and such a tribe and that one is from such and such a tribe.
When B’nai Yisrael left Egypt, the nation was young enough for each person to have a record of which tribe they were from as well as witnesses to confirm their lineage.
Today, after two exiles, it is miraculous that Jews are coming back to Israel but many have lost their genealogy along the way. It is amazing that so many Kohanim and Leviim have held on to their lineage. However, almost everyone else doesn’t know what tribe they are from. It will only be in the days of the Mashiach that we will all know through Ruach HaKodesh which tribe we belong to.
May the time come when all of the Jews will be back in Israel, living on the portions of land which were designated for them in the days of Yehoshua.