Australia and Iran have agreed to share intelligence to track foreign fighters associated with the Islamic State of Iraq and the Levant (ISIL), the Australian Foreign Minister Julie Bishop said.

Legislators in Canberra urged caution after Bishop's comments on Monday, which came during the first visit to Iran by an Australian minister in a decade.

Her statement came after a meeting with Iranian counterpart Mohammad Javad Zarif, President Hassan Rouhani and Ali Akbar Velayati, foreign affairs adviser to supreme leader Ayatollah Ali Khamenei.

Bishop said it would be an informal arrangement.

"We have a common purpose with Iran in defeating Daesh and helping the Iraqi government," she told the Australian Broadcasting Corporation, using an Arabic acronym to refer to ISIL.

"During my discussions with the national leadership here, it was agreed that we could share intelligence, particularly on the foreign terrorist fighters from Australia who are taking part in this conflict in Iraq."

More than 100 Australians have travelled to Iraq and Syria to fight with the group, raising concerns about the threat they pose if they return home.

On Saturday, two men were arrested in Melbourne for allegedly planning an ISIL-inspired attack at Anzac Day commemorations on April 25 honouring soldiers who fought and died for Australia.

Bishop said Tehran had a strong military presence and long relationship with Iraq, coupled with a sophisticated intelligence network in places where Canberra had no presence.

"Obviously if Iran has information that will be of interest to us, if we have information that would be of interest to them, in pursuing our common purpose of defeating Daesh, then that is an appropriate exchange."

'Flirting with evil'

Independent MP Andrew Wilkie, a former intelligence analyst, warned Canberra it was "flirting with evil".

"The regime in Iran can't be trusted and Australia is flirting with evil by establishing any sort of security relationship with it," he said, adding that Tehran had a track record of disseminating disinformation to further its own agenda.

The Labor opposition also urged caution.

"We need to keep our eyes open whenever we deal with them," the AFP news agency quoted Labor leader Bill Shorten as saying.

Australia is part of an international coalition in Iraq and last week began deploying 330 more troops to train local soldiers fighting ISIL, contributing an aerial and special forces contingent in the region.

Iran, though not part of the coalition, has run a parallel campaign using Shia factions and military advisers to reverse the advance of ISIL, which took over large parts of Iraq last June.

Bishop said she made a point of explaining to Tehran that the deployment of more troops was strictly for military training purposes.

"I don't want there to be any misunderstanding, any miscalculation or any misjudgement, and I made that point very clearly to each one of the leaders that I met," she said.