CN112422447B - Method and device for selecting member port - Google Patents

Method and device for selecting member port Download PDF

Info

Publication number
CN112422447B
CN112422447B CN202011272908.XA CN202011272908A CN112422447B CN 112422447 B CN112422447 B CN 112422447B CN 202011272908 A CN202011272908 A CN 202011272908A CN 112422447 B CN112422447 B CN 112422447B
Authority
CN
China
Prior art keywords
ethernet frame
header
protocol
switch
address
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202011272908.XA
Other languages
Chinese (zh)
Other versions
CN112422447A (en
Inventor
闫波
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
New H3C Technologies Co Ltd Hefei Branch
Original Assignee
New H3C Technologies Co Ltd Hefei Branch
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by New H3C Technologies Co Ltd Hefei Branch filed Critical New H3C Technologies Co Ltd Hefei Branch
Priority to CN202011272908.XA priority Critical patent/CN112422447B/en
Publication of CN112422447A publication Critical patent/CN112422447A/en
Application granted granted Critical
Publication of CN112422447B publication Critical patent/CN112422447B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L47/00Traffic control in data switching networks
    • H04L47/10Flow control; Congestion control
    • H04L47/12Avoiding congestion; Recovering from congestion
    • H04L47/125Avoiding congestion; Recovering from congestion by balancing the load, e.g. traffic engineering
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L12/00Data switching networks
    • H04L12/28Data switching networks characterised by path configuration, e.g. LAN [Local Area Networks] or WAN [Wide Area Networks]
    • H04L12/2854Wide area networks, e.g. public data networks
    • H04L12/2856Access arrangements, e.g. Internet access
    • H04L12/2869Operational details of access network equipments
    • H04L12/287Remote access server, e.g. BRAS

Abstract

The application provides a method and a device for selecting a member port, comprising the following steps: receiving an Ethernet frame; if the message carried by the Ethernet frame is a PPPoE session message, determining the position information of an IP head carried by the PPPoE session message in the Ethernet frame when determining that a protocol corresponding to the load of the PPPoE session message is an IP protocol, and acquiring the IP head from the Ethernet frame according to the position information; calculating hash parameters of information in the IP header; and selecting a matched member port from the aggregation output interface corresponding to the Ethernet frame based on the calculated hash parameter, and using the member port as a member port for forwarding the Ethernet frame. Since the switch can analyze the IP header in the PPPoE message from the ethernet frame, the information of the IP header can be calculated and hashed to select the member port. Because the IP heads of different messages are different, the member ports can be uniformly selected, and the load sharing of the flow forwarding of each member port is realized.

Description

Method and device for selecting member port
Technical Field
The present application relates to the field of computer communications, and in particular, to a method and an apparatus for selecting a member port.
Background
PPPoE (Point to Point Protocol over Ethernet, Point to Point communication based on local area network) is a technology that provides Access service for hosts on the Ethernet through a Remote Access device BRAS (Broadband Remote Access Server), and can implement control and charging for each host that is connected.
As shown in fig. 1, in PPPoE networking, a host accesses a BRAS device through a two-layer network. Switches in the layer two network are used for forwarding Ethernet frames sent by the host. In the existing forwarding process, when an egress interface of an ethernet frame is an aggregation egress interface, a switch selects a member port from the aggregation egress interface by hashing a MAC address.
However, in the two-layer network, due to some reasons such as a networking mode of the two-layer network, source and destination MAC addresses of many ethernet frames are the same, which causes member ports selected by the switch through the hash of the MAC addresses to be the same, thereby causing that the member ports are not uniformly selected, and causing that traffic forwarded by each member port is unbalanced.
Disclosure of Invention
In view of this, the present application provides a method and an apparatus for selecting a member port, which are used to implement uniform selection of the member port.
Specifically, the method is realized through the following technical scheme:
according to a first aspect of the present application, there is provided a method for selecting a member port, the method being applied to a switch, the method including:
receiving an Ethernet frame;
if the message carried in the Ethernet frame is a PPPoE session message, determining the position information of an IP head carried in the PPPoE session message in the Ethernet frame when determining that a protocol corresponding to the load of the PPPoE session message is an IP protocol, and acquiring the IP head from the Ethernet frame according to the position information;
calculating hash parameters of information in the IP header;
and selecting a matched member port from the aggregation output interface corresponding to the Ethernet frame based on the calculated hash parameter, and using the member port as a member port for forwarding the Ethernet frame.
According to a second aspect of the present application, there is provided an apparatus for selecting a member port, the apparatus being applied to a switch, the apparatus including:
a receiving unit for receiving an Ethernet frame;
a determining unit, configured to determine, if the packet carried in the ethernet frame is a PPPoE session packet, location information of an IP header carried in the PPPoE session packet in the ethernet frame when it is determined that a protocol corresponding to a load of the PPPoE session packet is an IP protocol, and obtain the IP header from the ethernet frame according to the location information;
a selection unit for calculating hash parameters for information in the IP header; and selecting a matched member port from the aggregation output interface corresponding to the Ethernet frame based on the calculated hash parameter, and using the member port as a member port for forwarding the Ethernet frame.
As can be seen from the above description, since the switch can parse the IP header in the PPPoE message from the ethernet frame, the hash parameter can be calculated for the information of the IP header to select the member port. Because the information of the IP heads of different messages is different, the member ports can be uniformly selected, and the load sharing of the flow forwarding of each member port is realized.
Drawings
Fig. 1 is a diagram illustrating a PPPoE networking architecture in accordance with an exemplary embodiment of the present application;
fig. 2 is a schematic diagram illustrating a format of an ethernet frame carrying a PPPoE message according to an exemplary embodiment of the present application;
FIG. 3 is a flow chart illustrating a method for member port selection in accordance with an exemplary embodiment of the present application;
fig. 4 is a schematic diagram of ethernet frame forwarding processing logic according to an exemplary embodiment of the present application;
FIG. 5 is a hardware block diagram of a switch shown in an exemplary embodiment of the present application;
fig. 6 is a block diagram illustrating a member port selection apparatus according to an exemplary embodiment of the present application.
Detailed Description
Reference will now be made in detail to the exemplary embodiments, examples of which are illustrated in the accompanying drawings. When the following description refers to the accompanying drawings, like numbers in different drawings represent the same or similar elements unless otherwise indicated. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present application. Rather, they are merely examples of apparatus and methods consistent with certain aspects of the present application, as detailed in the appended claims.
The terminology used herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the application. As used in this application and the appended claims, the singular forms "a", "an", and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise. It should also be understood that the term "and/or" as used herein refers to and encompasses any and all possible combinations of one or more of the associated listed items.
It is to be understood that although the terms first, second, third, etc. may be used herein to describe various information, such information should not be limited to these terms. These terms are only used to distinguish one type of information from another. For example, first information may also be referred to as second information, and similarly, second information may also be referred to as first information, without departing from the scope of the present application. The word "if" as used herein may be interpreted as "at … …" or "when … …" or "in response to a determination", depending on the context.
The application provides a method for selecting a member port, which is characterized in that when a switch identifies that a message carried by an Ethernet frame is a PPPoE session message, if a protocol corresponding to a load of the PPPoE session message is determined to be an IP protocol, position information of an IP head carried by the PPPoE session message in the Ethernet frame is determined, the IP head is obtained from the Ethernet frame according to the position information, and a hash parameter is calculated for information in the IP head by changing an analysis flow in the switch. And the switch selects a matched member port from the aggregation output interface corresponding to the Ethernet frame based on the calculated hash parameter, and the matched member port is used as a member port for forwarding the Ethernet frame.
Since the switch can analyze the IP header in the PPPoE message from the ethernet frame, the hash parameter can be calculated for the information of the IP header to select the member port. Because the IP headers in different messages are different, the member ports can be uniformly selected, and the load sharing of the flow forwarding of each member port is realized.
In addition, the switch can analyze the IP header and replace the information before the IP header in the ethernet frame with a new MAC header when determining that the forwarding header is the IP header, so the switch of the present application can also be used as a device for forwarding a forwarding plane of a BRAS that is separated by forwarding control, thereby implementing two-layer forwarding of terminating the ethernet frame and performing three-layer forwarding on a PPPoE message in the ethernet frame.
Since the method provided by the present application relates to the analysis of ethernet frames, the following describes in detail the format of ethernet frames carrying PPPoE messages.
Referring to fig. 2, fig. 2 is a schematic diagram illustrating a format of an ethernet frame carrying a PPPoE packet according to an exemplary embodiment of the present application.
1) As shown in fig. 2, the ethernet frame includes: a MAC header and a payload portion of an ethernet frame. The payload portion of the ethernet frame carries a PPPoE Packet (i.e., PPPoE Packet in fig. 2).
The MAC header includes: a Destination MAC address (i.e., Destination _ address), a Source MAC address (i.e., Source _ address), and an ethernet type (i.e., ethernet).
Destination MAC address: namely, Destination _ address shown in fig. 2, has a length of 48 bits.
Source MAC address: i.e., Source _ address, shown in fig. 2, is 48bits in length.
The Ethernet type: i.e., ethertype in fig. 2, ethertype is used to specify the protocol Type of the data carried by the payload portion of the ethernet frame. For example, when the value of ethertype is 0x0800, it indicates that the ethernet frame carries an IPv4 message; when the Ether type value is 0x86DD, the Ethernet frame is indicated to carry the IPv6 message; when the Ether type value is 0x8864, the Ethernet frame is indicated to carry a PPPoE session message; when the value of the Ether type is 0x8863, it indicates that the ethernet frame carries a packet of a PPPoE discovery stage or a delinking stage.
2) PPPoE message: PPPEE head and PPPoE message load part.
Wherein, PPPoE head includes: ver, Type, Code, Session _ ID, Length, and PPPoE payload section. The load part of the PPPoE message carries a PPP message.
Ver (version), which occupies 4bits, PPPoE version number, usually takes the value 0x 1.
Type, length 4bits, PPPoE Type, value 0x 1.
Code (PPPoE message type) with the length of 8 bits. When the Code value is 0x00, the PPPoE message is indicated as a session message. When the Code value is 0x09, the PPPoE message is a PADI (PPPoE Active Discovery Initiation) message. When the Code value is 0x19, the PPPoE message is a PADR (PPPoE Active Discovery Request) message, and the like.
Session ID (Session ID), which is 16bits in length, is used to identify a PPP (Point to Point Protocol) Session.
Length, Length is 16bits, and defines the Length of the PPPoE payload section.
The payload portion of the PPPoE message carries a PPP message (i.e., PPP Packet in fig. 2).
3) PPP message
As shown in fig. 2, the PPP message includes: a PPP header and a PPP message payload section.
Wherein, PPP head includes at least: protocol field and payload section of PPP message.
And the Protocol field is used for indicating the Protocol type of the message carried by the PPP message loading part. For example, the value of the Protocol field is 0 × 0021, which indicates that the Protocol type of the packet carried by the PPP packet payload section is the IP Protocol. For example, the value of the Protocol field is 0 × C021, which indicates that the Protocol type of the packet carried in the PPP packet payload part is an LCP (Link Control Protocol).
When the value of the Protocol field is 0 × 0021, the PPP Packet payload section carries an IP Protocol Packet (such as the IP Packet shown in fig. 2). The IP protocol packet includes an IP header and a payload portion of the IP packet.
After introducing the frame format of the ethernet frame carrying the PPPoE packet, the following describes in detail the member port selection method provided in the present application.
Referring to fig. 3, fig. 3 is a flowchart illustrating a member port selection method according to an exemplary embodiment of the present application, which may be applied to a switch.
It should be noted that the switch may be deployed in a two-layer network connected to a BRAS device as shown in fig. 1. The switch is deployed in a two-layer network, so that the switch can analyze an IP (Internet protocol) head carried by an Ethernet frame after receiving the Ethernet frame carrying a PPPoE session message, and select a member port from an aggregation output interface of the Ethernet frame to forward the Ethernet frame based on a hash result of information in the IP head. Because the IP addresses in different messages are different, the member ports can be uniformly selected, and the load sharing of the flow forwarding of each member port is realized.
Of course, the switch may also be deployed on the forwarding Plane of the diversion-detached BRAS device as shown in fig. 1, as BRAS-UP (BRAS User Plane, broadband remote access server forwarding Plane, i.e. forwarding Plane in the diversion-detached vbars system). When the switch replaces a router to serve as the BRAS-UP, the switch can terminate two-layer forwarding of an ethernet frame, perform three-layer forwarding on a PPPoE message carried by the ethernet frame, and select a member port from an aggregation output interface corresponding to the PPPoE message based on a hash result of IP header information during the three-layer forwarding.
Specifically, the method may include the steps shown below.
Step 301: the switch receives the Ethernet frame;
step 302: if the message carried in the Ethernet frame is a PPPoE session message, the switch determines the position information of the IP header carried in the PPPoE session message in the Ethernet frame when determining that the protocol corresponding to the load of the PPPoE session message is an IP protocol, and acquires the IP header from the Ethernet frame according to the position information.
Step 302 is explained below through step 3021 to step 3025.
Step 3021: the switch determines whether the message carried by the Ethernet frame is a PPPoE session message.
In an alternative implementation, the switch may follow the flow of existing switches to parse the ethernet frames.
In implementation, the switch may obtain the ethertype field from the ethernet frame by taking 2 bytes after shifting 12 bytes from the start address of the ethernet frame (the 12 bytes correspond to the source MAC address and the destination MAC address).
The switch may then detect whether the ethertype field indicates an IP protocol (i.e., whether the ethertype field takes on a value of 0x0800 or 0x86 DD).
In the process of forwarding the ethernet frame by the existing switch, if the values of the ethertype field are not 0x0800 (indicating IPv4) and 0x86DD (indicating IPv6), the switch directly looks up the table to forward the ethernet frame and does not analyze information carried in the ethernet frame.
In the application, by modifying the analysis flow of the switch, the switch determines that the values of the ethertype field are not 0x0800 (indicating IPv4) and 0x86DD (indicating IPv6), and the switch can further detect whether the ethernet frame carries a PPPoE session packet.
Specifically, in the present application, when the switch determines that the value of the ethertype field is not 0x0800 (representing IPv4) and 0x86DD (representing IPv6), the switch may detect whether the value of the ethertype field is 0x 8864. And if the value of the Ether Type field is 0x8864, indicating that the Ethernet frame carries the PPPoE session message. If the value of the Ether Type field is not 0x8864, it indicates that the Ethernet frame does not carry the PPPoE session message.
Of course, the switch may also determine whether the packet carried in the ethernet frame is a PPPoE session packet based on whether the value of the ethertype field is 0x8864 or not when the ethertype field is obtained. This is merely an example and is not particularly limited.
Step 3022: if the Ethernet frame does not carry the PPPoE session message, searching a two-layer forwarding table entry corresponding to the Ethernet frame, and forwarding the Ethernet frame through the searched two-layer forwarding table entry.
Step 3023: if the ethernet frame carries a PPPoE session message, the switch can further detect whether a protocol corresponding to the load of the PPPoE session message is an IP protocol.
During detection, as shown in fig. 2, the payload part of the PPPoE session packet carries the PPP packet. The PPP message includes a PPP header. The PPP header includes a Protocol field therein. The switch can detect whether the value of the Protocol field is 0x0021 (indicating an IP Protocol), and if the value of the Protocol field is 0x0021, it indicates that a Protocol corresponding to the load of the PPPoE session message is the IP Protocol. If the value of the Protocol field is not 0x0021, the Protocol corresponding to the load of the PPPoE session message is not an IP Protocol.
If the protocol corresponding to the load of the PPPoE session message is not the IP protocol, execute step 4024;
if the protocol corresponding to the load of the PPPoE session packet is the IP protocol, step 4025 is executed.
Step 3024: if the protocol corresponding to the load of the PPPoE session message is not the IP protocol, searching a two-layer forwarding table entry corresponding to the Ethernet frame, and forwarding the Ethernet frame through the searched two-layer forwarding table entry.
Step 3025: if the protocol corresponding to the load of the PPPoE session message is an IP protocol, the switch can determine the position information of the IP header carried by the PPPoE session message in the Ethernet frame and acquire the IP header from the Ethernet frame according to the position information.
When the PPPoE session message is realized, if the protocol corresponding to the load of the PPPoE session message is the IP protocol, the PPP message carried by the load part of the PPPoE session message carries the IP message. The IP message comprises an IP head, and the switch can determine the position information of the IP head carried by the PPPoE session message in the Ethernet frame.
The location information may be an offset of a start address of the IP header in the ethernet frame with respect to a start address of the ethernet frame. The IP header may be a start address of the ethernet frame, and the location information is not specifically limited herein.
Taking the offset as an example, when determining the location information of the IP header carried by the PPPoE session packet in the ethernet frame, the switch may read the offset (i.e., 22 bytes) of the preset starting address of the IP header in the ethernet frame relative to the starting address of the ethernet frame.
After obtaining the offset, the switch may read the IP header from the ethernet frame based on the offset.
As can be seen from the above description, in the present application, the existing flow of the switch for analyzing the ethernet frame is still used, but some existing flows are merely changed, for example, after the switch recognizes that the packet carried in the ethernet frame is not an IP packet, it further recognizes whether the packet carried in the ethernet frame is a PPPoE session packet, if so, when the protocol corresponding to the load portion of the PPPoE session packet is an IP protocol, the IP header is analyzed from the PPPoE packet. Therefore, the IP head analysis of the Ethernet frame carrying the PPPoE session message by the switch is realized on the aspect of continuing the analysis process of the existing switch.
Step 303: the switch calculates a hash parameter for the information in the IP header.
In implementation, the switch may obtain the protocol type field from the IP header starting from the start of the IP header, offset by 9 bytes.
If the Protocol type field indicates that the Protocol type is a TCP (Transmission Control Protocol) Protocol or a UDP (User Datagram Protocol), quintuple information is obtained from the IP header, and a hash parameter is calculated for the quintuple information.
If the protocol type field indicates that the protocol type is a non-TCP protocol and a non-UDP protocol, the source IP address and the destination IP address are obtained from the IP header, and the hash parameter is calculated for the source IP address and/or the destination IP address.
Step 304: and the switch selects a matched member port from the aggregation outgoing interface corresponding to the Ethernet frame based on the calculated hash parameter, and the matched member port is used as a member port for forwarding the Ethernet frame.
In implementation, the switch may detect whether the destination MAC address of the ethernet frame is the MAC address of the switch. If the destination MAC address of the Ethernet frame is the MAC address of the switch, the three-layer forwarding is indicated, and the forwarding head of the Ethernet frame is an IP head. If the destination MAC address of the Ethernet frame is not the MAC address of the switch, the two-layer forwarding is indicated, and the forwarding header of the Ethernet frame is the MAC header.
1) The destination MAC address of the Ethernet frame is not the MAC address of the local switch
When the destination MAC address of the ethernet frame is not the MAC address of the switch, the switch may search a two-layer forwarding table entry corresponding to the destination MAC address carried in the ethernet frame in the two-layer forwarding table. If the output interface recorded in the two-layer forwarding table entry is the aggregation output interface. The switch may select a member port matching the calculated hash parameter from at least one member port included in the aggregate egress interface.
2) The destination MAC address of the Ethernet frame is the MAC address of the local switch
When the destination MAC address of the ethernet frame is the MAC address of the switch, the switch may search, in the routing table, a routing table entry corresponding to the destination IP address carried in the ethernet frame.
If the outgoing interface recorded by the routing table entry is an aggregation outgoing interface, the switch may select a member port matched with the calculated hash parameter from at least one member port included in the aggregation outgoing interface.
In addition, in the application, the switch can realize the two-layer forwarding of the ethernet frame in the two-layer network, and the two-layer forwarding of the ethernet frame is terminated after the ethernet frame leaves the two-layer network, besides realizing the selection of the member port, and the three-layer forwarding is performed on the PPPoE message carried in the ethernet frame.
The following description is divided into two cases.
1) The destination MAC address of the Ethernet frame is not the MAC address of the local switch
When the destination MAC address of the Ethernet frame is not the MAC address of the switch, the fact that two-layer forwarding of the Ethernet frame is needed is indicated. Therefore, after the switch determines the member port, the switch may forward the ethernet frame based on the selected member port.
2) The destination MAC address of the Ethernet frame is the MAC address of the local switch
When the destination MAC address of the Ethernet frame is the MAC address of the switch, the two-layer forwarding of the Ethernet frame needs to be terminated, and the three-layer forwarding of the PPPoE message carried in the Ethernet frame is carried out.
After the switch determines the routing table entry corresponding to the destination IP address carried in the ethernet frame, the switch may further obtain the next hop from the determined routing table entry.
The switch may search for the ARP entry corresponding to the next hop in an ARP (Address Resolution Protocol) table. The switch can obtain the MAC address corresponding to the next hop recorded in the searched ARP table entry.
The switch takes the MAC address of the switch as a source MAC address and takes the MAC address corresponding to the next hop as a destination MAC address to construct a new MAC header.
The switch may replace the pre-IP information in the ethernet frame (including the MAC header, PPPoE header, PPP header) with a new MAC header. Specifically, the switch may delete information in the ethernet frame before the IP and then add a newly constructed MAC header before the IP header of the ethernet frame.
The switch may then replace the information before the IP header of the ethernet frame with the new MAC header and forward the ethernet frame that was subjected to the replacement operation through the selected member port.
As can be seen from the above description, on one hand, since the switch can parse the IP header in the PPPoE message from the ethernet frame, the hash parameter can be calculated for the information of the IP header to select the member port. Because the IP heads of different messages are different, the member ports can be uniformly selected, and the load sharing of the flow forwarding of each member port is realized.
On the other hand, because the switch can analyze the IP header and replace the information before the IP header in the ethernet frame with a new MAC header when the forwarding header is determined to be the IP header, the switch of the present application can also be used as a BRAS-UP device to implement two-layer forwarding of the terminated ethernet frame and three-layer forwarding of the PPPoE message in the ethernet frame.
Referring to fig. 4, fig. 4 is a schematic diagram of an ethernet frame forwarding processing logic according to an exemplary embodiment of the present application, where the method is applicable to a switch, and the switch may be deployed in a two-layer network to which BRAS devices are connected, or in a forwarding plane of a relay separation BARS.
Step 401: the switch shifts by 12 bytes from the start position of the Ethernet frame and acquires the Ether Type field by taking the length of 2 bytes.
If the value of the Ether Type field is 0x0800 or 0x86DD, then execute step 406;
if the value of the Ether Type field is not 0x0800 or 0x86DD, then step 402 is performed.
Step 402: the switch detects whether the value of the Ether Type is 0x 8864.
If the value of the Ether Type is 0x8864, executing step 403;
if the value of Ether Type is not 0x8864, then step 404 is performed.
Step 403: if the value of the Ether Type is 0x8864, the switch determines that the Ethernet frame carries a PPPoE message, and the Ethernet frame deviates by 6 bytes from the end address of the Ehter Type field to obtain a protocol field in the PPP header.
If the value of the Protocol field in the PPP header is 0x0021, then step 406 is executed;
if the value of the Protocol field in the PPP header is not 0x0021, step 405 is executed.
Step 404: if the value of the Ether Type is not 0x8864, the switch determines that the Ethernet frame carries a non-IP message and a non-PPPoE session message.
Step 405: if the value of the Protocol field in the PPP header is not 0x0021, the switch acquires a source MAC address and a destination MAC address from the Ethernet frame, calculates hash parameters of the source MAC address and the destination MAC address, searches a two-layer forwarding table item corresponding to the destination MAC address in a two-layer forwarding table, and selects a member port matched with the calculated hash parameters to forward the Ethernet frame in an aggregation output interface recorded by the two-layer forwarding table item.
Step 406: and if the Ehter Type is 0x0800 or 0x86DD or the value of the Protocol field in the PPP header is 0x0021, determining the offset of the IP header from the initial position of the Ethernet frame based on the value of the Ehter Type field, and acquiring the IP header in the Ethernet frame based on the offset.
When the Ehter Type is 0x0800 or 0x86DD, the offset of the IP header from the start position of the ethernet frame is 14 bytes.
When the Ehter Type is 0x8864, the IP header is offset by 22 bytes from the start position of the ethernet frame.
In addition, the switch can also detect whether the destination MAC address carried by the Ethernet frame is the MAC address of the switch.
If the destination MAC address carried in the ethernet frame is the MAC address of the local switch, step 407 is executed.
If the destination MAC address carried in the ethernet frame is not the MAC address of the switch, step 411 is executed.
Step 407: and if the destination MAC address carried by the Ethernet frame is the MAC address of the switch, the switch determines that the forwarding head of the Ethernet frame is an IP head.
Step 408: the exchanger obtains the destination IP address from the IP header, and searches the routing table item corresponding to the destination IP address, wherein the routing table item comprises: aggregating the outgoing interface and the next hop.
Step 409: if the Protocol field in the IP header indicates a TCP or UDP Protocol, the switch calculates a hash parameter for quintuple information in the IP header; if the Protocol field indicates a non-TCP and non-UDP Protocol, the switch calculates a hash parameter for the source IP address and/or the destination IP address in the IP header, and determines a member port matched with the hash parameter in the aggregation output interface.
Step 410: and the switch replaces the information before the IP header of the Ethernet frame with the new MAC header and sends the Ethernet frame which is subjected to the replacement operation through the determined member port. The source MAC address of the new MAC head is the MAC address of the exchanger, and the destination address is the MAC address corresponding to the next hop.
Step 411: and if the destination MAC address carried by the Ethernet frame is not the MAC address of the switch, the switch determines that the forwarding head of the Ethernet frame is the MAC head.
Step 412: if the Protocol field in the IP header indicates a TCP or UDP Protocol, the switch calculates a hash parameter for quintuple information in the IP header; if the Protocol field indicates that the Protocol is not TCP and is not UDP, calculating hash parameters for a source IP address and/or a target IP address in an IP header; and searching a two-layer forwarding table entry corresponding to the destination MAC address in the two-layer forwarding table, and selecting a member port matched with the hash parameter to forward the Ethernet frame in an aggregation output interface recorded by the two-layer forwarding table entry.
As can be seen from the above description, on one hand, since the switch can parse the IP header in the PPPoE message from the ethernet frame, a hash parameter process can be calculated for the information of the IP header to select the member port. Because the IP heads of different messages are different, the member ports can be uniformly selected, and the load sharing of the flow forwarding of each member port is realized.
On the other hand, because the switch can analyze the IP header and replace the information before the IP header in the ethernet frame with a new MAC header when the forwarding header is determined to be the IP header, the switch of the present application can also be used as a BRAS-UP device to implement two-layer forwarding of the terminated ethernet frame and three-layer forwarding of the PPPoE message in the ethernet frame.
Referring to fig. 5, fig. 5 is a hardware structure diagram of a switch according to an exemplary embodiment of the present application.
The switch includes: a communication interface 501, a processor 502, a machine-readable storage medium 503, and a bus 504; wherein the communication interface 501, the processor 502 and the machine-readable storage medium 503 are in communication with each other via a bus 504. The processor 502 may perform the member port selection method described above by reading and executing machine-executable instructions in the machine-readable storage medium 503 corresponding to the member port selection method control logic.
The machine-readable storage medium 503 referred to herein may be any electronic, magnetic, optical, or other physical storage device that can contain or store information such as executable instructions, data, and the like. For example, the machine-readable storage medium may be: volatile memory, non-volatile memory, or similar storage media. In particular, the machine-readable storage medium 503 may be a RAM (random Access Memory), a flash Memory, a storage drive (e.g., a hard disk drive), a solid state disk, any type of storage disk (e.g., a compact disk, a DVD, etc.), or similar storage medium, or a combination thereof.
Referring to fig. 6, fig. 6 is a block diagram illustrating a member port selection apparatus according to an exemplary embodiment of the present application, which may be applied to a switch and may include the following elements.
A receiving unit 601, configured to receive an ethernet frame;
a determining unit 602, configured to determine, if the packet carried in the ethernet frame is a PPPoE session packet, location information of an IP header carried in the PPPoE session packet in the ethernet frame when it is determined that a protocol corresponding to a load of the PPPoE session packet is an IP protocol, and obtain the IP header from the ethernet frame according to the location information;
a selecting unit 603 configured to calculate a hash parameter for information in the IP header; and selecting a matched member port from the aggregation output interface corresponding to the Ethernet frame based on the calculated hash parameter, and using the member port as a member port for forwarding the Ethernet frame.
Optionally, the apparatus further comprises:
a forwarding unit 604, configured to replace, if a destination MAC address of the ethernet frame is the MAC address of the switch, information before an IP header of the ethernet frame with a new MAC header, and forward the ethernet frame subjected to the replacement operation through the selected member port;
wherein, the source MAC address in the new MAC header is the MAC address of the switch, and the destination MAC address is the next-hop MAC address corresponding to the destination IP address in the IP header;
the information before the IP header includes: an original MAC header, a PPPoE header and a PPP header of the Ethernet frame;
and the aggregation output interface is an output interface corresponding to the destination IP address.
Optionally, the apparatus further comprises:
a forwarding unit 604, configured to forward the ethernet frame through the selected member port if the destination MAC address of the ethernet frame is not the MAC address of the switch;
and the aggregation output interface is an output interface corresponding to the destination MAC address in the original MAC header of the Ethernet frame.
Optionally, the selecting unit 603 is configured to obtain the protocol type from the IP header when calculating the hash parameter for the information in the IP header; if the acquired protocol type is a TCP protocol or a UDP protocol, calculating a hash parameter for quintuple information in the IP header; and if the acquired protocol types are a non-TCP protocol and a non-UDP protocol, calculating a hash parameter for the source IP address and/or the destination IP address in the IP header.
Optionally, the location information is: the offset of the starting address of the IP header in the ethernet frame relative to the starting address of the ethernet frame.
Optionally, the switch is deployed in a two-layer network connected to the BRAS device, and/or the switch is deployed in a forwarding plane of the handover control separation BARS.
The implementation process of the functions and actions of each unit in the above device is specifically described in the implementation process of the corresponding step in the above method, and is not described herein again.
For the device embodiments, since they substantially correspond to the method embodiments, reference may be made to the partial description of the method embodiments for relevant points. The above-described embodiments of the apparatus are merely illustrative, and the units described as separate parts may or may not be physically separate, and the parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the modules can be selected according to actual needs to achieve the purpose of the scheme of the application. One of ordinary skill in the art can understand and implement it without inventive effort.
The present invention is not intended to be limited to the particular embodiments shown and described, but is to be accorded the widest scope consistent with the principles and novel features herein disclosed.

