I once fort forwarded my modem and made a private server and played with my friends but this time I have a wifi router. Now I'm confused to to port forward which one? modem or router? some say routers are better and some say go with my modem itself so if anybody can help I'll be glad. Thanks in advance
It depends on what router and modem you have. If you have a layer 3 modem, you'll want to port forward that. If not, port forward the router. It all depends on what device is doing NAT (NAT is a layer 3 protocol), which is typically the router(a layer 3 device). If you want to learn more about that, i'll give a non-necessary description of it below.
EDIT: I've never seen or heard of a layer 3 modem. I'm not sure where you heard about port forwarding your modem.
Every internet connection needs an IP to connect to the internet. There are only 4,294,967,296 IPs and many of these are not available. As you might guess, there are many more things trying to use the internet than that. If everything/everyone trying to access the internet had its own IP, there wouldn't be enough IP addresses for everyone. The solution to this is a thing called NAT. NAT allowed for one IP to be used by everyone on a network. So when you're at home, you might have your computer, your xbox, and a family member's computer on the same network. Once your computer goes onto the internet, it will use the same IP address that you xbox and other computers use. The problem with this occurs when someone tries to connect to your computer from the internet. When they try to find your computer, they use the IP address that you use to get out. When you use this IP, it represents all the devices on your network. There's no way router to know what device these people are trying to get to. Thus, port forwarding was created. When you open a port on your router, it knows that whenever it gets a request with a certain number added onto the end of your ip address (usually 2555 in minecraft) it needs to forward the traffic to a specific device on the network (your computer). Therefore, when you port forward your router, you're telling it anything that comes to your router with the port (usually 2555), it needs to be sent to your computer. Once your computer gets the traffic, it lets the minecraft server deal with it.
I go directly through my modem for all port forwarding due to the fact that the router simply allows other devices to connect wirelessly. I suppose you could port forward on your router if you plan on hosting the server on a laptop -- but that's not something I would vouch for, nor can I guarantee it would work.
Thanks for the reply guys but I found the solution. I port froward my router and enabled modem's DMZ to the router. The DMZ sents whatever the modem receives to the router and just took away the routing duty of my modem. Also I figured out that my modem is actually and router+modem :P.