Why can I not access imgur.com and gravatar.com from Ubuntu but can do so from Windows?

This may be a MTU path discovery issue. This can lead to certain websites working incorrectly even though all others work fine. It will appear as a time out rather than connection refused. It will only show up with reasonably large transfers like whole webpages - telnet will probably not send any packets which need to be fragmented. It can affect outgoing ssh too.

The fix is to lower the MTU on your network device so that packets above a certain size are always fragmented. See for example:

http://tldp.org/HOWTO/Adv-Routing-HOWTO/lartc.cookbook.mtu-discovery.html

In detail what happens is that when you send data over the internet it is split up into packets. The maximum size for these packets anywhere on the internet is 1460 bytes not including headers. If you send a message large than that it must be split up, or fragmented.

Now, if your message goes over certain types of internet links it must be encapsulated in another protocol. That means that the packet including headers will get wrapped inside another packet. That obviously increases the size of the packet, so if your packet is already maximum size it must be split up again. However, because this can be exploited to perform DDoS attacks, many routers won't automatically fragment packets that they didn't create. Therefore your maximum size packets won't cross these routers.

In order to avoid this problem MTU path discovery was invented. If a packet is too big for a router it will send back a message saying to send smaller packets. However, it turns out this could be exploited too, and so many routers won't do that either.

So the way to overcome this problem is to always send packets slightly smaller than the absolute maximum. That's what the MTU setting is for. The idea is to set it just small enough that any extra overhead doesn't put you over the limit. Of course you won't know how small that is so you have to find the optimal value (biggest value that still works) by experimentation.