People carrying Russian and Ukrainian flags chanted "No to war!" and "Stop lying!" Similar rallies took place in St Petersburg and other Russian cities.
Ukraine accuses Russia of arming rebels in the east and sending Russian troops across the border. Moscow denies this.
More than 3,000 people have died in fighting since April.
A truce was agreed on 5 September but there have been repeated violations since then.
The fighting began after Russia annexed Ukraine's southern Crimea peninsula in March - a move condemned by Ukraine and the West.
|A man with a Ukrainian flag walks past police during an anti-war rally in Moscow |
21 September 2014
|A large column of protesters waving both Russian and |
Ukrainian flags marched in central Moscow
|Supporters of pro-Russian separatists in Ukraine tear an Ukrainian flag |
at their own rally in Moscow - 21 September 2014
The demonstrators marched from Pushkin Square to Sakharov Avenue in central Moscow.
Organisers had hoped up to 50,000 people would take part to denounce what they described as Russia's "aggressive foreign policy".
Moscow police said there were about 5,000 protesters but a reporter for the AP news agency estimated that the crowd was at least 20,000-strong.
Police stepped up security in the capital and there were only minor scuffles reported between rival demonstrators.
It is Russia's first major anti-war rally since the fighting began five months ago in Ukraine's eastern Donetsk and Luhansk regions.
A number of supporters of the pro-Russia separatists in Ukraine held their own rally in Moscow.
Social media reaction to Moscow's anti-war rally
Vladimir Varfolomeyev, a journalist from Russia's Ekho Moskvy radio station, on the anti-war march turnout: "50,000, in my view, is a conservative estimate. Most likely it was slightly bigger."
Oleg Kashin, a correspondent with Kommersant newspaper, said: "The party of peace ended up on top today. And the party of war lost. And that's fantastic."
Kristina Potupchik, a pro-Kremlin blogger, wrote: "The organisers preferred to forget the fact that there is currently a ceasefire in Ukraine, which was achieved partly due to [Russian President Vladimir] Putin personally."
"Look at this coven of orcs with flags of Nato and [Ukrainian nationalist group] Right Sector in Moscow. Does Russia need all this pestilence?" former professional boxer Nikolay Valuyev tweeted.
|Ukrainian soldiers drive an Armoured Personnel Carrier (APC) in |
Kramatorsk town, Donetsk region, Ukraine, 11 September 2014
In Ukraine, fighting was reported to be continuing on Sunday close to the city of Donetsk despite an agreement on Friday to set up a 30km (19 miles) buffer zone as part of the Minsk memorandum.
The government in Kiev said its military forces would not pull back until pro-Russian forces stop firing and Russian troops leave. Russia denies that its forces are involved. Don't know why they continue this farce. No-one believes them, not even Russians.
Ukrainian military spokesman Andriy Lysenko said violations of the ceasefire continued, telling reporters: "In the last 24 hours we have lost two Ukrainian soldiers, eight have been wounded."
On Saturday, Gen Philip Breedlove, Nato's supreme commander in Europe, said the ceasefire existed "in name only".