Apparently, this was caused due to IPv6 being enabled on my system. See this askubuntu discussion.
Fixes (as copied from the link above):
- edit /etc/gai.conf and uncomment the last line to change the order of precedence to IPv4 first:
#
# For sites which prefer IPv4 connections change the last line to
#
precedence ::ffff:0:0/96 100 - Alternative: disable IPv6. Not sure whether that is a good idea, so first try option 1. Anyway, you can reverse this action by deleting the lines added to /etc/sysctl.conf (everything below #disable ipv6).
echo "#disable ipv6" | sudo tee -a /etc/sysctl.conf
echo "net.ipv6.conf.all.disable_ipv6 = 1" | sudo tee -a /etc/sysctl.conf
echo "net.ipv6.conf.default.disable_ipv6 = 1" | sudo tee -a /etc/sysctl.conf
echo "net.ipv6.conf.lo.disable_ipv6 = 1" | sudo tee -a /etc/sysctl.conf
sudo sysctl -p - Check whether IPv6 is enabled with cat /proc/sys/net/ipv6/conf/all/disable_ipv6, output is 0/1 for enabled/disabled.
- "Have you tried switching it off and on again?"