Successive dynasties based in China ruled Vietnam directly for most of the period from 207 BC until 938 when Vietnam regained its independence . Later , successive dynasties based in China ruled Vietnam directly for most of the period from 207 BC until 938 when Vietnam regained its independence .