No group immediately claimed responsibility for the attack.
Attaullah Khogyani, spokesman for the governor of Nangarhar, said the bomber had tried to join a queue of people seeking visas to Pakistan and blew himself up after being prevented from entering the building.
Local Afghan officials at the scene said they were investigating the ongoing attack outside the consulate, which is also near the Indian diplomatic mission.
"Two policemen were killed after the suicide attack, which was followed by gunfire," interior ministry spokesman Najib Danish told media agencies.
"The incident occurred near the Pakistani consulate, but we are not sure if it was the intended target."
The latest attack comes close on the heels of four-country talks in Islamabad aimed at reviving stalled peace talks with the Taliban.
There have been several bomb blasts in Afghanistan over recent weeks at a time when efforts are underway to restart a peace process with the Taliban.
Delegates from Afghanistan, Pakistan, China and the United States met this week to try to resurrect efforts to end nearly 15 years of bloodshed in Afghanistan, even as fighting with the Taliban intensifies.
The talk of US economic decline is political hot air: Obama
'Pakistan has called Modi's bluff'
FIFA probe: Guatemala arrests ex-soccer chief Jimenez
PHOTOS: Best moments from Obama's State of Union speech
The Pathankot Siege and its Lessons