Iran has warned students staging anti-government protests, saying they must “understand the red lines” despite their “understandable” anger.