How many ground rods are required for panel and subpanel?
Do not connect the sub panel to grounding electrodes. A grounding conductor must be run back to the main service panel. The main service panel is the only connection to a grounding electrode system in a single building without a separate means such as a genset. The underground metal pipe could be used as an electrode, but it sounds distant. So you should install two ground rods near the service entrance and connect those to the service panel.