Kenya has carried out an airstrike targeting two al-Shabaab camps in Somalia in the first major military response to last week's attack by the militant group on a Kenyan university.

Gunmen from the al-Qaeda-aligned group killed 148 people on Thursday when they stormed the Garissa University College campus, around 200km from the Somali border.

Cloud cover made it difficult to establish how much damage the airstrike by the Kenyan air force caused or estimate the death toll.

Kenya has struggled to stop the flow of al-Shabaab militants and weapons across its porous 700km border with Somalia.

Al-Shabaab militants have killed more than 400 people in Kenya since April 2013.

An African Union peacekeeping force that includes Kenyan troops, and which is fighting the group in Somalia, carried out arrests and seized ammunition in an al-Shabaab camp in Gondodowe last August.