Yanmen
雁门
Yanmen is a historical frontier district around Yanmen Pass in northern Shanxi, China. The Tang replaced Yanmen Commandery with Dai Prefecture in 618 and briefly restored the commandery from 742 to 758. In 882, the Tang set up the Yanmen Defense Command to oversee local defense from what is now Dai County. The command was renamed Daibei in 883.
Early in the Ming dynasty, Dai Prefecture was reorganized as a county in 1369 and remained a county until about 1375. During those years, fortifications were built at Yanmen Pass, and the earthen walls of Shangguan were faced with brick.