Several demonstrators were arrested, a Reuters witness said.
The march started after Eid prayers at a nearby mosque. Protesters waved banners with the Palestinian flag and with the words: "Kenyans stand with Palestine" and "Our freedom is incomplete without the Freedom of Palestine - Nelson Mandela".
"I stand with my brothers and sisters in Palestine and I pray day and night that my sisters and brothers get peace," said protestor Rayan Sheikh.
Dozens of people have been killed in Israeli air strikes on Gaza since violence escalated on Monday, and several people in Israel have been killed by Hamas rocket fire.
"Israel is the last apartheid nation in the world," Boniface Mwangi, an anti-corruption and human rights activist, said just before teargas was thrown to disperse the marchers.
"Apartheid in South Africa would not have fallen without international pressure... our silence justifies what Israel is doing."
Some critics of Israeli policies regarding the Palestinians, including Human Rights Watch, have accused it of a form of apartheid, the former system of white minority rule in South Africa. Israel rejects the comparison.