fix: preserve explicit target port in network templates (fixes #7323) (#7465)