Claims (10)

1. A method for selecting a member port, the method being applied to a switch, the method comprising:
receiving an Ethernet frame;
if the message carried in the Ethernet frame is a PPPoE session message, determining the position information of an IP head carried in the PPPoE session message in the Ethernet frame when determining that a protocol corresponding to the load of the PPPoE session message is an IP protocol, and acquiring the IP head from the Ethernet frame according to the position information;
calculating hash parameters for the information in the IP header;
and selecting a matched member port from the aggregation output interface corresponding to the Ethernet frame based on the calculated hash parameter, and using the member port as a member port for forwarding the Ethernet frame.
2. The method of claim 1, further comprising:
if the destination MAC address of the Ethernet frame is the MAC address of the switch, replacing the information before the IP header of the Ethernet frame with a new MAC header, and forwarding the Ethernet frame subjected to the replacement operation through the selected member port;
wherein, the source MAC address in the new MAC header is the MAC address of the switch, and the destination MAC address is the next-hop MAC address corresponding to the destination IP address in the IP header;
the information before the IP header includes: the original MAC header, PPPoE header and PPP header of the Ethernet frame;
and the aggregation output interface is an output interface corresponding to the destination IP address.
3. The method of claim 1, further comprising:
if the destination MAC address of the Ethernet frame is not the MAC address of the switch, forwarding the Ethernet frame through the selected member port;
and the aggregation output interface is an output interface corresponding to a destination MAC address in an original MAC header of the Ethernet frame.
4. The method of claim 1, wherein the computing a hash parameter for the information in the IP header comprises:
acquiring a protocol type from the IP header;
if the acquired protocol type is a TCP protocol or a UDP protocol, calculating a hash parameter for quintuple information in the IP header;
and if the acquired protocol types are a non-TCP protocol and a non-UDP protocol, calculating hash parameters for the source IP address and/or the destination IP address in the IP header.
5. The method of claim 1, wherein the location information is: an offset of a starting address of an IP header in the Ethernet frame relative to a starting address of the Ethernet frame.
6. An apparatus for selecting a member port, the apparatus being applied to a switch, the apparatus comprising:
a receiving unit for receiving an Ethernet frame;
a determining unit, configured to determine, if a packet carried in the ethernet frame is a PPPoE session packet, location information of an IP header carried in the PPPoE session packet in the ethernet frame when it is determined that a protocol corresponding to a load of the PPPoE session packet is an IP protocol, and obtain the IP header from the ethernet frame according to the location information;
a selection unit, configured to calculate a hash parameter for information in the IP header; and selecting a matched member port from the aggregation output interface corresponding to the Ethernet frame based on the calculated hash parameter, and using the member port as a member port for forwarding the Ethernet frame.
7. The apparatus of claim 6, further comprising:
a forwarding unit, configured to replace, if a destination MAC address of the ethernet frame is an MAC address of the switch, information before an IP header of the ethernet frame with a new MAC header, and forward the ethernet frame subjected to the replacement operation through the selected member port;
wherein, the source MAC address in the new MAC header is the MAC address of the switch, and the destination MAC address is the next-hop MAC address corresponding to the destination IP address in the IP header;
the information before the IP header includes: the original MAC header, PPPoE header and PPP header of the Ethernet frame;
and the aggregation output interface is an output interface corresponding to the destination IP address.
8. The apparatus of claim 6, further comprising:
a forwarding unit, configured to forward the ethernet frame through the selected member port if a destination MAC address of the ethernet frame is not the MAC address of the switch;
and the aggregation output interface is an output interface corresponding to a destination MAC address in an original MAC header of the Ethernet frame.
9. The apparatus according to claim 6, wherein the selecting unit, when calculating a hash parameter for the information in the IP header, is configured to obtain a protocol type from the IP header; if the acquired protocol type is a TCP protocol or a UDP protocol, calculating a hash parameter for quintuple information in the IP header; and if the acquired protocol types are a non-TCP protocol and a non-UDP protocol, calculating hash parameters for the source IP address and/or the destination IP address in the IP header.
10. The apparatus of claim 6, wherein the location information is: an offset of a starting address of an IP header in the Ethernet frame relative to a starting address of the Ethernet frame.
CN202011272908.XA 2020-11-13 2020-11-13 Method and device for selecting member port Active CN112422447B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011272908.XA CN112422447B (en) 2020-11-13 2020-11-13 Method and device for selecting member port

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011272908.XA CN112422447B (en) 2020-11-13 2020-11-13 Method and device for selecting member port

