Han domination (111 BC – 40 AD)
In 111 BC, Han troops invaded Nam Việt and established new territories, dividing Vietnam into Giao Chỉ (pinyin: Jiaozhi), now the Red River delta; Cửu Chân from modern-day Thanh Hóa to Hà Tĩnh; and Nhật Nam (pinyin: Rinan), from modern-day Quảng Bình to Huế. While governors and top officials were Chinese, the original Vietnamese nobles (Lạc Hầu, Lạc Tướng) from the Hồng Bàng period still managed some highlands.
Trung Sisters (40–43)
In 40 AD, the Trưng Sisters led a successful revolt against Han Governor Su Dung (Vietnamese: Tô Định) and recaptured 65 states (including modern Guangxi). Trưng Trắc became the Queen (Trưng Nữ Vương). In 43 AD, Emperor Guangwu of Han sent his famous general Ma Yuan (Vietnamese: Mã Viện) with a large army to quell the revolt. After a long, difficult campaign, Ma Yuan suppressed the uprising and the Trung Sisters committed suicide to avoid capture. To this day, the Trưng Sisters are revered in Vietnam as the national symbol of Vietnamese women.
From Han to Liang domination (43–544)
Learning a lesson from the Trưng revolt, the Han and other successful Chinese dynasties took measures to eliminate the power of the Vietnamese nobles. The Vietnamese elites were educated in Chinese culture and politics. Giao Chỉ prefect, Shi Xie, ruled Vietnam as an autonomous warlord and was posthumously deified by later Vietnamese emperors. Nearly 200 years passed before the Vietnamese attempted another revolt. In 225 another woman, Triệu Thị Trinh, popularly known as Lady Triệu (Bà Triệu), led another revolt which lasted until 248. Once again, the uprising failed and Triệu Thị Trinh threw herself into a river.
During the Tang dynasty, Vietnam was called Annam until 866. Annam (with its capital around modern Bắc Ninh Province) became a flourishing trading outpost, receiving goods from the southern seas. The Book of the Later Han recorded that in 166 the first envoy from the Roman Empire to China arrived by this route, and merchants were soon to follow. The 3rd-century Tales of Wei (Weilüe) mentioned a "water route" (the Red River) from Annam into what is now southern Yunnan. From there, goods were taken over land to the rest of China via the regions of modern Kunming and Chengdu.
At the same time, in present-day Central Vietnam, there was a successful revolt of Cham nations. Chinese dynasties called it Lin-Yi (Lin village; Vietnamese: Lâm Ấp). It later became a powerful kingdom, Champa, stretching from Quảng Bình to Phan Thiết (Bình Thuận).
Early Ly dynasty (544–602)
In the period between the beginning of the Chinese Age of Fragmentation and the end of the Tang dynasty, several revolts against Chinese rule took place, such as those of Lý Bôn and his general and heir Triệu Quang Phục; and those of Mai Thúc Loan and Phùng Hưng. All of them ultimately failed, yet most notable were those led by Lý Bôn and Triệu Quang Phục, whose Early Lý dynasty ruled for almost half a century, from 544 to 602, before the Chinese Sui dynasty reconquered their kingdom Vạn Xuân.
From Sui to Tang domination (602–905)
In 866, Annam was renamed Tĩnh Hải quân. Early in the 10th century, as China became politically fragmented, successive lords from the Khúc clan, followed by Dương Đình Nghệ, ruled Tĩnh Hải quân autonomously under the Tang title of Jiedushi (Vietnamese: Tiết Độ Sứ), Virtuous Lord, but stopped short of proclaiming themselves kings.
In 938, Southern Han sent troops to conquer autonomous Giao Châu. Ngô Quyền, Dương Đình Nghệ's son-in-law, defeated the Southern Han fleet at the Battle of Bạch Đằng (938). He then proclaimed himself King Ngô and effectively began the age of independence for Vietnam.