It completely depends.
- Are you hosting on your own PC? A separate PC? Or even a server somewhere else?
- Did you open the needed ports on your router?
- Did you turn off "LAN discovery"?
- If you want to play on your server yourself, you need to enable something called Hairpinning https://en.wikipedia.org/wiki/Hairpinning (if it is hosted on your own local network)
- Did you even try to find a tutorial on how to set up your own server?