Basics
The most complicated part of connecting to the internet is the configuration, naturally. However, that information shall be covered in other sections. Here, we'll deal with other nice-to-know details.
Obtaining your first Friend Code in Pokemon Diamond / PearlOnce you've already taken care of configuration, obtaining your friend code is quite simple.
For starters, you must have obtained your first badge. The game simply doesn't allow you online until you have your first badge. From there, you have two places in the game where you can access Nintendo's Wifi network. Using either of these places will automatically give you your friend code.
The first place you can go is the basement of any Poke Center. In fact, given that there's a Poke Center in the same town you get your badge, you might find this to be really convenient!
The other place is the GTS located in Jubilive City. This can be convenient as well if you want to trade with unknown people prior to attempting to get your friends' Friend Codes. The GTS is located in the south-western area of town. (Perhaps you noticed on your first visit to this town that you weren't allowed down there.)
Now, how do you get a Friend Code? Simple ; just successfully log on once! Okay, you've done that, but I didn't see my friend code. Where is it, then? That's simple as well! Go into your Bag, specifically the Key Items pocket, and use your Pal Pad. The bottom option allows you to see your Friend Code.
Obtaining your first Friend Code in Pokemon Battle RevolutionThis is even easier to do since you can do it at any time of your choosing. Simply log onto the Wifi service.
Preparing to battle / trade with your friend over Wifi
Regardless of whether you're planning to battle with Pokemon Diamond and Pearl or with Pokemon Battle Revolution, you have to trade Friend Codes before you'll even be able to see each other!
In Pokemon Battle Revolution, the option to do this is in the Wifi section just prior to logging on. Make sure you and your friend enter your Friend Codes before you log on.
In Pokemon Diamond and Pearl, you add your friend on the Pal Pad.
How to trade with your friend
How to battle with your friend