I have a question about root-port election in STP. How to determine root-port on switch 3, both fa0/1 and fa0/2 have port-cost back to root switch (switch 0) of 38, receive BPDU from port fa0/3 of switch 2. Any other tie-breaker in this case. As result of simulation, f0/1 is root-port of switch 3. Thanh you so much.
The root port on a device is the lowest cost interface facing the root bridge. If there's a tie the lowest port ID is selected.
Since you've got a hub in between S2 and S3, S3 is receiving the exact same BPDUs from S2 on both ports and BPDUs from one of its own ports on the other. While this doesn't really hurt S3, S2 will be confused because it receives conflicting BPDUs from two different interfaces of the same bridge on a single interface. Using a hub breaks spanning tree and shouldn't be done.
Additionally, this setup doesn't make much sense. While S3 has two interfaces towards the rest of the network, both interfaces are connected to the same repeater and thus belong to the same collision domain. Only one port can be used at any time.