Inflammatory bowel disease (IBD), including Crohn's disease and ulcerative colitis, is a major human health problem. The bacteria that live in the gut play an important part in the pathogenesis of IBD. However, owing to the complexity of the gut microbiota, our understanding of the roles of commensal and pathogenic bacteria in establishing a healthy intestinal barrier and in its disruption is evolving only slowly. In recent years, mouse models of intestinal inflammatory disorders based on defined bacterial infections have been used intensively to dissect the roles of individual bacterial species and specific bacterial components in the pathogenesis of IBD. In this Review, we focus on the impact of pathogenic and commensal bacteria on IBD-like pathogenesis in mouse infection models and summarize important recent developments.