Publications (2)

Publication Number Publication Date
CN112422447A CN112422447A (en) 2021-02-26
CN112422447B true CN112422447B (en) 2022-04-26

Family

ID=74832359

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011272908.XA Active CN112422447B (en) 2020-11-13 2020-11-13 Method and device for selecting member port

Country Status (1)

Country Link
CN (1) CN112422447B (en)

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2006067845A1 (en) * 2004-12-22 2006-06-29 Mitsubishi Denki Kabushiki Kaisha Line multiplexing system, communication device, ip baseline multiplexing device, and line multiplexing method
CN101385284A (en) * 2006-02-16 2009-03-11 日本电气株式会社 Node, network system, frame transfer method, and frame transfer program
CN101404619A (en) * 2008-11-17 2009-04-08 杭州华三通信技术有限公司 Method for implementing server load balancing and a three-layer switchboard
CN101854339A (en) * 2009-04-03 2010-10-06 华为技术有限公司 Information transmission implementation method, module and transmission network node
CN101873251A (en) * 2009-04-27 2010-10-27 中兴通讯股份有限公司 Message forwarding method and device
CN102577280A (en) * 2011-11-28 2012-07-11 华为技术有限公司 Method, apparatus and system for sending message
CN104038425A (en) * 2013-03-06 2014-09-10 阿里巴巴集团控股有限公司 Method and device for forwarding Ethernet packet
CN110798400A (en) * 2019-10-23 2020-02-14 新华三信息安全技术有限公司 Message forwarding method and device

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP4236398B2 (en) * 2001-08-15 2009-03-11 富士通株式会社 Communication method, communication system, and communication connection program
TWI246285B (en) * 2002-02-08 2005-12-21 Matsushita Electric Ind Co Ltd Gateway apparatus and its controlling method
EP1488332A4 (en) * 2002-03-11 2005-12-07 Seabridge Ltd Dynamic service-aware aggregation of ppp sessions over variable network tunnels
US7697527B2 (en) * 2003-07-30 2010-04-13 Nortel Networks Limited Method and apparatus for direct frame switching using frame contained destination information
JP2007221533A (en) * 2006-02-17 2007-08-30 Hitachi Communication Technologies Ltd Ppp gateway device

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2006067845A1 (en) * 2004-12-22 2006-06-29 Mitsubishi Denki Kabushiki Kaisha Line multiplexing system, communication device, ip baseline multiplexing device, and line multiplexing method
CN101385284A (en) * 2006-02-16 2009-03-11 日本电气株式会社 Node, network system, frame transfer method, and frame transfer program
CN101404619A (en) * 2008-11-17 2009-04-08 杭州华三通信技术有限公司 Method for implementing server load balancing and a three-layer switchboard
CN101854339A (en) * 2009-04-03 2010-10-06 华为技术有限公司 Information transmission implementation method, module and transmission network node
CN101873251A (en) * 2009-04-27 2010-10-27 中兴通讯股份有限公司 Message forwarding method and device
CN102577280A (en) * 2011-11-28 2012-07-11 华为技术有限公司 Method, apparatus and system for sending message
CN104038425A (en) * 2013-03-06 2014-09-10 阿里巴巴集团控股有限公司 Method and device for forwarding Ethernet packet
CN110798400A (en) * 2019-10-23 2020-02-14 新华三信息安全技术有限公司 Message forwarding method and device

Non-Patent Citations (3)

* Cited by examiner, † Cited by third party
Title
PPPOE协议分析;伍振国;《科技咨询导报》;20070701(第19期);全文 *
以太网中PPPoE连线下MTU值对网络性能的影响;梁利君等;《大众科技》;20160720(第07期);全文 *
软件定义网络的测量方法研究;戴冕等;《软件学报》;20190327(第06期);全文 *

Also Published As

Publication number Publication date
CN112422447A (en) 2021-02-26

Similar Documents

Publication Publication Date Title
US10469367B2 (en) Segment routing network processing of packets including operations signaling and processing of packets in manners providing processing and/or memory efficiencies
US7995477B2 (en) Collecting network traffic information
EP2544417B1 (en) Communication system, path control apparatus, packet forwarding apparatus and path control method
US8520672B2 (en) Packet switching device using results determined by an application node
US9049098B2 (en) Discovery of services provided by application nodes in a network
US7885294B2 (en) Signaling compression information using routing protocols
US20220078114A1 (en) Method and Apparatus for Providing Service for Traffic Flow
KR101266671B1 (en) Scaled ethernet oam for mesh and hub-and-spoke networks
US10361954B2 (en) Method and apparatus for processing modified packet
US20100316054A1 (en) Method, system and apparatus for sending mapping information
CN104935516A (en) Communication system based on software defined network and communication method
US9183322B2 (en) Increasing internet protocol version 6 host table scalability in top of rack switches for data center deployments
CN111988266B (en) Method for processing message
US10523536B2 (en) Length control for packet header sampling
CN110677340A (en) Message forwarding method and device
JP2002124990A (en) Policy execution switch
CN114465931A (en) Network detection method, device, electronic equipment and storage medium
US20130246603A1 (en) System, method, and computer program product for automatic router discovery
CN112422447B (en) Method and device for selecting member port
JP5657505B2 (en) Network system, relay device, communication method, relay method, and relay program
CN107547687B (en) Message transmission method and device
JP6904846B2 (en) Communication equipment, control method of communication equipment, and programs
CN110418218B (en) Message processing method and device and FCF switching equipment
CN111770049A (en) Global cache variable and message information storage method and device
Xiaoling et al. Research on IPv6 routing technology

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant