The problem occurred after I installed the ufw firewall package. I finally figured out (as Mr Richard Hector wrote me) that the problem was caused by ufw blocking the network connection on the loopback interface. Removing the ufw package resolved the problem.