There are plenty of people who have this as their first question regarding Ubuntu? Why? It is a primary role for computers in the modern day.
Unfortunately, merely telling people that it doesn't work won't help them to resolve the issue. So - in the words of Tom Cruise, "Help me, help you."
This guide is useful reading regarding getting generic help: https://help.ubuntu.com/community/GettingAnswers
For internet-related help, make sure you include the following details:
1. How were you trying to get online? e.g. dial-up, USB-wired ADSL modem, ethernet-wired ADSL modem, ethernet-wired ADSL modem-router, wireless router / modem-router, 3G-mobile internet etc.
2. What hardware are you using? The brand & model number (perhaps with a link to an online manual) for your adapters, modems, routers etc. You can generally identify external components from their labelling, and internal components from within an Operating System already installed (e.g. Windows or Ubuntu).
3. Who is your Internet Service Provider (and in which country)?
lshw -class network
4. Which version of Ubuntu are you using? e.g. Ubuntu 8.04, Xubuntu 7.10 etc and 32- vs 64-bit.
5. Can you get online with any other method? e.g. if you have a wifi problem, can you connect with ethernet?
6. How are you getting online to post on this forum?
7. Include the output from the following commands from Terminal (all case sensitive). They help identify your hardware, so provide further detail to potential helpers. If necessary, just copy and paste the text into a text file and upload from a different computer.
8. For wifi - what encryption are you using? Have you tried an open network? What wifi channel do you use?
ping -c 3 184.108.40.206
ping -c 3 www.opendns.com
9. Do you dual-boot with Windows? If yes - read this:
If you have this power-save function on in Windows, it will turn the network card off before shutting down, leaving it unavailable to Ubuntu. So check that in Windows, and make sure you don't have power-save on.
If the network adapter supports a power management option, the following check box may be selected:
Allow the computer to turn off this device to save power
If the network adapter supports this option, it is available on the Power Management tab of the network adapter properties dialog box. To resolve this issue, disable this option on the Power Management tab. For more information about how to disable this power management option, click the following article number to view the article in the Microsoft Knowledge Base:
If you include all these facts, together with an explanation of what you have tried already, your chances of a quick solution are much higher...