Porcine beta defensin 2 (pBD2) is a cationic antimicrobial peptide with broad spectrum antibacterial activity, which makes it a potential alternative to antibiotics to prevent and cure diseases of pigs. However, development of pBD2 as an effective antibiotic agent requires molecular understanding of its functional mechanism against pathogens. In this study, we investigated the functional mechanism of pBD2 antibacterial activity. Escherichia coli was incubated with different pBD2 concentrations for different times. Electron microscopy was used to analyze the locations of pBD2 and its induced morphological changes in E. coli. Gene expression analysis was also performed to further understand the molecular changes of E. coli in response to pBD2 incubation. The results demonstrated that E. coli membranes were broken, holed, and wrinkled after treatment with pBD2, and pBD2 was located on the cell membranes and manly in the cytoplasm. Furthermore, 38 differentially expressed genes (DEGs) were detected, successfully sequenced and confirmed by quantitative real-time PCR (qRT-PCR). Most of the known functional DEGs were associated with DNA transcription and translation and located in the cytoplasm. Collectively, the results suggest that pBD2 could have multiple modes of action and the main mechanism for killing E. coli might be influence on DNA transcription and translation by targeting intracellular molecules after membrane damage, although transport and metabolism proteins were also affected.