Malcolm Turnbull is confident G20 leaders will agree on tougher sanctions against North Korea and new steps to deal with online extremism.

The prime minister's optimism ahead of the Hamburg summit starting on Friday comes despite deep divisions over what next steps to take to ensure North Korea abides by UN sanctions against testing missiles.

US President Donald Trump says the West faces "dire threats" to its security and way of life and he has not ruled out military options.

"It's a shame (North Korea) is behaving this way ... something will have to be done about it," he said during a pre-summit visit to Poland.

G20 in Hamburg with @mathiascormann. Standing up for Australia, talking counter terrorism, free trade, energy security & economic prosperity pic.twitter.com/KVkuvGrmLK — Malcolm Turnbull (@TurnbullMalcolm) July 6, 2017

Mr Turnbull told reporters in Hamburg that North Korea's "reckless and provocative" action had been condemned by all G20 members.

"We will see a strong commitment ... to strengthen the sanctions that have already been applied to the North Korean regime," he said.

Asked about the US taking military action, Mr Turnbull declined to speculate but reiterated Australian action would be done under the UN, as well as autonomous sanctions targeting North Korean individuals and businesses.

He also urged China to do more to "bring economic pressure in particular to bear".

PM Turnbull says North Korea's actions "were not provoked, not justified and not legal... a reckless path of provocation" @SBSNews #auspol pic.twitter.com/AB2qExlBNw — Brett Mason (@BrettMasonNews) July 6, 2017

China and Russia have urged cooler heads among G20 nations, with more trade sanctions only likely to increase poverty in North Korea and damage the global economy.

Chinese President Xi Jinping will take to the summit a plan for "suspension for suspension", which would involve North Korea winding back tests while the US and South Korea suspend military exercises.

Russian President Vladimir Putin argues military options should be ruled out and an "exclusively political and diplomatic" solution is needed.

Russia is already irate at the US over what it describes as a "sanctioning frenzy" over the Ukraine.

Mr Turnbull, who is also pushing new steps to deal with online extremism via communications apps and social media sites, said cooperation across the G20 agenda was vital.

PM says China has "greatest leverage" and "must do more" re North Korea. Won't discuss "hypotheticals" of military action @SBSNews #auspol pic.twitter.com/aizGdwu7r8 — Brett Mason (@BrettMasonNews) July 6, 2017

"We need the 20 largest economies of the world to pull together and support each other in delivering the security that all of our citizens deserve and are entitled to expect from their leaders."

He appeared less confident about agreement on climate action, which Mr Trump has dampened through his decision to pull out of the Paris accord.

"Australia is a party to and supports and is complying with our commitments under the Paris agreement," he said.

Mr Turnbull held a bilateral meeting with German Chancellor Angela Merkel on Thursday at which they discussed terrorism, innovation, defence cooperation and a proposed trade deal between Australia and the European Union.

"We are committed to free trade and open markets," he said.

0:00 North Korea 'thumbing its nose' at UN: Bishop 00:00 / 00:00 Share Share on Twitter

Share on Facebook

More than 21,000 police armed with water-cannons were preparing to deal with protests on Thursday night (Hamburg time), with train loads of anti-capitalism and pro-environment activists arriving and others already camped out in church grounds and theatres.

The prime minister will head to Paris and London for leader-level talks after the summit.