Disclosed are a protocol switching method in an optical network unit and an optical network unit. The method comprises: an optical network unit storing configuration data of a used protocol into a corresponding protocol configuration file; and when the optical network unit determining that a current protocol is switched to a used protocol, reading a protocol configuration file corresponding to the used protocol, and importing the protocol configuration file into a database, so as to be invoked by an application. In the present invention, by storing a protocol configuration file, configuration data after cross-protocol switching is stored and recovered, and history configuration data of a user is reserved to the maximum extent, thereby solving the trouble that the user is required to re-configure data after cross-protocol upgrade; when a protocol is upgraded for the first time, through the present invention, public critical parameters of a protocol are obtained by reading other protocol configuration files, and current data is automatically set, thereby saving configuration time for the user significantly, and the present invention is applicable to various protocol types.