What do you mean by “subnet”? Ports should be different if both nodes are behind the same public IP, yes. As explained by @mike.
If by “subnet” you meant within the same /24 subnet then no, both nodes (running on different public IPs but within the same /24 subnet) could run on same ports.