All insects are colonized by microorganisms on their exoskeleton, their gut and even in some cases within their own somatic and germ line cells. This microbiota that can represent up to a few percent of the insect biomass may have a pervasive impact on many aspects of insect biology including physiology, nutrient acquisition, ageing, behaviour and resistance to infection. Mainly through ingestion of contaminated food, the mouth-gut axis represents the first and principal access of external bacteria to the host. Soon after ingestion, the feeding insect needs to rapidly and accurately identify the ingested microbes and decide whether to preserve them if beneficial or neutral, or to eliminate them if potentially harmful. We will review here the recent data acquired in Drosophila on the mechanisms that invertebrate enterocytes rely on to detect the presence of bacteria in the gut. We will compare these modes of bacteria sensing to those in other immune competent tissues and try to rationalize differences that may exist. We will also analyse the physiological consequences of bacteria detection not only locally for the gut itself but also for remote tissues. Finally, we will describe the physiological disorders that can occur due to inaccurate bacteria identification by the gut epithelium.