The attacks come as ties between Khartoum and the UN-African Union mission in Darfur have deteriorated over UNAMID's bid to investigate a report that soldiers raped 200 women and girls in October.
A UNAMID patrol repulsed an attack near the peacekeepers' base at Khor Abeche in South Darfur, mission spokesman Ashraf Eissa said.
"Two attackers were killed in the firefight" and no peacekeepers were wounded, he said in a statement.
Another patrol was ambushed by some 15 unidentified armed men in the Habilla area of West Darfur.
Also Read
The mission urged the government to investigate the attacks.
UNAMID deployed to Darfur in 2007, four years after ethnic insurgents rose up against the Arab-dominated government of President Omar al-Bashir, complaining of their marginalisation.
Its peacekeepers have been targeted before. Most recently, three Ethiopian soldiers were killed as they guarded a well.
The latest attacks come after a bid by UNAMID to investigate claims Sudanese troops carried out a mass rape in Darfur in October sparked Khartoum's ire.
Sudan demanded UNAMID form an "exit strategy" and told it to shut a human rights office in Khartoum.
Bashir is wanted by the International Criminal Court for alleged war crimes in Darfur, where the UN says at least 300,000 people have ben killed and two million displaced since 2003.