During infection, the infected tissue secretes a variety of endogenous peptides to resist further invasion of pathogens. Among these endogenous peptides, the natriuretic peptides and the antimicrobial peptides attracted the most attention. C-type natriuretic peptide (CNP) and its receptor natriuretic peptide receptor B (NPR-B) were members of the natriuretic peptide system. The antimicrobial peptide S100A7 plays an important role to resist infection of bacteria in mastitis. It is reported that the expression of S100A7 is regulated by an activator protein-1 (AP-1)-responsive promoter. As a subunit of AP-1, c-Jun is a downstream target of CNP/NPR-B signaling pathway. Therefore, it is a hypothesis that the CNP/NPR-B signaling pathway induces the expression and secretion of S100A7 in mammary glands to take part in local mammary gland innate immunity. To verify this hypothesis, goat mammary gland and isolated mammary epithelial cells (MECs) were used to explore the expression of CNP/NPR-B and their physiological roles in goat mammary gland. The results showed that goat mammary gland expressed NPR-B, but not CNP. The expression and secretion of S100A7 in goat MECs were obviously induced by CNP/NPR-B signaling pathway. After treatment with CNP, the cyclic guanosine monophosphate (cGMP) level in goat MECs was significantly upregulated. Along with the upregulation of cGMP level, the phosphorylation levels of c-Jun N-terminal kinase (JNK) and its target c-Jun were also increased gradually. KT5823 is a specific inhibitor for protein kinase G (PKG). KT5823 remarkably inhibited the phosphorylation of JNK and c-Jun induced by CNP. Correspondingly, KT5823 evidently inhibited the expression and secretion of S100A7 induced by CNP. On the other hand, the expression of NPR-B and S100A7 was upregulated in the mastitis goat mammary gland. But, there was no significant difference in expression of CNP between healthy and mastitis goat mammary gland tissues. The goat mastitis model was established in vitro using goat MECs treated by lipopolysaccharide (LPS). LPS treatment also could increase the expression of NPR-B and S100A7. In conclusion, goat mammary gland expressed NPR-B, indicating mammary gland was the target organ for natriuretic peptide system. Moreover, CNP, through NPR-B/JNK/c-Jun signaling pathway to regulate the expression and secretion of S100A7 in MECs, played an important role in mammary gland innate immunity.