The invention discloses an embedded
Ethernet port expansion method based on a VLAN (Virtual
Local Area Network) and a switch
chip, which comprises the following steps of: physically connecting a unique physical
Ethernet interface of a main
control unit with a convergence port of a two-layer switch
chip, and connecting other ports of the switch
chip as expansion interfaces to an external
client; the main
control unit issues a configuration instruction by simulating an SMI protocol through GPIO, sets a convergence port to be in a
Trunk mode, sets an expansion interface to be in an Access mode, and allocates an independent VLAN identifier; and creating a
virtual network interface in the main
control unit protocol stack and binding the
virtual network interface with the VLAN. During communication, the main control unit receives and transmits a data frame with a VLAN
label, and the exchange chip forwards data between the convergence port and the corresponding expansion interface according to the
label and automatically completes adding and stripping of the
label. According to the invention, hardware cost, size and
power consumption can be effectively reduced, MCU resources are saved, and high-performance expansion and data isolation of multiple network ports are realized.