Twelve militants and nine officials and civilians were killed in the fighting at the base, military authorities and security sources said. Ten other people were reported killed in the rocket attack.
The base is in the Lakki Marwat district of Khyber Pakhtunkhwa province.
Taliban spokesman Ihsanullah Ihsan said the attack was was revenge for the killing of their two top commanders, Faisal Khan and Commander Toofani, in a U.S. drone attack in Mir Ali area of North Waziristan last year.
The Ihsan blamed Pakistan for its cooperation with the U.S. on drone strikes.
"Pakistan has been cooperating with the U.S. in its drone strikes that killed our two senior commanders, Faisal Khan and Toofani, and the attack on military camp was the revenge of their killing," the Taliban spokesman said.
He said four of their suicide bombers attacked the army camp and blew themselves up in the base. An official said two of the bodies were found wearing suicide bomb belts.
In the rocket attack, 10 people were killed and five others injured in the Sara-e-Naurang area of the same Lakki Marwat district.
Police officials initially said the blast took place in a house but didn't provide further information about the nature of the explosion.
However local residents said a mortar shell fell on the house and caused casualties.
Reuters contributed to this report.