The paramilitary Frontier Corps personnel were targeted in Salarzai area of Bajaur district near Afghan border.
An official said that the soldiers were fetching water in a tanker when hit by the explosives planted on the roadside.
"Two soldiers were killed and another two injured," he said.
The security forces launched search operation after the incident.
Nobody has taken responsibility for the attack but Taliban is active in the area and often target the security forces.
Pakistan has deployed troops along the porous border with Afghanistan to stop frequent incursions.