Thousands of people took to the streets of Moscow and two other cities on Sunday to rally against tighter internet restrictions, in some of the biggest protests in the Russian capital in years.

Lawmakers last month backed tighter internet controls contained in legislation they say is necessary to prevent foreign meddling in Russia's affairs. But some Russian media likened it to an online "iron curtain" and critics say it can be used to stifle dissent.

People gathered in a cordoned off Prospekt Sakharova street in Moscow, made speeches on a stage and chanted slogans such as "hands off the internet" and "no to isolation, stop breaking the Russian internet".

The rally gathered around 15,300 people, according to White Counter, an NGO that counts participants at rallies. Moscow police put the numbers at 6,500.

"If we do nothing it will get worse. The authorities will keep following their own way and the point of no return will be passed", said 28-year-old protester Dmitry, who declined to give his full name.

Opposition activists said on Twitter that police had detained 15 people at the Moscow rally, confiscating their banners and balloons. Police have not announced any detentions.

The protests in Moscow, the southern city of Voronezh and Khabarovsk in the far east had all been officially authorised. A handful of activists in St. Petersburg took to the streets without the authorities' consent.

Russia has in recent years attempted to curb internet freedoms by blocking access to certain websites and messaging services such as Telegram.

February's bill passed in the Russian parliament on the first reading out of three.

It seeks to route Russian web traffic and data through points controlled by the state and proposes building a national Domain Name System to allow the internet to continue functioning even if the country is cut off from foreign infrastructure.

The second reading is planned in March after which, if passed, the bill will need to be signed by the upper house of the parliament and then by President Vladimir Putin.

The legislation is part of a drive by officials to increase Russian "sovereignty" over its Internet segment.

Russia has introduced tougher internet laws in recent years, requiring search engines to delete some search results, messaging services to share encryption keys with security services and social networks to store Russian users' personal data on servers within the country.