In case you are using a router for your Minecraft server, your friends might not be able to connect to it, unless you forward the right port.
To understand this, let’s consider an example. Say there are 3 computers on a network – Computer A, Computer B and Computer C. Let’s assume that they use a router to interface with the internet.
If you’re not really familiar with networking and routers, check the Wiki answers – Why do you use routers?
When routers are used, the internal IP addresses or the individual IP addresses of the computers (Internal IP 1, 2, 3, R) on the local network are not known outside the network. Similarly, these internal computers will not be able to see any IP address outside the local network. Only the external IP address (External IP R) of the router is publicly known. If any computer on the internet, wants to send data to any computer inside the local network, it will send the data to the external IP address of the router. The router then determines to which computer inside the local network, the data needs to be sent to. This is basically why port forwarding is done. It is simply to tell the router, which data is meant for which computer on the internal network. If your friend’s computer, which is outside the local network, wants to connect to your Minecraft server, you will need to tell your router about the computer and the port on which Minecraft server is running.
For a more detailed explanation check this link - port forwarding.
Here are the basic steps involved in port forwarding for Minecraft:-
1) Find out what kind of router you are using. Get the model number and manufacturer name.
2) Ensure that you have set a static IP address for your computer. Check this guide for detailed steps.
3) Check if your router is present in this list of routers.
4) Click on your router if yes. Skip the ad. In case your router is not present in the list, you can get the port forwarding details on the internet.
5) Once your router’s page opens, scroll down to the bottom where a list of programs are given. Find and click on Minecraft Server.
6) The webpage gives detailed steps for port forwarding, along with images. Follow these steps.
Check the detailed port forwarding progression for extra info on all the steps mentioned above. Some troubleshooting information is as well given on this page.