A simple way to check if your internet connection is working OK is to browse a few websites, making sure to visit some that you have never visited.
If you are able to browse websites, then we can safely assume:
1) You are connected to your ISP, and...
2) DNS is working.
So if the above is fine, then it is time to check your sources.list file. The sources.list file is how apt-get knows who to contact or where to look for .deb files, updates etc.
Assuming your using Debian Linux, Your sources.list file will be located at:
You can safely view sources.list in your web browser by typing /etc/apt/sources.list into your web browsers address or URL bar.
You can view and edit the file with Gedit. In Gedit, you would click on File then Open. Then double click on 'Filesystem', then double click on 'etc', and then double click on 'apt' and laslty double click on 'sources.list'
Mine looks like this:
#deb cdrom:[Debian GNU/Linux 3.1 r0a _Sarge_ - Official i386 Binary-1 (20050607)]/ unstable contrib main
deb http://http.us.debian.org/debian stable main contrib non-free
deb http://non-us.debian.org/debian-non-US stable/non-US main contrib non-free
deb http://security.debian.org/ stable/updates main contrib
The first line is remarked out or disabled by the #, but that first line is used if I want apt-get to look at my Debian Sarge DVD for the .deb package I am installing.
The 3rd, 4th and 5th lines that start with deb are the entries in sources.list which tell apt-get where to find the packages out there in the world of the internet.
You can also view and edit sources.list from a terminal session, simply start a terminal session and type the following:
Make any changes you see fit and the write out (save) the file by pressing CTRL+O
and then exit the pico file editor by pressing CTRL+X
Hope that helps and that my reply wasn't too late.