Wired first. Switch the PS3 off, run an Ethernet cable from your router into the port on the back, then power on and open Settings, then Network Settings, then Internet Connection. Choose the wired option and let it test.
Wireless works too: in the same menu pick wireless, scan for networks, and select yours. A secured network needs the password printed on the router — never try to ride on a neighbour's connection. Once you are through, sign in to PlayStation Network.