JK and MotS use DirectPlay. DirectPlay requires that certain TCP/IP ports be open so that each player's game can communicate with the others.
Every hardware device from your computer to your connection to the Internet (dialup, dsl, or cable) needs to have the ports open. For the computer, opening ports usually involves making sure a software firewall keeps them open, or only opens them when the game is active. For a router, port forwarding usually works. For a modem (dialup, dsl, or cable), usually a DMZ or port forwarding works. (Note that often the modem is also a router and that there might be more than one router between your computer and your Internet connection.)
The ports used by JK and MotS are those used by DirectPlay 3: