Disclosure of Invention
In order to solve the problem that in the prior art, when the aging time of an MAC address table of a two-layer network device is shorter than that of an ARP table of a three-layer network device, downlink data broadcast by the two-layer network device occurs, so that network congestion may be caused, and further, services are damaged, the application provides a method and a device for processing the aging time of the MAC address table. The technical scheme is as follows:
in a first aspect, a method for processing an aging time of a MAC address table is provided, where the method is applied to a layer-two network device included in a layer-two network, and the method includes:
determining the aging time of an ARP (address resolution protocol) table of target three-layer network equipment, wherein the target three-layer network equipment refers to three-layer network equipment which is directly connected with the two-layer network equipment in a three-layer network interconnected with the two-layer network;
based on the aging time of the ARP table, changing the stored aging time information of the MAC address table into first aging time information, wherein the aging time indicated by the first aging time information is greater than or equal to the aging time of the ARP table of the target three-layer network equipment;
and transmitting the first aging time information to other two-layer network equipment except the two-layer network equipment in the two-layer network, and changing the stored aging time information of the MAC address table into the first aging time information by the other two-layer network equipment.
The two-layer network is a two-layer network device which can be directly connected with a three-layer network device in the two-layer network, and the target three-layer network device can be a gateway device in the three-layer network and the like.
In the embodiment of the invention, the aging time of the ARP table of the target three-layer network equipment can be automatically adjusted according to the aging time of the ARP table of the target three-layer network equipment, so that the condition that the aging time of the MAC address table of the two-layer network equipment is less than that of the ARP table of the three-layer network equipment is avoided, and network congestion and service damage caused by downlink data broadcasting and downlink data broadcasting are avoided.
In another embodiment, the determining the aging time of the address resolution protocol, ARP, table of the target three-layer network device comprises:
receiving an ARP message sent by the target three-layer network equipment;
obtaining decimal numbers corresponding to binary numbers in the operation type field of the ARP message;
and when the decimal number is a preset value, acquiring information in an address attribute field of the ARP message, and determining the aging time of an ARP table of the target three-layer network equipment based on the information in the address attribute field, wherein the address attribute field comprises a source address field, a destination address field, a source network protocol field or a destination network protocol field.
The ARP message is obtained by modifying the format of the existing ARP message. In the embodiment of the invention, a preset numerical value capable of indicating the aging time of the ARP table is set in the operation type field of the existing ARP message, when the decimal number corresponding to the binary number in the operation type field is the preset numerical value, the aging time information of the ARP table of the target three-layer network equipment is included in the address attribute field of the ARP message, and at the moment, the aging time information of the ARP table of the target three-layer network equipment can be obtained from the address attribute field.
In the embodiment of the invention, the target three-layer network equipment actively informs the aging time of the ARP table to the two-layer network equipment by sending the ARP message to the two-layer network equipment, so that the two-layer network equipment can adjust the aging time of the MAC address table according to the aging time of the ARP table actively informed by the target three-layer network equipment, and the adjustment efficiency of the two-layer network equipment is improved.
In another embodiment, the determining the aging time of the address resolution protocol, ARP, table of the target three-layer network device comprises:
receiving a plurality of ARP detection messages sent by the target three-layer network equipment;
determining a transmission time interval between any two ARP detection messages which are continuously transmitted in the plurality of ARP detection messages;
and determining the sending time interval as the aging time of the ARP table of the target three-layer network equipment.
The ARP detection messages are sent to the MAC addresses stored in the ARP table by the two-layer network equipment at intervals of specified time, the specified time is the time indicated by the aging time of the ARP table of the target three-layer network equipment, and the ARP detection messages are used for detecting whether the MAC addresses stored in the ARP table are still used or not.
In the embodiment of the invention, the ARP detection message in the current network can be monitored, and the aging time of the ARP table is determined by determining the sending time interval of the ARP detection message. Therefore, the target three-layer network equipment does not need to actively inform the aging time of the ARP table of the target three-layer network equipment, and other related protocols and messages do not need to be added in the two-layer network and the three-layer network, so that the processing burden of the target three-layer network equipment and the protocol burden of the network are reduced.
In another embodiment, the changing the stored aging time information of the MAC address table to the first aging time information based on the aging time of the ARP table includes:
determining aging time of an MAC address table based on stored aging time information of the MAC address table;
and when the aging time of the ARP table is greater than the aging time of the MAC address table, determining the first aging time information based on the aging time of the ARP table, and changing the stored aging time information of the MAC address table into the first aging time information.
In the embodiment of the invention, whether the determined aging time of the ARP table is longer than the aging time of the MAC address table is judged, and whether the aging time of the MAC address table needs to be adjusted is determined, so that the possibility that the aging time of the MAC address table can be adjusted when the aging time of a certain target three-layer network device determined in the adjusting process is shorter than the aging time of the changed MAC address table is avoided, and the accuracy of adjusting the aging time of the MAC address table is improved.
In another embodiment, after the transmitting the first aging time information to other layer-two network devices in the layer-two network except the layer-two network device, the method further includes:
when the aging time of the ARP table of the target three-layer network equipment is modified and the aging time of the modified ARP table is larger than the aging time of the ARP table, according to the method for changing the stored aging time information of the MAC address table into first aging time information based on the aging time of the ARP table, the stored aging time information of the MAC address table is changed into second aging time information based on the aging time of the modified ARP table, and the aging time indicated by the second aging time information is larger than the aging time indicated by the first aging time information.
In the embodiment of the invention, when the aging time of the ARP table of the target three-layer network equipment is detected to be modified, the aging time of the MAC address table of the target three-layer network equipment is adjusted according to the aging time of the modified ARP table, so that the dynamic adjustment of the aging time of the MAC address table is realized, and the reasonable configuration of the aging time of the ARP table of the three-layer network equipment and the aging time of the MAC address table of the two-layer network equipment is ensured.
In another embodiment, the communicating the first aging time information to other layer-two network devices in the layer-two network other than the layer-two network device includes:
and transmitting the first aging time information to other two-layer network equipment except the two-layer network equipment in the local area network where the two-layer network equipment is located.
In the embodiment of the invention, the aging time of the MAC address table is synchronously adjusted only in the local area network where the two-layer network equipment is located, thereby avoiding the influence on other local area networks and ensuring the performance of each local area network.
In a second aspect, a device for processing the aging time of the MAC address table is provided, which is applied to a layer two network device included in a layer two network, and the device for processing the aging time of the MAC address table has a function of implementing the behavior of the method for processing the aging time of the MAC address table in the first aspect. The apparatus for processing the aging time of the MAC address table includes at least one module, and the at least one module is configured to implement the method for processing the aging time of the MAC address table provided in the first aspect.
In a third aspect, a device for processing the aging time of the MAC address table is provided, where the structure of the device for processing the aging time of the MAC address table includes a processor and a memory, and the memory is used for storing a program for supporting the device for processing the aging time of the MAC address table to execute the method for processing the aging time of the MAC address table provided in the first aspect, and storing data related to the method for implementing the method for processing the aging time of the MAC address table provided in the first aspect. The processor is configured to execute programs stored in the memory. The operating means of the memory device may further comprise a communication bus for establishing a connection between the processor and the memory.
In a fourth aspect, there is provided a computer-readable storage medium, which stores therein instructions that, when executed on a computer, cause the computer to perform any one of the methods for processing an aging time of a MAC address table described in the first aspect.
In a fifth aspect, there is provided a computer program product containing instructions which, when run on a computer, cause the computer to perform any of the methods for processing aging time of a MAC address table as described in the first aspect above.
The technical effects obtained by the second, third, fourth and fifth aspects are similar to the technical effects obtained by the corresponding technical means in the first aspect, and are not described herein again.
The beneficial effect that technical scheme that this application provided brought is:
in the embodiment of the invention, the two-layer network equipment can determine the aging time of the ARP table of the three-layer network equipment directly connected with the two-layer network equipment, then change the aging time of the MAC address table of the two-layer network equipment into the first aging time which is larger than or equal to the aging time of the ARP table, and transmit the first aging time information to other two-layer network equipment of the two-layer network, so that the other two-layer network equipment also changes the aging time information of the MAC address table of the two-layer network equipment into the first aging time. Therefore, the two-layer network equipment can automatically adjust the aging time of the MAC address table of the two-layer network equipment according to the aging time of the ARP table of the three-layer network equipment, so that the condition that the aging time of the MAC address table of the two-layer network equipment is smaller than the aging time of the ARP table of the three-layer network equipment is avoided, and then the broadcast of downlink data and network congestion and service damage caused by the broadcast of the downlink data are avoided.
Detailed Description
To make the objects, technical solutions and advantages of the present application more clear, embodiments of the present application will be described in further detail below with reference to the accompanying drawings.
Before describing embodiments of the present invention in detail, an environment for implementing embodiments of the present invention will be described.
Fig. 1A is a schematic structural diagram of a communication network according to an embodiment of the present invention, and as shown in fig. 1A, the communication network includes a two-layer network 10 and a three-layer network 20. Where the two-layer network 10 includes a plurality of cascaded two-layer network devices 11, the three-layer network 20 may include a plurality of cascaded three-layer network devices 21. Furthermore, some of these three-layer network devices 31 are gateway devices through which the two-layer network 10 and the three-layer network 20 can interconnect.
Each two-layer network device 11 of the two-layer network devices 11 stores an MAC address table, and data forwarding can be performed based on the stored MAC address table, where the MAC address table stores a correspondence between an MAC address and a port number of the network device. Each two-layer network device 11 also stores the aging time information of the MAC address table, and if any one of the MAC addresses in the table is not used in the corresponding aging time, the MAC address and the related port number are deleted from the table.
Each three-layer network device 21 of the three-layer network devices 21 stores an ARP table, and can forward data based on the stored ARP table, where the ARP table stores a corresponding relationship between an IP address and an MAC address. Each three-layer network device 21 also stores the aging time information of the MAC address table, and if any MAC address in the table is not used in the corresponding aging time, the MAC address and the associated IP address are deleted from the table.
In practical applications, the two-layer network devices 11 may include an exchange, and a Cell Site Gateway (CSG) or a terminal Gateway connected to the exchange; the plurality of three-layer network devices 21 may include a router and a gateway device for connecting to the two-layer network 10, and further, may include a gateway device for connecting to an upper-layer network, and the like. The gateway device in the three-layer network 20 may be a Provider Edge (PE) device, and the switch in the two-layer network 10 may be a Hub (Hub).
Specifically, the two-layer network 10 may be an Access (Access) network or another two-layer network, and the three-layer network 20 may be an Aggregation (Aggregation) network or another three-layer network. A plurality of Local Area networks may be deployed in the two-layer Network 10, that is, a plurality of two-layer Network devices 11 in the two-layer Network 10 may form a plurality of Local Area networks, where the Local Area networks may be Virtual Local Area Networks (VLANs) or Virtual private Local Area Network services, and the like; the three-Layer Network 20 may also deploy a plurality of local area networks, that is, the plurality of two-Layer Network devices 21 in the three-Layer Network 20 may form a plurality of local area networks, and the local area networks may be IP networks or three-Layer Virtual private networks (L3 VPNs).
For convenience of understanding, the communication network will be described below by taking a two-layer network as an access network and a three-layer network as an aggregation network as an example. Fig. 1B is a schematic structural diagram of another communication network provided in the embodiment of the present invention, as shown in fig. 1B, the communication network includes an access network 30 and an aggregation network 40.
The access network 30 includes an exchange 1, an exchange 2, an exchange 3, a base station gateway 1 connected to the exchange 1, a base station gateway 2 connected to the exchange 2, a base station gateway 3 connected to the exchange 3, a base station gateway 4 connected to the base station gateway 1 and the base station gateway 2, and a base station gateway 5 connected to the base station gateway 3. The aggregation network 40 includes a gateway device 1, a gateway device 2, a router 1, a router 2, a gateway device 3, and a gateway device 4. The gateway device 1 is directly connected to the switch 1, and the gateway device 2 is directly connected to the switch 2 and the switch 3, respectively, that is, the aggregation network 40 may be interconnected to the access network 30 through the gateway device 1 and the gateway device 2. In addition, the aggregation network 40 may also be interconnected with an upper layer network through the gateway device 3 and the gateway device 4.
It should be noted that fig. 1B is only an example in which the access network includes 3 switches and 5 base station gateways, and the aggregation network includes 2 routers and 4 gateway devices, but in practical applications, the access network and the aggregation network may also include more or fewer devices, which is not limited in this embodiment of the present invention.
Fig. 1C is a schematic diagram of a network device according to an embodiment of the present invention, where the network device may be a two-layer network device or a three-layer network device. The communication network in fig. 1A or 1B may be implemented by the network device shown in fig. 1C. Referring to fig. 1C, the network device mainly includes a transmitter 101, a receiver 102, a memory 103, a processor 104, and a communication bus 105. Those skilled in the art will appreciate that the structure of the network device shown in fig. 1C does not constitute a limitation to the network device described in the embodiment of the present invention, and in practical applications, the network device described in the embodiment of the present invention may include more or less components than those shown in the drawings, or may combine some components, or may be arranged in different components, and the embodiment of the present invention is not limited thereto.
The transmitter 101 and the receiver 102 are configured to communicate with other devices, for example, the receiver 102 may receive an ARP message or an ARP detection message, or the transmitter 101 may send the ARP message or the ARP detection message to other network devices. The memory 103 may be used to store data, such as an ARP table or a MAC address table, and the memory 103 may also be used to store one or more operating programs and/or modules for performing the aging time processing method of the MAC address table described below.
The processor 104 is a control center of a network device, and the processor 104 may be a general-purpose Central Processing Unit (CPU), a microprocessor, an Application-Specific Integrated Circuit (ASIC), or one or more Integrated circuits for controlling the execution of programs according to embodiments of the present Application. The processor 104 may implement the processing method of the aging time of the MAC address table provided in the following embodiments by running or executing the software program and/or module stored in the memory 103 and calling the data stored in the memory 103.
The communication bus 105 may include a path for transferring information between the processor 104 and the memory 103.
After the description of the implementation environment of the embodiment of the present invention, the following describes in detail a method for processing the aging time of the MAC address table provided in the embodiment of the present invention. Fig. 1D is a flowchart of a method for processing an aging time of a MAC address table according to an embodiment of the present invention, where interaction subjects of the method are a two-layer network device and a three-layer network device, as shown in fig. 1D, the method includes:
step 101: and the target three-layer network equipment refers to the three-layer network equipment which is directly connected with the two-layer network equipment in a three-layer network interconnected with the two-layer network.
The two-layer network device refers to a two-layer network device in a two-layer network directly connected with a three-layer network device, and the target three-layer network device can be a gateway device in a three-layer network. For example, the two-layer network device may be a switch or the like in the two-layer network that is directly connected to a gateway device in the three-layer network.
Specifically, the determining, by the two-layer network device, the aging time of the ARP table of the target three-layer network device may include the following two implementation manners:
the first implementation mode comprises the following steps: the two-layer network equipment receives the ARP message sent by the target three-layer network equipment; obtaining decimal numbers corresponding to binary numbers in an operation Type (OPType) field of the ARP message; and when the decimal number is a preset value, acquiring information in an address attribute field of the ARP message, and determining the aging time of an ARP table of the target three-layer network equipment based on the information in the address attribute field.
That is, a target three-layer network device in the three-layer network directly connected to a two-layer network device may send an ARP packet to the connected two-layer network device, and actively notify the aging time of its own ARP table through the ARP packet, so that the two-layer network device may adjust the aging time of the stored MAC address table according to the notified aging time.
The format of the ARP packet may be an ARP packet format specified in RFC826, or an ARP packet format specified in other standards. The preset value can be set by a protocol between the two-layer network device and the three-layer network device. And when the decimal number corresponding to the binary number in the operation type field is a preset value, the address attribute field of the ARP message is shown to comprise the aging time information of the ARP table of the target three-layer network equipment.
When the two-layer network device receives the ARP message, it may first determine whether the decimal number corresponding to the binary number in the operation type field of the ARP message is a preset value, and when the decimal number is the preset value, it may be determined that the address attribute field of the ARP message includes the aging time information of the ARP table of the target three-layer network device, and obtain information from the address attribute field, and determine the obtained information as the aging time information of the ARP table.
It should be noted that, since the decimal numbers 1 and 2 corresponding to the binary numbers in the current operation type field are already defined in advance, where 1 represents a request (request) and 2 represents a response (Reply), the preset value may be a decimal number other than 1 and 2 that meets the requirement. For example, the preset value may be any one of 3 to 16, and the like.
The Address attribute field includes a Source Address (SA) field, a Destination Address (DA) field, a Source network protocol (Source IP, SIP) field, or a Destination network protocol (DIP) field. And when the address attribute field is one of the SA field, the DA field, the SIP field, and the DIP field, if the decimal number corresponding to the binary number in the operation type field is a preset value, the content in the field is the aging time information of the ARP table, and the other fields are assigned with 0.
TABLE 1
Table 1 is a schematic diagram of an ARP packet format provided in this embodiment of the present invention, where row 3 in the table indicates names of fields included in the ARP packet, and row 3 indicates the number of bytes of corresponding fields. As shown in table 1 above, the ARP message includes an OPType field of 2 bytes.
In the embodiment of the present invention, a preset value 7 may be set for the OPType field, where the preset value 7 is aging _ time, and indicates that the ARP packet carries aging time information of the ARP table, and the address attribute field may be set as a DIP field, where when the decimal number corresponding to the binary number in the OPType field is 7, the content in the DIP field is the aging time information of the ARP table, and values in the remaining address attribute fields SA field, DA field, and SIP field are 0.
Further, in order to avoid that the aging time of the ARP table of the target three-layer network device is changed, the target three-layer network device may also send an ARP packet to the directly connected two-layer network device every preset time period, so as to periodically notify the aging time of the ARP table to the connected two-layer network device, so that the two-layer network device can correspondingly adjust the aging time of the stored MAC address table along with the change of the aging time of the ARP table of the target three-layer network device.
It should be noted that, the embodiment of the present invention is only described by taking the example of sending the first aging time information through the ARP packet, and in practical applications, the first aging time information may also be sent through other manners or other packets, which is not limited in this embodiment of the present invention.
The second implementation mode comprises the following steps: receiving a plurality of ARP detection messages sent by the target three-layer network equipment; determining the sending time interval between any two ARP detection messages sent continuously in the plurality of ARP detection messages; and determining the sending time interval as the aging time of the ARP table of the target three-layer network device.
The ARP detection messages are sent to the MAC addresses stored in the ARP table by the two-layer network equipment every other specified time, the specified time is the time indicated by the aging time of the ARP table of the target three-layer network equipment, and the ARP detection messages are used for detecting whether the MAC addresses stored in the ARP table are still used or not.
That is, for the ARP table of the target three-layer network device, the target three-layer network device will send an ARP detection packet to each MAC address stored in the ARP table every specified time period, so as to detect whether each MAC address stored in the ARP table is still used. Specifically, the target three-layer network device may send the ARP detection packet before the aging time of the ARP table is reached in each aging period, and may refresh the ARP table by sending the ARP detection packet.
After the target three-layer network device sends an ARP detection message to a certain MAC address stored in an ARP table, when the response of the MAC address is received, the MAC address can be determined to be still used, when the response of the MAC address is not received, the MAC address can be determined to be not used, and the related information of the MAC address is deleted from the ARP table, so that the ARP table can be refreshed. The related information of the MAC address may include the MAC address and a corresponding IP address, etc.
It should be noted that the MAC address stored in the ARP table of the target three-layer network device is generally the MAC address of the base station or the terminal in the physical layer network, and when sending the ARP detection message to the stored MAC address, the ARP detection message will be sent to the corresponding MAC address again through the two-layer network device in the two-layer network. Therefore, the two-layer network device can monitor the ARP detection message sent by the target three-layer network device, and determine the sending time interval between any two monitored ARP detection messages sent consecutively, and the sending time interval is the aging time of the ARP table of the target three-layer network device.
For example, the two-layer network device may sample a plurality of downlink data in the local area network where the two-layer network device is located, determine the destination MAC addresses of the downlink data, obtain a plurality of MAC addresses, then monitor the ARP detection messages corresponding to the MAC addresses, determine the sending time interval of the corresponding ARP detection messages, and determine the determined sending time interval as the aging time of the ARP table of the corresponding target three-layer network device.
In practical applications, in order to ensure detection accuracy, some target three-layer network devices may send an ARP detection packet multiple times in each aging period, and may mark the ARP detection packet sent each time, for example, the ARP detection packet sent for the first time in each aging period may be marked with 1, and the ARP detection packet sent for the second time may be marked with 2, and so on. In this case, the transmission time interval between ARP probe messages with the same tag sent in any two consecutive aging periods of a plurality of ARP probe messages may be determined, and the transmission time interval may be determined as the aging time of the ARP table. Wherein, the aging period refers to the time length indicated by the aging time of the ARP table.
Further, the ARP detection message may also be an ARP request message. For example, some target three-layer network devices may send multiple ARP detection messages and 1 ARP request message in each aging period, and at this time, the ARP request message may be processed as an ARP detection message in the above manner.
Step 102: and the two-layer network equipment changes the stored aging time information of the MAC address table into first aging time information based on the aging time of the ARP table, wherein the aging time indicated by the first aging time information is greater than or equal to the aging time of the ARP table of the target three-layer network equipment.
Because the aging time of the changed MAC address table is greater than or equal to the aging time of the ARP table of the target three-layer network device, the situation that a certain MAC address in the MAC address table of the two-layer network device is aged and deleted from the MAC address table but the MAC address is not aged in the ARP table on the target three-layer network device and is still stored in the ARP table can not occur in the subsequent data transmission process, so that the downlink data broadcast by the two-layer network device can be avoided, and the network congestion and the service damage caused by the downlink data broadcast can be avoided.
Specifically, the two-layer network device may determine a first aging time whose aging time is greater than or equal to the aging time of the ARP table based on the aging time of the ARP table, and then change the stored aging time information of the MAC address table to the first aging time information.
The two-layer network device may determine the first aging time based on the aging time of the ARP table and a preset rule. For example, the first aging time may be determined based on the aging time of the ARP table by the following formula:
time2 ═ time1+ X min, or time2 ═ time1 × Y;
wherein, time2 is the first aging time, time1 is the aging time of the ARP table, X is greater than or equal to 0, and Y is greater than or equal to 1. For example, X may be 5, 10, 15, etc., and Y may be 1.5, 1.8, 2, etc.
Further, in order to avoid that the aging time of a certain target three-layer network device is less than the aging time of the changed MAC address table during the adjustment process, and to ensure the accuracy of the adjustment of the aging time of the MAC address table, the aging time of the MAC address table may be determined based on the stored aging time information of the MAC address table, and when the determined aging time of the ARP table of the target three-layer network device is greater than the aging time of the MAC address table, the first aging time information is determined based on the aging time of the ARP table, and the stored aging time information of the MAC address table is changed into the first aging time information.
That is, after determining the aging time of the ARP table of the target three-layer network device, it may be determined whether the aging time of the ARP table is greater than the aging time of the MAC address table of the target three-layer network device, if so, the aging time of the MAC address table of the target three-layer network device is changed, and if not, the aging time of the MAC address table of the target three-layer network device is not changed.
Step 103: and the two-layer network equipment transmits the first aging time information to other two-layer network equipment except the two-layer network equipment in the two-layer network, and the other two-layer network equipment changes the stored aging time information of the MAC address table into the first aging time information.
Specifically, the transmitting, by the layer-two network device, the first aging time information to other layer-two network devices in the layer-two network except the layer-two network device may include: the two-layer network equipment sends the first aging time information to neighbor equipment of the two-layer network equipment, the neighbor equipment of the two-layer network equipment changes the stored aging time information of the MAC address table into the first aging time information and sends the first aging time information to the neighbor equipment of the two-layer network equipment, so that the first aging time information is gradually transmitted to next-layer equipment according to the network topology structure of the two-layer network, and the first aging time information can be transmitted to other two-layer network equipment except the two-layer network equipment in the two-layer network. For each layer-two network device in the layer-two network, the neighbor device of the layer-two network device refers to a next layer-two network device directly connected to the layer-two network device.
The two-layer network device may transmit the first aging time information to the other two-layer network devices through an MAC aging time synchronization message, where the MAC aging time synchronization message carries the first aging time information and is used to indicate that the two-layer network device receiving the message changes the stored aging time information of the MAC address table into the first aging time information, and send the message to the neighboring device.
Further, the two-layer network may include a plurality of local area networks, and in this case, the two-layer network device may also transmit the first aging time information to other two-layer network devices in the local area network in which the two-layer network device is located, except for the two-layer network device. That is, only the first aging time information is transmitted in the local area network, so that only the aging time of the MAC address table of the two-layer network device in the local area network is changed.
For example, when the local area network where the two-layer network device is located is the VPLS network, after determining the aging time1 of the ARP table of the target three-layer network device, the two-layer network device directly connected to the target three-layer network device may send a MAC aging time synchronization message to all VPLS PEER neighbors, and after receiving the message, other neighbor devices may continue to send the message to peripheral neighbor devices, and the process is similar to MAC-without message flooding, so that the message can be known to the entire network of the VPLS network where the message is located, and the aging time of the MAC address table of the two-layer network device in the entire VPLS broadcast domain is changed to be time2 greater than or equal to time 1. Further, the MAC aging time synchronization packet may not be forwarded to an AC (access Circuit) side interface, but may be forwarded only between PWs (Pseudo wires).
For another example, when the local area network in which the two-layer network device is located is a VLAN network, after determining the aging time1 of the ARP table of the target three-layer network device, the two-layer network device may transmit the MAC aging time synchronization packet to all other members of the VLAN network. Further, if the VLAN network deploys an STP (Spanning Tree Protocol) device, the MAC aging time synchronization packet may not be forwarded to an edge port of the STP device.
Further, after the first aging time information is transmitted to other two-layer network devices in the two-layer network except the two-layer network device, when the two-layer network device detects that the aging time of the ARP table of the target three-layer network device is modified and the aging time of the modified ARP table is greater than the aging time of the ARP table, the stored aging time information of the MAC address table may be changed into the first aging time information according to the aging time based on the ARP table, and the stored aging time information of the MAC address table may be changed into the second aging time information based on the aging time of the modified ARP table, where the aging time indicated by the second aging time information is greater than the aging time indicated by the first aging time information.
That is, the aging time of the ARP table of the target three-layer network device directly connected to the two-layer network device may be modified, and in the above manner, when the aging time of the ARP table of the target three-layer network device is modified, the two-layer network device may further adjust the aging time of the stored MAC address table according to the modified aging time of the ARP table.
The aging time indicated by the second aging time information is not only greater than the aging time indicated by the first aging time information, but also greater than or equal to the aging time after the ARP table of the target three-layer network device is modified.
When a plurality of target three-layer network devices directly connected with the two-layer network device are provided, whenever an ARP message or a plurality of detection messages sent by any one target three-layer network device are received, the aging time of the ARP table of the target three-layer network device can be determined based on the received ARP message or the plurality of detection messages, the fact that the aging time of the ARP table of the target three-layer network device is modified is determined, the aging time of the ARP table of the target three-layer network device is determined as the aging time of the modified ARP table, and the aging time of the stored MAC address table is correspondingly adjusted according to the aging time of the modified ARP table.
In the embodiment of the invention, the two-layer network equipment can determine the aging time of the ARP table of the three-layer network equipment directly connected with the two-layer network equipment, then change the aging time of the MAC address table of the two-layer network equipment into the first aging time which is larger than or equal to the aging time of the ARP table, and transmit the first aging time information to other two-layer network equipment of the two-layer network, so that the other two-layer network equipment also changes the aging time information of the MAC address table of the two-layer network equipment into the first aging time. Therefore, the two-layer network equipment can automatically adjust the aging time of the MAC address table of the two-layer network equipment according to the aging time of the ARP table of the three-layer network equipment, so that the condition that the aging time of the MAC address table of the two-layer network equipment is smaller than the aging time of the ARP table of the three-layer network equipment is avoided, and network congestion and service damage caused by downlink data broadcasting and downlink data broadcasting are avoided.
After describing the method for processing the aging time of the MAC address table in detail according to the embodiment of the present invention, a device for processing the aging time of the MAC address table will be described with reference to the accompanying drawings. Fig. 2A is a block diagram of an apparatus for processing an aging time of a MAC address table according to an embodiment of the present invention, where the apparatus may be a layer-two network device included in a layer-two network. Referring to fig. 2A, the apparatus includes:
a determining module 210, configured to perform the operation performed in step 101 in the embodiment of fig. 1D;
a first modification module 220, configured to perform the operations performed in step 102 in the embodiment of fig. 1D;
a transfer module 230, configured to perform the operations performed in steps 103 and 104 in the embodiment of fig. 1D.
Optionally, referring to fig. 2B, the determining module 210 includes:
a first receiving unit 211, configured to receive an ARP packet sent by the target three-layer network device;
a first obtaining unit 212, configured to obtain a decimal number corresponding to a binary number in the operation type field of the ARP packet;
a second obtaining unit 213, configured to obtain information in an address attribute field of the ARP packet when the decimal number is a preset value, and determine the aging time of the ARP table of the target three-layer network device based on the information in the address attribute field, where the address attribute field includes a source address field, a destination address field, a source network protocol field, or a destination network protocol field.
Optionally, referring to fig. 2C, the determining module 210 includes:
a second receiving unit 214, configured to receive multiple ARP detection messages sent by the target three-layer network device;
the ARP detection messages are sent to the MAC addresses stored in the ARP table by the two-layer network equipment every other specified time, the specified time is the time indicated by the aging time of the ARP table of the target three-layer network equipment, and the ARP detection messages are used for detecting whether the MAC addresses stored in the ARP table are still used;
a first determining unit 215, configured to determine a transmission time interval between any two consecutive ARP detection messages in the plurality of ARP detection messages;
a second determining unit 216, configured to determine the sending time interval as the aging time of the ARP table of the target three-layer network device.
Optionally, referring to fig. 2D, the first modification module 220 includes:
a third determining unit 221, configured to determine an aging time of the MAC address table based on the stored aging time information of the MAC address table;
a changing unit 222, configured to determine the first aging time information based on the aging time of the ARP table when the aging time of the ARP table is greater than the aging time of the MAC address table, and change the stored aging time information of the MAC address table to the first aging time information.
Optionally, referring to fig. 2E, the apparatus further comprises:
a second changing module 240, configured to, when it is detected that the aging time of the ARP table of the target three-layer network device is modified and the aging time of the modified ARP table is greater than the aging time of the ARP table, change the stored aging time information of the MAC address table to the first aging time information according to the aging time based on the ARP table, and change the stored aging time information of the MAC address table to the second aging time information according to the aging time of the modified ARP table, where the aging time indicated by the second aging time information is greater than the aging time indicated by the first aging time information.
Optionally, the transferring module 230 is configured to:
and transmitting the first aging time information to other two-layer network equipment except the two-layer network equipment in the local area network where the two-layer network equipment is located.
In the embodiment of the invention, the two-layer network equipment can determine the aging time of the ARP table of the three-layer network equipment directly connected with the two-layer network equipment, then change the aging time of the MAC address table of the two-layer network equipment into the first aging time which is larger than or equal to the aging time of the ARP table, and transmit the first aging time information to other two-layer network equipment of the two-layer network, so that the other two-layer network equipment also changes the aging time information of the MAC address table of the two-layer network equipment into the first aging time. Therefore, the two-layer network equipment can automatically adjust the aging time of the MAC address table of the two-layer network equipment according to the aging time of the ARP table of the three-layer network equipment, so that the condition that the aging time of the MAC address table of the two-layer network equipment is smaller than the aging time of the ARP table of the three-layer network equipment is avoided, and network congestion and service damage caused by downlink data broadcasting and downlink data broadcasting are avoided.
It should be noted that: the aging time processing apparatus for a MAC address table provided in the foregoing embodiment, when processing the aging time of the MAC address table, only the division of each functional module is illustrated, and in practical applications, the function allocation may be completed by different functional modules according to needs, that is, the internal structure of the apparatus may be divided into different functional modules, so as to complete all or part of the functions described above. In addition, the embodiment of the aging time processing apparatus for the MAC address table and the embodiment of the aging time processing method for the MAC address table provided in the foregoing embodiments belong to the same concept, and specific implementation processes thereof are detailed in the method embodiments and are not described herein again.
In the above embodiments, the implementation may be wholly or partly realized by software, hardware, firmware, or any combination thereof. When implemented in software, may be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When loaded and executed on a computer, cause the processes or functions described in accordance with embodiments of the invention, to occur, in whole or in part. The computer may be a general purpose computer, a special purpose computer, a network of computers, or other programmable device. The computer instructions may be stored on a computer readable storage medium or transmitted from one computer readable storage medium to another, for example, from one website, computer, server, or data center to another website, computer, server, or data center via wire (e.g., coaxial cable, fiber optic, Digital Subscriber Line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.). The computer-readable storage medium can be any available medium that can be accessed by a computer or a data storage device, such as a server, a data center, etc., that incorporates one or more of the available media. The usable medium may be a magnetic medium (e.g., floppy Disk, hard Disk, magnetic tape), an optical medium (e.g., Digital Versatile Disk (DVD)), or a semiconductor medium (e.g., Solid State Disk (SSD)), among others.
That is, an embodiment of the present invention further provides a computer-readable storage medium, where instructions are stored in the computer-readable storage medium, and when the instructions are executed on a computer, the computer is enabled to execute the method for processing the aging time of the MAC address table according to the embodiment in fig. 1D.
An embodiment of the present invention further provides a computer program product including instructions, which when run on a computer, causes the computer to execute the method for processing the aging time of the MAC address table according to the embodiment of fig. 1D.
It will be understood by those skilled in the art that all or part of the steps for implementing the above embodiments may be implemented by hardware, or may be implemented by a program instructing relevant hardware, where the program may be stored in a computer-readable storage medium, and the above-mentioned storage medium may be a read-only memory, a magnetic disk or an optical disk, etc.
The above-mentioned embodiments are provided not to limit the present application, and any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included in the protection scope of the present application.