Ordos Plateau
In Chinese accounts, the Xiongnu first appear at Ordos in the "Yizhoushu" and "Shanhaijing" during the Warring States period before it was occupied by Qin and Zhao. It is generally thought to be their homeland, however when exactly they came to occupy the region is unclear, and it might have been much earlier than traditionally thought, as suggested by archaeological finds. As the Xiongnu expanded southward into Yuezhi territory around 160 BC under their leader Modun, the Yuezhi in turn defeated the Sakas (Scythians) and pushed them away at the Issyk Kul. It is thought the Xiongnu also occupied the Ordos area during the same period, when they came in direct contact with the Chinese. From there, the Xiongnu conducted numerous devastating raids into Chinese territory (167, 158, 142, 129 BC). The Han Dynasty started to fight the Xiongnu in the 2nd century BC under emperor Han Wudi, and colonized the area of the Ordos under Shuofang commandery in 127 BC. Prior to the campaign, there were already commanderies established earlier by Qin and Zhao until they were overrun by the Xiongnu in 209 BC.
Han–Xiongnu War
In 25 AD, Liu Xiu was established as Emperor Guangwu, restoring the Han throne after a usurpation by the Han official Wang Mang, thus initiating the Eastern Han period. During his reign, the Han empire began to abandon its offensive strategy against the Xiongnu, which allowed the latter to frequently raid the northern frontier. It resulted in large migrations southwards, which led to the depopulation of the frontier regions. During the Eastern Han period, various nomadic peoples were resettled in these frontier regions, serving the Han empire as cavalry against the Xiongnu. With his primary focus still towards the interior of the empire, Emperor Guangwu declined several requests from the western states to reestablish the office of Protector-General of the Western Regions. Early in Emperor Guangwu's reign, King Kang of Yarkand united neighboring kingdoms to resist the Xiongnu. At the same time, he protected the Han officials and people of the former Protector-General, who were still left behind after Wang Mang's reign. In 61 AD, Yarkand was conquered by Khotan and the western states fell in conflict with each other. Taking this opportunity, the Northern Xiongnu recovered their control over the Western Regions, which threatened the security of the Hexi Corridor. In 73 AD, General Dou Gu was sent on a punitive expedition to the Xiongnu and inflicted them a considerable defeat. Immediately, the fertile lands of Hami (Yiwu) was reoccupied and an agricultural garrison established. The next year (74 AD), he expelled the Xiongnu from Turfan and reoccupied the state. The recovery of Hami and Turfan facilitated the reestablishment of the Protector-General, since these important locations were key points to control the Western Regions.