The attack was the latest to target a diplomatic mission in Tripoli, where most embassies have been shut since summer 2014 as militias battled for control of the city.
There was no immediate claim of responsibility for the attack. One bomb exploded outside the security gate and a second was lobbed into the grounds of the residence, a spokesman for security services in Tripoli, Issam al-Naass, told AFP.
Another security source said no one was hurt as "the building was empty and the guard was not at his post at the time of the attack."
The Iranian ambassador's residence is in an area of Tripoli where several diplomatic missions are located.
Also Read
Witnesses said windows at the nearby Ukrainian embassy were shattered by the impact of the blasts.
In January, the Islamic State jihadist group claimed responsibility for an attack with explosives that targeted the empty Algerian embassy in Tripoli, wounding a security guard and two passers-by.
IS extremists have been gaining ground in Libya, feeding on chaos that has engulfed the country since dictator Moamer Kadhafi was toppled and killed in a 2011 NATO-backed uprising.