Ports to use for mongodb sharding + replication
You can use any ports you like. Particularly on a toy system, it makes no practical difference what number port you choose; it works just as well with port 29589 as port 27017.

Some things to keep in mind:


on a single machine, two different processes must listen on different ports. So no, you can't run two shard servers on the same port.
you need to administer all these processes; if you pick a system where different sets of ports are used for different purposes, that will make it easier to keep track. For example, you might choose to run configsvr processes on ports 21001-21003, shard mongod processes on ports 22001-22999, and mongos processes on ports 23001 upwards.
the default port is 27017, and that is public knowledge; so if your system is open to the internet, be aware that malicious ransomers using port scanners will be looking for an exposed mongod system on port 27017 they can access and exploit. So you might prefer to avoid using that port, to add an extra layer to your security.