The Genealogy of Rama (ancestors as well as descendants) is found in Book IV of Vishnu Purana, the Shrimad Bhagavatam and the Brahma Purana.
Chapter 1 of Vishnupurana mentions that Brahma created Daksha out of his thumb. Daksha had a daughter Aditi, who was mother of Sun. From the Sun was born Manu. Since the Sun-god was Manu's father, his lineage came to be known as the Suryavansha(the descendants of Sun).
Manu had many sons of whom 50 perished quarreling with one another. Ten sons survived, one of whom was Ikshvaku. The Brahma PuranaChapters 7 and 8) provides details on Manu's 10 sons and their descendants as follows:
Ikshvaku
Nriga
Dhrishta - also called Rishta. He ruled over Dharstika. His son was first a Kshatriya and then became a Vaishya. Subsequently, he became a Brahmin.
Saryati - He had twins, Anarta and Sukanya. Anarta's country was Anarta with Kushasthali as its capital. Anarta's son was Raiva and grandson was Raivata. Raivata's son was Kakudmin. Kakudmin returned after a few Yugas to Kushasthali and found it changed to Dvaravati, ruled by Yadavas. He gave his daughter Revati(aka Samudra) in marriage to Baladeva and retired to asceticm.
Narishyanta - Narishyanta had a son named Yama and grandson named Dhandhara. Narishyanta's sons were the Sakas.
Pransu - Pransu's son was Prajapai.
Nabhaga - He had a son named Ambirasa who was first Kshatriya and then became Vaishya. Subsequently, he became Brahmin.
Nideshta
Karusha - His sons Karushas became Kshatriyas.
Prishadhra - He hurt his teacher's cow and hence was cursed to become a Shudra.
Manu also had a child named Ila(aka Sudyumna) who gave birth to Pururavas after intercourse with Budha, the son of Soma. Pururavas was the first king of Aila dynasty or the Somavamsha/Chandravansha.
Rama was born in Ikshvaku's line. The lineage from Ikshvaku to Rama is as follows:
Ikshwaku - Manu's successor was the founder of the Ikshvaku dynasty. Ikshwaku fathered 101 children of whom most illustrious were Vikukshi, Nimi and Danda. Ikshvaku's 50 children were protector of northern countries while 48 were prince of southern countries. Nimi was ruler of Mithila region and started the kingdom of Janaka. After death of Ikshwaku, his son Sasada succeeded him. According to Jain sources, Ikshvaku was Rushabdev.
Sasada - Named Vikuksi at birth, he was called Sasada after eating Hare-meat meant for a rite himself(Sasada means Hare-eater). Though abandoned by Ikshvaku, he became the successor due to Vasistha. Vikuksi had 500 sons who guarded northern regions led by Shakuni and 58 sons who guarded southern regions led by Visati. The Brahma Purana says Sasada's son was Kakutstha and Kakutstha's son was Prithu. However, Vishnu Purana says Sasada's son was Puranjaya(Paranjaya in Shrimad Bhagavatham) and Puranjaya's son was Prithu. From Puranjaya / Kakutstha and Prithu the lineage is as follows:
Puranjaya(Vishnu Purana) and Shrimad Bhagavatham / Kakutstha(Brahma Purana)
Prithu
Andra
Yuvanasva
Srasvata - He founded the city of Srasvati.
Brihadasva(also spelled Brihad-Ashwa).
Kuvalaysva - He defeated demon Asura Dhundu. His sons(21000 in number) perished except three - Dridhasva, Chadrasva and Kaplisva. Haryasva, the eldest son of these three succeeded to the throne.
Dridhasva
Haryasva
Nikumbha
Samhatasva - rendered Samhatasva in Brahma Purana. He had 2 sons, Akrasava and Krisasva and a daughter Haimavati whose son was Prasenajit. The Brahma Purana proceeds with the genealogy tables from Prasenajit with the same names as in Vishnu Purana and Shrimad Bhagavatam below. However, since Prasenajit is the son of Haimavati in Brahma Purana, this would make the line to have descended from Haimavati(a female) as per Brahma Purana.
Krisasva - The Vishnu Purana and Shrimad Bhagavatam says Prasenajit was Krisasva's son.
Prasenajit married Gauri. As per Brahmapurana, he had two sons, Yuvanaswa and Mandhata. However, as per Shrimad Bhagavatam and Vishnu Purana, Mandhata was Yuvanasva's son.
Yuvanasva(2) - According to Vishnu Puarana, Yuvanasva had no children, so the sages, took pity on Yuvanaswa and instituted a Yajna to help him procure progeny. One night, Yuvanaswa feeling thirsty and not wanting to disturb anybody, went in search of water. In darkness, he accidentally drank the consecrated water. In the morning the sages found the vessel containing the consecrated water to be empty and pronounced that a mighty son will be born to the queen who has drunk this water. Then Yuvanasva told the sages about he having drunk the water. Accordingly, Yuvanasva conceived a child in his belly. Upon birth of a male child, he was worried as to who would nurse the child. Lord Indra appeared and said - Mam Dhyasti i.e. I would be his nurse, and hence the boy was named Mandhata.
King Mandhata - He married Chaitarathi / Bindumati, daughter of Sasabindu. He is supposed to be a mighty monarch who conquered seven continents and bought them under his dominion. A verse in Vishnu Purna is translated as "From the rising to the going down of the sun, all that is irradiated by his light, is the land of Mandhata* As per Brahmapurana he had 2 sons, Purukutsa and Mukunda; and Trasdasya was the son of Purukutsa. From Purukuta the line follows in the same manner as SB and Vishnu Purana. However, SB and Vishnu Purana provide additional names between Mandhatra and Purukutsa as below:
Ambarisha(son of Yuvanasva)
Purukutsa
Trasadasya(Son of Purukutsa and Narmada). According to Brahmapurana Narmada was Trasadasyu's wife. One Kurusravana is described as the son of Trasadasyu in Rigveda 10.33 and hence Keith supposes that the Kurus existed in the Rg-Veda. It remains a controversy as to whether Vedic literature knows of an enmity between the Kurus and the Pancalas, which we know of in the Mahabharata. Trasadasyu's son was Sambhuti.
Sambhuti
Anaranya - He was supposedly slain by Ravana.
Haryasva
Sumati
Tridhanwan. In Brahmapurana, Tridhanwan is posited as the son of Sambuta and the names in between Sambhuta and Tridhanwan as provided by SB and Vishnupurana are absent.
Thrayaruni
Satyavarta(also known as Trishanku). He was banished by his father Thrayaruni and went to live with Svapakas. He killed Vasistha's cow. Brahmpurana says Vishwamitra made him ascend to heaven with his physical body.
Harishchandra. Also called Traishankava as the son of Trisanku and Satyavadi Harishchandra s he spoke only truth for his entire life time.
Rohitaswa, also called Rohita.
Harita
Chunchu, also spelled Chanchu, Cancu, Chamchu, Campa. Manusmrithi mentions Chenchu who have been explored for their links with the tribe Andhras.
Vinaya
Ruruka
Vrika
Bahu(also known as Bathuka) - His kingdom was overrun by neighbouring tribe of Haihayas and Talajangha. He was expelled to the jungle with his queens where Sage Bhargava gave them shelter. As per Brahmapurana, Bahu was not very righteous. One of his queens, Yadavi, gave birth to Sagara together with poison(gara).
Sagara - Also known as Sagar Chakravarti, he had 60001 sons. Sagara recaptured his father's kingdom and defeated the tribes of Heheya Kingdom, Talajhanghas, Sakas, Pahlavas and Paradas. He shaved off the hair of Sakas halfway, that of Yavanas and Kambojas totally, the Paradas had to wear their hair loose, and the Pahlavas had to wear moustaches. All of the following had to give up recitation; and were deprieved of their Kshatriya-hood and their dharma: Sakas, Kambhojas, Yavanas, Paradas, Konisarpas (Kalasarpas), Mahishakas, Cholas and Keralas. Sagara performed Ashvamedha and the horse disappeared near the coast of the South-eastern ocean. There they found Sage Kapila resting. According to the Vishnu Purana, Sagara's sons killed Kapila. According to the Brahma Purana, Kapila is an avatar of Vishnu and burnt up Sagara's sons and spared 4 of them—Barhiketu, Suketu, Dharmaratha, Panchananda. Then Kapila blessed Sagara, who went on to perform 100 Asvamedhas and begot 60,000 sons. One of the sons, named Panchajana entered the brilliance of Narayana and became King. His son Asmanjasa succeeded him.
Amsumantha - Grandson of Sagara and son of Asmanjasa/Panchajana.
Dilipa
Bhagiratha - Bhagiratha bought the river Ganges to earth from Heaven.
Sruta
Nabhaga
Ambarisha(2)
Sindhudwipa
Ayutayu
Rituparna, a friend of Nala.
Sarvakama
Sudama, supposedly a friend of Indra.
Saudasa(also known as Mitrasaha, Kalmshapada and Kamlasapada Saudasa).
After Saudasa, the Brahmapurana gives the descent until Raghu as follows:
Saudasa
Sarvakarman
Anaranya
Nighna
Anamitra and Raghu
Dulidaha, the son of Anamitra
Dilipa
Raghu
After Saudasa, the Vishnupurana gives the descent until Raghu as follows:
Saudasa
Asmaka
Mulaka - (also derogatorily called Narikavacha(one who uses ladies for armour) since he was surrounded and concealed by women when his enemies came searching for him). In present times Mulaka is (1) name of a jangam tribe in Andhra Pradesh that claims to be Kapus/Balijas; and (2) alternate name used by Mulukanadu Brahmins
Satharatha
Ldabida (or) Viswasaha
Dilipa(2) (or) Khatvanga
Deerghabahu
Raghu
After Raghu, all the puranas give the descent as follows:
Aja, son of Raghu.
Dasharatha - He was father of Rama.
Rama
The Genealogy of Rama is provided in the Ayodhya Kanda of Valmiki Ramayana as follows:
Brahma
Marichi
Kashyapa
Vivasvan, the Sun-God, Surya
Manu
Ikshvaku
Kukshi
Vikukshi(Sasada)
Bana
Anaranya(Anenas)
Prithu
Trishanku
After Trishanku the Valmiki Ramayan continues with Yuvanasva as below:
Yuvanasva
Mandhata
Susandhi. He had 2 sons Dhruvasandhi and Prasenajit.
Bharata, born to Dhruvasandhi
Asita - Haihayas, Talajanghas and Shashibindavas became his enemies and drove him away. Asita became a Sage and took asylum in the Ashrama of Rishi Chyavana(a Bhrigu descendent). Asita's wife Kalindi gave birth to Sagara together with the poison that she was given to destroy her foetus.
Sagara - excavated the ocean
Asamanjasa - banished by his father Sagara for wrongdoings. Asamanjasa's son Amshuman succeeded him.
Amshuman
Dilipa
Bhagiratha
Kakutstha - his sons were called Kakutsthas. In the line of Kakutsthas was born a son called Raghu, from whence sprang the Raghavas.
Raghu
Kalmashapada - he is also known as Purushadaka, Pravriddha and Soudasa.
Shankhana
Sudarshana
Agnivarna
Shighraga
Maru
Prashushruva
Ambarisha
Nahusha
Yayati
Nabhaga - had 2 sons Aja and Suvrata.
Dasharatha, son of Aja
Rama
The lineage of Rama starting from him is as under:
Rama and Sita had two sons, Kusha and Lava
Kusha married a Naga princess and held sway over Dakshina Kosala that roughly corresponds to present day Chhattisgarh.
Atithi
Nishadha
Nala
Nabhas, also known as Nabha
Pundarika
Kshemadhanwan, also spelled Kshemadanvan
Devanika
Ahinagu or Ahinaga, which the Shrimad Bhagavatam renders as Ahina Alternate Pali sources mention that Ahinaga, te King of Ayodhya was one of the Naga Kings ruling with great power and majesty who was converted to Buddha's faith. Ahinaga is also portrayed in Buddhist literature as an initial adversary of Buddha and sometimes as Vritra or as a descendent of the Vedic Ahi-Vritra. However, this version does not coroborrate with the version given by Bhavishya Purana where Gautama Buddha is born in the line of Brihadbala as mentioned in the tables below. Bhandarkar mentions pre-Buddhist literature which tells that there were four families of the Ahi(Naga) kings around the regions of Kampilya, while making mention that in the Mahabharat, Bhishma and Krishna stayed with the Sarpa and Naga families for sometime. Ahinaga's son was Pariyatra.
The Brahma Purana gives the descent from Ahinaga to Vajranabha as follows:
Ahinaga
Sala
Ukhya, also known as Uktha
Vajranabha - had a son named Nala.
The Vishnu Purana gives the descent from Ahinaga to Vajranabha as follows:
Ahinaga
Paripatra, also rendered as Pariyatra.
Dala
Chhala, also rendered as Bala and Vacchala. The Shrimad-Bhagavatam calls him Balasthala.
Uktha, also known as Ukhya
Vajranabha-In The Shrimad Bhagavatam, Vajranabha is listed as the son of Balasthala.
From Vajranabha to Brihadbala the genealogy given by the Vishnu Purana differs from the one given in the Shrimad-Bhagavatam. Vishnu Purana provides the genealogy as follows:
Vajranabha
Sankhanabha
Abhyutthitaswa
Viswasaha
Hiranyanabha - He was pupil of Sage Jaimini and is considered to be a Sage King. He communicated the knowledge of spiritual exercises to Yajnavalkya.
Pushya, also known as Pushpa.
Dhruvasandhi
Maru
Prasusruta
Susandhi
Amarsha
Mahaswat
Visrutavat
Vrihadbala - Brihadbala was the last king in this dynasty. He was killed in battle by Abhimanyu, son of Arjuna.
The Shrimad-Bhagavatam gives the genealogy from Vajranabha to Brihadbala as follows:
Vajranabha - said to have been born from the effulgence of the sun-god.
Sagana
Vidhriti.
Hiranyanabha, who became a disciple of Jaimini and became a great acarya of mystic yoga. It is from Hiranyanabha that the great saint Yajnavalkya learned the highly elevated system of mystic yoga known as adhyatma-yoga. His son was Puspa.
Pushya, also known as Pushpa.
Dhruvasandhi
Sudarsana
Agnivarna
Sighra
Maru
Prasusruta
Sandhi, also known as Susandhi
Amarsha, also known as Amarshana
Mahaswat, also known as Mahasvan
Visvabahu
Prasenajit
Takshaka - a Naga king banished by the Pandava, Arjuna, from the Khandava forest.
Vrihadbala - Brihadbala was the last king in this dynasty. He was killed in battle by Abhimanyu, son of Arjuna.
The descendents of Brihadbala is given by the Shrimad Bhagavatam, Canto 9 as follows. Their alternate names as mentioned in the Bhavishya Purana are provided in brackets:
Vrihadbala / Brihadbala. At the beginning of Kali-Yuga Brihadbala was ruling Kosala. He was killed by the Pandava, Abhimanyu.
Brihadrana (Brihatshaya)
Urukriya (Urukshaya)
VatsaVriddha (Vatsavyooha)
Prativyoma (Prativyom)
Bhanu
Divaka. The Bhavishya Purana states Divakara as the son of Prativyoma.
Sahadeva
Brihadasva
Bhanuman (Bhanuratha)
Pratikasva (Pratitashva)
Supratika
Marudeva (Merudeva)
Sunakshatra
Pushkara
Antariksha. There is a variation in the Bhavishya Purana as Antariksha is stated to be descended from Sunakshatra as follows: Sunakshatra -> Kinnarashva -> Antariksha.
Sutapa (Suparna)
Amitrajit (Amitarajit)
Brihadraja (Brihadbhrija)
Barhi (Dharmin)
Kritanjaya
Rananjaya
Sanjaya
Sakya (Shakya)
Suddhoda Shakya. The Bhavishya Purana states that he was Suddodhana, the father of Gautama Buddha and since Buddha abdicated the throne the lineage continued with his son Rahula.
Langala (Rahula) Shakya
Prasenajit (Prasenjit)
Kshudraka (Kshudvaka)
Ranaka (Kulaka)
Suratha
Sumitra.
The Ikshvakus were a coveted line. After Sumitra there were no more sons in the dynasty of the sun-god, and thus the dynasty is said to end. [became matrilineal?, note line starts from female Aditi-Kashyapa]. The following excerpts are mentioned by KR Subramanian in the book "Buddhist remains in Āndhra and the history of Āndhra between 224 & 610 A.D." from page 82-87:
Many south Indian dynasties chose to be associated with them in some form or the other. The Cholas and Gangas claimed descent from them. The Pallava chief of Kanchipuram, Tondaman Ilam Tiraiyan is given a similar pedigree of descent from the Ikshvakus in the Perumbanarruppatai. The Kekeyas of the deccan were proud of their marriage alliance with the Iksvakus. By a Nagarjunakonda inscription, an Ikshvaku princess is said to have married the King of Banavasi, before Banavasi came to be ruled by the Kadambas, and hence the wedding is taken to be with a Bana king. The Satavahanas were linked to Ikshvakus. The Ikshvakus were the most famous family of Andhra-desa, north of Krishna, in the 3rd century CE, and were great patrons of Buddhism.
It has been suggested that the following dynasties were historically Jain Clans: Rashtrakuta Dynasty, Western Ganga Dynasty, Magadha Kingdom, Solankis, Ikshvaku Dynasty, Andhra Ikshvakus and Nanda Dynasty.