In conclusion, this paper confirms that IPA can exert a protective effect on S. aureus-induced mastitis through regulating the blood milk barrier and inhibiting inflammation, and preliminarily reveals that its mechanism of action is achieved by activating AhR, which subsequently inhibits NF-κB and NLRP3 signaling pathways. This evidence concerns the gene NFKB1 and mastitis.