From another forum:
I mentioned opening ports within windows or on your router for BF3 might be a possible fix for people who are having a hard time entering servers, though I can't be positive it is the cause in BF3, but I have used this method to fix similar issues for other games.
1. Within windows:
Allow BF3 access through Windows firewall. In win7 go to: Control Panel > System & Security > Windows Firewall> Allow a program through firewall(top left of screen). Scroll down to Battlefield 3 and check both checkmarks to the right of it. Hopefully it helped. (I have Windows7 firewall disabled completely to avoid problems, but that increases security risks.)
2. Behind a router:
Unfortunately I can't tell you exactly how to do it because all routers are different. Here is a link which I have used for 4 different routers successfully.http://portforward.com/guides.htm
Once you figure out how to open ports on your router, here are the ports to open.
If you are playing on PC, please enable the following online ports on your connection:
TCP: 80, 443, 9988, 20000-29999, 22990, 17502, 42127
UDP: 3659, 14000-14016, 22990-23006, 25200-25300
Just in case somebody hasn't done this yet, or PB has updated and you need to do it again. Use the link below to download punkbuster manually and follow the directions on the website.http://www.evenbalance.com/index.php?page=pbsetup.php
Punkbuster is the anticheat for BF3 and many other games. It uses two services on your computer to scan (PnkBstrA.exe/PnkBstrB.exe) If these processes are killed by Antivirus or GameBooster for example, you will be unable to join servers or kicked quickly because PB can't communicate with your computer. The other way PB will have trouble communicating with your computer and could cause inconsistent game joining is because your network is blocking the communication. To make sure that the windows firewall isn't blocking the network connection go back to the "Allow a program through firewall" that I discussed above and make sure there are 2 instances of both PnkBstrA and PnkBstrB. One of the instances for each should have Home/Work(Private) checked, and the other should have "Public" checked.
TOO LONG/ DIDN'T READ:
Go to: Control Panel\System and Security\Windows Firewall\Allowed Programs
Check both boxes for BF3 and make sure there are two PnkBstrA and PnkBstrB's and that they both have at least one check mark.