You can use iPhone 3G or later as a modem to connect, or tether, your computer to the Internet. You can connect iPhone to your computer using the Dock Connector to USB Cable, or via Bluetooth.
In Settings, choose "General -> Network -> Internet Tethering".
Slide the Internet Tethering switch to On.
Connect iPhone to your computer.
USB: Connect your computer to iPhone, using the Dock Connector to USB Cable. In your computer’s Network services settings, choose iPhone. On a Mac, a pop-up window appears the first time you connect, saying "A new network interface has been detected". Click Network Preferences, configure the network settings for iPhone, then click Apply. On a PC, use the Network Control Panel to configure the iPhone connection.