/etc/hosts should have an entry for each local IP address with foobar.example.com foobar
But that is not relevant to your symptoms. You don't say which distro you are using. If it were Debian or ubuntu (or probably their derivatives) ...
What's in /etc/hostname? It should contain the bare hostname, without the domain name. If you change it, make the change effective by.
EDIT: just noticed the thread title contains Debian but I will leave the above as it is for wider use.