Born in Washington, D.C., Dunlap was appointed a second lieutenant in the Marine Corps August 8, 1898. He served with distinction in the Spanish–American War; in the Philippine–American War Dunlap was attached to the Marine Corps' Philippines regiment from May 1899 to May 1902; during that period served in China from June 25, 1900 to October 9, 1900 and participated in the Battle of Tientsin and in China, including the Battle of Tientsin of the Boxer Rebellion. He was stationed on the Isthmus of Panama, then participated in the U.S. occupation of Veracruz, Mexico, in 1914.