The dynamic response of organisms exposed to environmental pathogens determines their survival or demise, and the outcome of this interaction depends on the hosts susceptibility and pathogen-dependent virulence factors. The transmission of acquired information about the nature of a pathogen to progeny may ensure effective defensive strategies for the progenys survival in adverse environments. Environmental RNA interference (RNAi) is a systemic and heritable mechanism and has recently been linked to antibacterial and antifungal defenses in both plants and animals. Here, we report that the second generation of Caenorhabditis elegans living on pathogenic bacteria can avoid bacterial infection by entering diapause in an RNAi pathway-dependent mechanism. Furthermore, we demonstrate that the information encoding this survival strategy is transgenerationally transmitted to the progeny via the maternal germ line.IMPORTANCE Bacteria vastly influence physiology and behavior, and yet, the specific mechanisms by which they cause behavioral changes in hosts are not known. We use C. elegans as a host and the bacteria they eat to understand how microbes trigger a behavioral change that helps animals to survive. We found that animals faced with an infection for two generations could enter a hibernationlike state, arresting development by forming dauer larvae. Dauers have closed mouths and effectively avoid infection. Animals accumulate information that is transgenerationally transmitted to the next generations to form dauers. This work gives insight on how bacteria communicate in noncanonical ways with their hosts, resulting in long-lasting effects providing survival strategies to the community.