On-surface Ullmann coupling reaction of aryl chlorides has been achieved on Cu(111), Ag(111), and Au(111), and the mechanism has been investigated on the single molecule level using scanning tunneling microscopy and density functional theory. The different reactivity of the aryl halides was utilized to design a stepwise on-surface synthesis, which affords a zigzag template and then converts to 2D porous networks.