Around the year 80 I think, there was a succession war within the Xiongnu. The pretender king fled south into China with his followers. The Han court allowed him to set up his own southern kingdom in the run down Bing province. The southern chief pledged his allegiance to the Han Dynasty. Ever since the Xiongnu provided soldiers to the Han Dynasty and took part in defending the borders. Decades later the Han Dynasty waged campaigns on the steppe to break the power of the northern Xiongnu once and for all. What remained of the Xiongnu on the steppe were chased out by the growing power of the Wuhuan and Xianbei tribes. Where as the southern Xiongnu remained in Bing province south of the Ordos River and gradually began to embrace Chinese culture while maintaining their tribal lifestyle.
During the Yellow Turban revolt there was a similar incident with the Xiongnu in Bing province where their king Yufuluo was usurped by his brother Huchuquan. He and his followers went into China to raid and later joined the Eastern Alliance against Dong Zhuo. After this coalition war he joined with the Heishan mountain bandits, then later joined the warlord and wannabe emperor Yuan Shu. In both cases he was defeated by Cao Cao and chased out until he finally died in 196. His followers went back to Bing province and joined his brother the "Chanyu" Huchuquan. When Cao Cao campaigned against Yuan Shao the Chanyu Huchuquan sided with the latter. After Cao Cao defeat Yuan Shao and his sons the Xiongnu would then submit to Cao Cao. Huchuquan died in 216 and was succeeded by his oldest nephew Liu Bao (the son of Yufuluo).
In 304 when the newly established Jin dynasty lost control of the north it was actually Yufuluo's grandson Liu Yuan who established the Han Zhao Empire. Short lived because it was one of many competing states by that point. It was conquered in 329 by Later Zhao, a state formed by Sinicized peoples of the Jie tribes from the western regions. These were in turn conquered by Sinicized Xianbei and Di tribes in 351 as well as one ethnically Han warlord called Ran Min who literally tried to commit genocide on non-Chinese by executing everyone with beards and large noses in places which he conquered.
To my knowledge there was no free city or republic. Although in Hanzhong a man called Zhang Lu overthrew the governor and established a Taoist theocracy. Decades later he was defeated and killed by Cao Cao.
So the timeline goes:
-184 Yellow Turban rebellion errupts
-189 Emperor Ling dies which prompts He Jin and his sister Empress He to plot against the Eunuch Faction, he orders Dong Zhuo to bring troops in order to seize control of the capital but is assassinated, Dong Zhuo arrives, kills the eunuchs, seizes control of both He Jin's army and Emperor Ling's army and declares martial law, kills Empress He and her son Emperor Shao, places Emperor Xian into power and declares himself regent
-190 several officers and nobles form a coalition against Dong Zhuo and after some defeats he chooses to burn Luoyang and relocate the capital east to Chang'an
-191 the coalition falls apart due to infighting
-192 Dong Zhuo is assassinated, in addition the Yellow Turban revolt is put down in most of the country
-193 Jue Xuan raises 1000 men and proclaims himself emperor and is supported by the warlord Tao Qian, Tao Qian kills Cao Song which leads to his son Cao Cao declaring war on Tao Qian and killing the pretender Jue Xuan
-196 Cao Cao takes control of Emperor Xian and convinces him to relocate the capital to Cao Cao's city of Xuchang, Yuan Shu proclaims himself Emperor of the Zhong Dynasty which leads to a coalition being formed against him and he is defeated and dies in 199
-200 Cao Cao defeats the mega warlord Yuan Shao and then that warlord dies in 202
-208 Cao Cao conquerors most of the north and then heads south and takes Jing province, an alliance between Liu Bei and Sun Quan leads to the Battle of Red Cliff in which Cao Cao is defeated
-215 Cao Cao conquers Liang province in the west and Hanzhong, Liu Bei conquers Yi province (China is now ruled by Cao Cao, Liu Bei and Sun Quan
-216 Cao Cao is made King of Wei by Emperor Xian
-219 Liu Bei takes Hanzhong and proclaims himself King of Hanzhong, Cao Cao allies with Sun Quan and the two move against Liu Bei to take Jing province from Liu Bei
-220 Cao Cao dies, his son Cao Pi forces Emperor Xian to abdicate, Cao Pi proclaims himself Emperor of Wei, Liu Bei proclaims himself Emperor of Han, Sun Quan is made King of Wu by Cao Pi
-222 Liu Bei invades Wu but is defeated by Sun Quan's forces at Xiaoting
-223 Liu Bei falls ill and dies and is succeeded by his son Liu Shan, Cao Pi takes the opportunity and invades Wu but is unable to defeat Sun Quan
-226 Cao Pi falls ill and dies and is succeeded by his son Cao Rui
-228 the chancellor of the Han, minister Zhuge Liang, leads five campaigns north to invade Wei, Cao Rui orders an invasion into Wu which fails, Sun Quan then orders counter attacks north into Wei, which fail to take ground
-234 chancellor Zhuge Liang dies and the general who defended Wei, a man called Sima Yi, is promoted
-239 Cao Rui dies and names his uncle Cao Shuang and general Sima Yi as regents for the baby Cao Fang
-249 Sima Yi successfully purges Cao Shuang and his family now controls the court through influence
-251 Sima Yi puts down a rebellion by Wang Ling but dies soon after, his older son Sima Shi become regent for the 12 year old Cao Fang
-252 Sun Quan dies which leads to a succession struggle between his sons Sun Liang, and Sun Xiu as well as nephew Sun Chen
-254 Sima Shi forces Cao Fang to abdicate and puts his cousin Cao Mao as Emperor of Wei
-255 Sima Shi puts down a revolt by Guanqiu Jian and Wen Qin, Sima Shi then dies and his younger brother Sima Zhao becomes regent
-258 Sima Zhao puts down a revolt by Zhuge Dan and Sun Chen
-260 Emperor Cao Mao attempts to overthrow Sima Zhao but is defeated and forced to abdicate, his great uncle Cao Huan is made Emperor of Wei, Sima Zhao is made Duke of Jin
-263 Sima Zhao conquerors Liu Shan's Shu Han Empire
-264 Sima Zhao puts down revolts by Zhong Hui and Jiang Wei, is made King of Jin
-265 Sima Zhao dies, succeeded by his son Sima Yan
-266 Sima Yan forces Cao Huan to abdicate, Cao Wei Empire is replaced by Jin Empire and Sima Yan becomes Emperor
-280 Sima Yan conquers Wu and unifies China under the Jin Dynasty
-290 Sima Yan dies and is succeeded by Sima Zhong, various revolts carried out by members of the Sima family from 291-307 shake the empire's core
-304 various invasions carried out by barbarians cause the north to be lost by 316, Chinese states are established by the Qiang, Di, Xiongnu, Jie and Xianbei tribes, Jin dynasty gradually pushed into the south past the Yangtze River, a century is spent trying to defend the frontier until a general named Liu Song usurps and established the Liu Song state in the south in 420
304 - 439 Sixteen Kingdoms, China is in an all out war and only the south survives, in the north states are formed and then quickly collapse
-440 Liu Song dominates the south and Northern Wei conquers the north