A method for processing a packet in a Gigabit Passive Optical Network, GPON, or next-generation GPON, comprising: receiving, by an optical network unit, ONU, an optical network terminal, management and control interface, OMCI, protocol packet sent by an optical line terminal, OLT, the ONU is configured to connect to user equipment, and the OLT is configured to connect the ONU to an Internet Protocol, IP, network, wherein the GPON or next-generation GPON is between the ONU and the OLT; obtaining, by the ONU, flow table information according to the OMCI protocol packet, wherein the flow table information comprises a match field and an instruction, and generating, by the ONU, a flow table entry according to the flow table information, wherein the flow table entry comprises the match field and the instruction; receiving, by the ONU, a service packet sent by the user equipment; and determining, by the ONU, a matching flow table entry according to the service packet, and when the matching flow table entry is the generated flow table entry, processing the service packet according to the instruction in the generated flow table entry; the method being characterized in that the OMCI protocol packet carries a uniform resource identifier, URI of a configuration file, and the OMCI protocol packet comprises a second message identifier, where the second message identifier is used to identify that the OMCI protocol packet carries the URI; and the obtaining, by the ONU, flow table information according to the OMCI protocol packet comprises: when the ONU determines that the OMCI protocol packet carries the second message identifier, accessing, by the ONU, the configuration file according to the URI, to obtain the flow table information from the configuration file. receiving, by an optical network unit, ONU, an optical network terminal, management and control interface, OMCI, protocol packet sent by an optical line terminal, OLT, the ONU is configured to connect to user equipment, and the OLT is configured to connect the ONU to an Internet Protocol, IP, network, wherein the GPON or next-generation GPON is between the ONU and the OLT; obtaining, by the ONU, flow table information according to the OMCI protocol packet, wherein the flow table information comprises a match field and an instruction, and generating, by the ONU, a flow table entry according to the flow table information, wherein the flow table entry comprises the match field and the instruction; receiving, by the ONU, a service packet sent by the user equipment; and determining, by the ONU, a matching flow table entry according to the service packet, and when the matching flow table entry is the generated flow table entry, processing the service packet according to the instruction in the generated flow table entry; the method being characterized in that the OMCI protocol packet carries a uniform resource identifier, URI of a configuration file, and the OMCI protocol packet comprises a second message identifier, where the second message identifier is used to identify that the OMCI protocol packet carries the URI; and the obtaining, by the ONU, flow table information according to the OMCI protocol packet comprises: when the ONU determines that the OMCI protocol packet carries the second message identifier, accessing, by the ONU, the configuration file according to the URI, to obtain the flow table information from the configuration file.