To observe the effects of moxibustion at "Mingmen" (GV 4) and "Guanyuan" (CV 4) on immune function and intestinal flora in healthy rats, thereby investigating the underlying mechanism of moxibustion on immune function. Twenty 8-week-old SD rats were randomly divided into a young blank group and a young moxibustion group, with 10 rats in each group. Similarly, twenty 8-month-old SD rats were randomly divided into a middle-aged blank group and a middle-aged moxibustion group, with 10 rats in each group. The rats in the two moxibustion groups received moxibustion at "Mingmen" (GV 4) and "Guanyuan" (CV 4), 15 min per session, once daily, five times a week, for a total of four months. The rats in the two blank groups were fed under normal conditions. After the intervention, thymus and spleen indexes were calculated; the morphology of thymus and spleen tissues was observed using HE staining; the flow cytometry was used to detect the expression of CD and CD T lymphocytes and the CD/CD ratio was calculated; ELISA was used to measure the serum levels of tumor necrosis factor-alpha (TNF-α), interferon-gamma (IFN-γ), interleukin-6 (IL-6), interleukin-10 (IL-10), and interleukin-17 (IL-17); 16S rRNA high-throughput sequencing was used to analyze the intestinal flora. Additionally, the correlation between the relative abundance of intestinal flora and serum levels of TNF-α, IFN-γ, IL-6, IL-10 and IL-17 was analyzed. Compared with the young blank group, the young moxibustion group exhibited an increase in the cortical area of thymus tissue with tighter lymphocyte arrangement; compared with the middle-aged blank group, the middle-aged moxibustion group showed an increase in thymus index (P<0.05) and an increase in the cortical area of thymus tissue. There were no significant differences in spleen index between the 2 moxibustion groups and the 2 blank groups (P>0.05). There were no significant differences in the expression of CD, CD, and CD/CD ratio between the 2 moxibustion groups and the corresponding blank groups (P>0.05). Compared with the young blank group, the young moxibustion group had elevated IL-6 level (P<0.05); compared with the middle-aged blank group, the middle-aged moxibustion group had decreased IL-10 and IL-17 levels (P<0.05). Compared with the young blank group, the young moxibustion group exhibited increased Sobs index, Ace index, and Chao index (P<0.01, P<0.05), as well as increased relative abundance of Spirochaetota, Treponema, Turicibacter, Rikenellaceae_RC9_gut_group (P<0.05), and decreased relative abundance of Dubosiella (P<0.05). Compared with the middle-aged blank group, the middle-aged moxibustion group had increased relative abundance of Spirochaetota, Treponema, norank_f_Peptococcaceae (P<0.05), and decreased relative abundance of Proteobacteria, Allobaculum, and Faecalibaculum (P<0.05). Correlation analysis revealed that relative abundance of Eubacterium_xylanophilum_group and unclassified _f_Lachnospiraceae was negatively correlated with serum TNF-α level (r=-0.39, P=0.03; r=-0.24, P=0.04), while relative abundance of norank_f_norank_o_Clostridia_UCG-014 and Lactobacillus was positively correlated with serum TNF-α level (r=0.37, P=0.04; r=0.43, P=0.02). The relative abundance of Roseburia and Monoglobus was negatively correlated with serum IFN-γ level (r=-0.40, P=0.02; r=-0.44, P=0.01), while relative abundance of Lactobacillus was positively correlated with serum IL-10 level (r=0.43, P=0.02). Moxibustion could improve immune function in healthy rats, and its mechanism may be related to the regulation of relative abundance of intestinal flora.