You seem to understand a little about network connections, which makes this easier. My first suspicion would be a DNS lookup failure when you attempt to access websites. This is easy to test using the Terminal app and ping command you have already used. Picking an easy example try
ping 17.253.144.10
// should get a response from apple's server
// now try
ping apple.com
// should get a similar response
Try looking up one of the websites you have failed to contact with Safari, for example,
nslookup apple.com
This should return a result including the IP address of the site
Now try nslookup for one of the websites you are having problems with, and try to ping either by name or IP address.
Also try the problem website from Safari, using the numeric IP address instead of the site name.
Hopefully this will give you a few more clues.