CN111614565A - Message forwarding method and gateway - Google Patents
Message forwarding method and gateway Download PDFInfo
- Publication number
- CN111614565A CN111614565A CN202010425003.5A CN202010425003A CN111614565A CN 111614565 A CN111614565 A CN 111614565A CN 202010425003 A CN202010425003 A CN 202010425003A CN 111614565 A CN111614565 A CN 111614565A
- Authority
- CN
- China
- Prior art keywords
- message
- mac address
- dialing
- pppoe
- mode
- 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.)
- Granted
Links
Images
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L45/00—Routing or path finding of packets in data switching networks
- H04L45/74—Address processing for routing
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L12/00—Data switching networks
- H04L12/28—Data switching networks characterised by path configuration, e.g. LAN [Local Area Networks] or WAN [Wide Area Networks]
- H04L12/2854—Wide area networks, e.g. public data networks
- H04L12/2856—Access arrangements, e.g. Internet access
- H04L12/2858—Access network architectures
- H04L12/2859—Point-to-point connection between the data network and the subscribers
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L2101/00—Indexing scheme associated with group H04L61/00
- H04L2101/60—Types of network addresses
- H04L2101/618—Details of network addresses
- H04L2101/622—Layer-2 addresses, e.g. medium access control [MAC] addresses
Landscapes
- Engineering & Computer Science (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Data Exchanges In Wide-Area Networks (AREA)
Abstract
The embodiment of the application provides a message forwarding method and a gateway. The method comprises the following steps: acquiring a message received from an LAN port; judging whether the message is a PPPoE message or not and whether the destination MAC address of the message is the MAC address configured on the LAN port or not; if the message is a PPPoE message and the destination MAC address is not the MAC address configured on the LAN port, judging to carry out dialing in a bridging mode, and sending the message through a WAN port; if the message is a non-PPPoE message and the destination MAC address is the MAC address configured on the LAN port, the message is judged to be dialed in a routing mode, and is matched to the WAN port according to a routing table, and the message is sent through the WAN port.
Description
Technical Field
The present application relates to the field of network communication technologies, and in particular, to a packet forwarding method and a gateway.
Background
A routing Wide Area Network (WAN) established by a home gateway and based on a Point-to-Point Protocol overlay ethernet (PPPoE) generally adopts a routing mode to dial, and a personal computer (personal computer, PC) can only dial up through the gateway and cannot dial up directly.
Therefore, a message forwarding method is needed to support two dial-up networking modes, namely gateway dial-up networking and PC direct dial-up networking.
Disclosure of Invention
The application provides a message forwarding method and a gateway, which are used for supporting gateway dial-up networking and PC direct dial-up networking.
In a first aspect, an embodiment of the present application provides a packet forwarding method, including:
acquiring a message received from an LAN port;
judging whether the message is a PPPoE message or not and whether the destination MAC address of the message is the MAC address configured on the LAN port or not;
if the message is a PPPoE message and the destination MAC address is not the MAC address configured on the LAN port, judging to carry out dialing in a bridging mode, and sending the message through a WAN port;
if the message is a non-PPPoE message and the destination MAC address is the MAC address configured on the LAN port, the dialing of the routing mode is judged, the message is matched with the WAN port according to the routing table, and the message is sent through the WAN port.
Optionally, the method further includes:
if the message is a non-PPPoE message and the destination MAC address is an MAC address configured on the LAN port, acquiring a flag bit for indicating whether the routing mode dialing is currently carried out or not;
if the current dialing in the routing mode is judged according to the zone bit, the message currently received from the LAN port is discarded.
Optionally, the flag bit is set in a PPPoE process of routing mode dialing;
the method further comprises the following steps:
when the routing mode dialing is carried out, setting the value of the zone bit as a first value, wherein the zone bit of the first value is used for indicating that the routing mode dialing is currently carried out;
and after the dialing of the routing mode is finished, setting the value of the zone bit as a second value, wherein the zone bit of the second value is used for indicating that the dialing of the routing mode is not carried out currently.
Optionally, the method further includes:
acquiring a PPPoE message received from a WAN port;
and if the destination MAC address of the PPPoE message is the MAC address configured on the WAN port, matching the destination MAC address with the corresponding LAN port according to the routing table, and sending the PPPoE message through the corresponding LAN port.
Optionally, the method further includes:
if the message is a PPPoE message and the destination MAC address is the MAC address configured on the LAN port, the message is discarded.
In a second aspect, an embodiment of the present application provides a gateway, including:
the receiving module is used for acquiring the message received from the LAN port;
the control module is used for judging whether the message is a PPPoE message or not and whether the destination MAC address of the message is the MAC address configured on the LAN port or not;
the bridging module judges to carry out bridging mode dialing if the message is a PPPoE message and the destination MAC address is not the MAC address configured on the LAN port, and sends the message through the WAN port;
and if the message is a non-PPPoE message and the destination MAC address is an MAC address configured on the LAN port, the routing module judges to dial in a routing mode, matches the message to the WAN port according to the routing table and sends the message through the WAN port.
Optionally, the control module is further configured to:
if the message is a PPPoE message and the destination MAC address is not the MAC address configured on the LAN port, acquiring a flag bit for indicating whether the routing mode dialing is currently carried out or not;
if the current dialing in the routing mode is judged according to the zone bit, the message currently received from the LAN port is discarded.
Optionally, the flag bit is set in a PPPoE process of routing mode dialing;
a routing module further configured to:
when the routing mode dialing is carried out, setting the value of the zone bit as a first value, wherein the zone bit of the first value is used for indicating that the routing mode dialing is currently carried out;
and after the dialing of the routing mode is finished, setting the value of the zone bit as a second value, wherein the zone bit of the second value is used for indicating that the dialing of the routing mode is not carried out currently.
Optionally, the receiving module is further configured to obtain a PPPoE message received from the WAN port;
the control module is also used for judging whether the destination MAC address of the PPPoE message is the MAC address configured on the WAN port;
and the routing module is also used for matching the destination MAC address of the PPPoE message to the corresponding LAN port according to the routing table and sending the PPPoE message through the corresponding LAN port if the destination MAC address of the PPPoE message is the MAC address configured on the WAN port.
Optionally, the control module is further configured to:
if the message is a non-PPPoE message and the destination MAC address of the message is the MAC address configured on the LAN port, the message is discarded.
In the embodiment of the application, after the message received from the LAN port is acquired, the dialing mode is determined according to the type of the message received from the LAN port and the judgment result of the destination MAC address of the message, when the dialing in the bridge mode is judged, the PPPoE message is sent through the WAN port, and when the dialing in the routing mode is judged, the non-PPPoE message is matched to the WAN port through the routing table for forwarding, so that the gateway supports both gateway dial-up networking and PC direct dial-up networking.
Drawings
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings needed to be used in the description of the embodiments or the prior art will be briefly introduced below, and it is obvious that the drawings in the following description are some embodiments of the present application, and for those skilled in the art, other drawings can be obtained according to these drawings without inventive exercise.
Fig. 1 illustrates a hardware diagram of a gateway provided by an embodiment of the present application;
fig. 2 illustrates an interface for configuring a gateway provided by an embodiment of the present application;
fig. 3 is a diagram illustrating a structure of a gateway provided in an embodiment of the present application;
fig. 4 exemplarily shows a flow chart of a message forwarding method provided in the embodiment of the present application;
FIG. 5 is a diagram illustrating an exemplary PC dialing interface provided by an embodiment of the present application;
fig. 6 exemplarily shows a flowchart of an uplink packet forwarding method provided in the embodiment of the present application;
fig. 7 is a flowchart illustrating another packet forwarding method provided in the embodiment of the present application;
fig. 8 exemplarily shows a flowchart of a downlink packet forwarding method provided in the embodiment of the present application.
Detailed Description
To make the objects, technical solutions and advantages of the exemplary embodiments of the present application clearer, the technical solutions in the exemplary embodiments of the present application will be clearly and completely described below with reference to the drawings in the exemplary embodiments of the present application, and it is obvious that the described exemplary embodiments are only a part of the embodiments of the present application, but not all the embodiments. Moreover, while the disclosure herein has been presented in terms of exemplary one or more examples, it is to be understood that each aspect of the disclosure can be utilized independently and separately from other aspects of the disclosure to provide a complete disclosure.
Furthermore, the terms "comprises" and "comprising," as well as any variations thereof, are intended to cover a non-exclusive inclusion, such that a product or device that comprises a list of elements is not necessarily limited to those elements explicitly listed, but may include other elements not expressly listed or inherent to such product or device.
The term "module" as used herein refers to any known or later developed hardware, software, firmware, artificial intelligence, fuzzy logic, or combination of hardware and/or software code that is capable of performing the functionality associated with that element.
The embodiment of the application provides a message forwarding method and a gateway, which are used for simultaneously supporting gateway dial-up networking and PC direct dial-up networking.
The Gateway (Gateway) is also called an internetwork connector and a protocol converter. The gateway realizes network interconnection above a network layer, is a complex network interconnection device and is only used for interconnection of two networks with different high-level protocols. The gateway can be used for interconnection of wide area networks and local area networks, and can realize Internet access, connection of internal heterogeneous subnets, remote control and management and other functions.
Embodiments of the present application are described in detail below with reference to the accompanying drawings.
Fig. 1 illustrates a hardware diagram of a gateway provided in an embodiment of the present application.
As shown, a gateway having 4 LAN ports and 1 WAN port is described as an example in this example. Specifically, the gateway 100 may include a LAN port 1001, a WAN port 1002, a processor 1003, a memory 1004, an Ethernet module 1005, a phone voice control module 1006, and a local control module 1007.
The LAN port 1001 may be connected to a user terminal device (e.g., a Personal Computer (PC), a desktop Computer, a printer, etc.). Taking the LAN port connected to the PC as an example, a PPPoE message and a non-PPPoE message, such as a PPP (Point-to-Point Protocol) message, may be exchanged between the LAN port and the PC.
The processor 1003 may be a microprocessor, and in order to increase the processing speed, a 32-bit embedded microprocessor is generally used as a hardware platform.
The memory 1004 may include FLASH and SDRAM chips for storing an embedded operating system in a Gateway, Common Gateway Interface (CGI) applications, home network servers, and file systems needed to support various services.
The Ethernet module 1005 is used to realize the physical connection between the gateway and the external network, and the user can remotely access and control the internal network through the Internet. The connection between the gateway 100 and the Internet may be implemented in a wired manner, or in a wireless manner based on General Packet Radio Service (GPRS).
The phone voice control module 1006 may be based on a Public Switched Telephone Network (PSTN), and implement remote control of the home appliance by using a dual-tone multi-frequency codec technology.
The local control module 1007 may control the in-home network in a home using a keyboard, an LCD display, a PDA, or the like.
The gateway 100 may be an intelligent gateway, a general gateway, a home gateway, etc.
In the embodiment of the present application, the gateway may be configured in a routing mode, a bridging mode, or a routing bridging hybrid mode. The gateway configured as the routing mode only supports the dialing of the routing mode, the PC cannot directly carry out PPPoE dialing, and only after the gateway is successfully dialed, the PC can surf the internet; the gateway configured to the bridge mode only supports the dialing of the bridge mode, the PC can directly carry out PPPoE dialing, and the PC can directly surf the internet after the dialing is successful; a gateway configured to route bridge mixed mode is capable of supporting both route mode dialing and bridge dial mode dialing.
The mode setting of the gateway can be performed in the gateway configuration interface.
Fig. 2 illustrates an interface for configuring a gateway provided in an embodiment of the present application. As shown, the user can select the mode of the gateway in the "mode" option, wherein the "mode" pull-down menu has two options, including Route, Bridge, where Route indicates that the gateway is set to the routing mode, Bridge indicates that the gateway is set to the Bridge mode, and where the gateway is configured to Route Bridge mixed mode, the "mode" selects Route while checking for "PPPoE".
The bridge mode dialing is realized on a data link layer, and the acquired message is directly forwarded. The dialing in the routing mode is realized in a network layer, and the acquired message is forwarded after routing table look-up and PPP packet encapsulation.
Referring to fig. 3, a functional structure diagram of a gateway provided in the embodiment of the present application is shown. As shown, the gateway includes a receiving module 301, a control module 302, a bridging module 303, and a routing module 304.
When the gateway is configured as a routing bridge mixed mode, after the receiving module receives a message from the LAN port, the control module 302 determines whether to perform bridge mode dialing or routing mode dialing, and if it is determined that bridge mode dialing is to be performed, the control module instructs the bridge module 303 to perform a bridge mode dialing procedure, and if it is determined that routing mode dialing is to be performed, the control module 304 instructs the routing module 304 to perform a routing mode dialing procedure.
Under the condition that the gateway is configured to be in a routing mode, after the receiving module receives a message from the LAN port, if the message is a related message in a dialing process, the routing module executes a routing mode dialing process so as to realize the routing mode dialing-up networking based on the gateway dialing.
Under the condition that the gateway is configured to be in a bridge mode, after the receiving module receives the message from the LAN port, if the message is the relevant message in the dialing process, the bridge module executes a bridge mode dialing process so as to realize bridge mode dialing networking aiming at the direct dialing of the PC.
In the embodiment of the present application, if a gateway is configured as a hybrid routing bridge mode, the gateway needs to be configured as a hybrid routing bridge mode at the same time, and most of conventional gateways have a hybrid routing bridge mode configuration function. After the gateway is configured to be in a routing bridging promiscuous mode, the gateway processes the message no matter whether the destination MAC address of the message is the same as the MAC address configured on the gateway LAN port or not, otherwise, the gateway discards the message of which the destination MAC address is different from the MAC address configured on the gateway LAN port.
In the embodiment of the application, the gateway can be set to the route bridge hybrid mode in a man-machine interaction mode, and certainly, mode setting can also be performed in other modes, for example, mode setting is performed through a physical switch.
Taking the setting mode by the man-machine interaction mode as an example, a route bridging mixed mode option can be added in the gateway setting interface for opening/closing the route bridging mixed mode. The route bridge hybrid mode may support both route mode dialing and bridge mode dialing.
In some embodiments of the present application, the hybrid route-handover mode may be implemented by loading a functional unit (which may also be referred to as virtual network device br0) in the kernel. Specifically, a network device br0 is virtualized in the kernel, and a virtual network device br0 may have the functions of the control module 302. After the routing bridging mixed mode is started, the virtual network device br0 is loaded in the kernel, and the virtual network device br0 analyzes and judges the message received by the gateway, so as to realize the processing function of the routing bridging mixed mode. When the route bridges the hybrid mode, the virtual network device br0 is removed from the kernel, so that the gateway resumes its original processing functions. The virtual network device br0 may bind several Ethernet (Ethernet) interfaces, such as eth0, eth1, eth2, eth3, and may also bind WAN interfaces, such as nas 2.
Fig. 4 exemplarily shows a flowchart of a message forwarding method provided in the embodiment of the present application. The process may be performed by the gateway described above. The gateway is configured to route bridge hybrid mode.
As shown, the process includes the following steps:
s401: the message received from the LAN port is acquired.
In some scenarios, a user dials up on a PC, and fig. 5 illustrates an exemplary dial-up interface. And adopting a PC direct dialing mode, wherein under the condition, the PC sends a PPPoE message, and the PPPoE message is received by a gateway LAN port. If the dialing number is an external network number, the destination MAC address of the PPPoE message is different from the MAC address configured on the message receiving LAN port, and if the dialing number is an internal network number, the destination MAC address of the PPPoE message is the same as the MAC address configured on the message receiving LAN port. Wherein, the MAC address configured on one LAN port of the gateway is the local MAC address of the local area network or the subnet connected with the LAN port.
In other scenes, a user dials at a PC terminal to surf the internet and adopts a gateway dialing mode, under the condition, a message sent by the PC is a non-PPPoE message, and the non-PPPoE message is received by a gateway LAN port. The destination MAC address of the non-PPPoE message is a local MAC address, indicating that the message needs to be routed and forwarded by the gateway. Wherein, the MAC address configured on one LAN port of the gateway is the local MAC address of the local area network or the subnet connected with the LAN port.
S402: and judging whether the message is a PPPoE message or not, whether the destination MAC address of the message is an MAC address configured on the LAN port or not, executing S403 if the message is the PPPoE message and the destination MAC address is not the MAC address configured on the LAN port, and executing S404 if the message is a non-PPPoE message and the destination MAC address is the MAC address configured on the LAN port.
In this step, whether the packet is a PPPoE packet can be determined according to protocol information in a packet header of the packet.
By judging the type and destination MAC address of the message, if the message is a PPPoE message and the destination MAC address is not an MAC address configured on the LAN port, a PC direct dialing mode is adopted at the PC end corresponding to the user in S401, that is, a bridge mode dialing; if the message is a non-PPPoE message and the destination MAC address is an MAC address configured on the LAN port, the user adopts a gateway dialing mode at the PC corresponding to the step S401, that is, a routing mode dialing mode. If the two dialing access networks are not carried out, the message can be discarded.
If the dialing in the routing mode is determined, the message can be submitted to a transmission layer (a routing module) for forwarding processing, and if the dialing in the bridge mode is determined, the message can be submitted to a data link layer (a bridge module) for forwarding processing.
S403: and judging to dial in a bridging mode, and sending the message through a WAN (wide area network) port.
In the step, the MAC address table can be inquired according to the destination MAC address of the received PPPoE message, the PPPoE message is matched with the WAN port, and the PPPoE message is sent to an external network through the WAN port, so that the direct dial-up networking of the PC at the LAN side is realized.
S404: and judging to dial the routing mode, matching the routing mode to a WAN port according to the routing table, and sending the message through the WAN port.
In this step, a routing table can be queried according to the received non-PPPoE message, the message is matched with a WAN port, PPP encapsulation is carried out on the message, and the encapsulated message is sent to an external network through the WAN port. The encapsulation process may include NAT address translation, that is, translating the source IP address of the packet (the private IP address of the local area network) into the corresponding public IP address.
Further, if the message received from the LAN port is a PPPoE message and the destination MAC address is an MAC address configured on the LAN port, the message is discarded.
It can be seen from the above description that in the embodiment of the present application, after the message received from the LAN port is acquired, the dialing mode is determined according to the type of the message received from the LAN port and the determination result of the destination MAC address of the message, if the message is in the bridge mode, the message is sent through the WAN port, and if the message is in the routing mode, the message is matched to the WAN port according to the routing table and sent through the WAN port, so that the gateway supports both the routing dial-up internet access and the PC direct dial-up internet access.
In the embodiment of the application, in the case that the gateway is configured to route the bridge mixed mode, the gateway can simultaneously support the bridge mode dialing and the route mode dialing. If one of the PCs connected to different LAN ports performs bridge mode dialing and the other performs route mode dialing, the dialing flows of the two modes are performed simultaneously, which may cause conflict, resulting in unsuccessful dialing and surfing.
In order to solve the above problem, in some embodiments of the present application, whether bridging mode dialing and routing mode dialing are currently performed simultaneously may be identified, and when the identification is performed simultaneously, execution of the routing mode dialing procedure is preferentially guaranteed to avoid a conflict.
In particular, a flag bit may be set to indicate whether routing mode dialing is currently ongoing. When the need of bridge mode dialing is judged according to the currently received message, the zone bit can be obtained, whether the route mode dialing is currently carried out or not is judged according to the zone bit, if the route mode dialing is currently carried out, the message currently received from the LAN port is discarded, and if not, the bridge mode dialing process is executed.
In some embodiments the flag may be set in the PPPoE process of route mode dialing. To save resource overhead, the flag bit may occupy 1 bit. When the routing mode dialing is carried out, setting the value of the zone bit to be 1 (for distinguishing description, called as a first value) to indicate that the routing mode dialing is currently carried out; after the routing mode dialing is completed, setting the value of the flag bit to 0 (for distinguishing description, referred to as a second value), which indicates that the routing mode dialing is not currently performed.
Based on the flow shown in fig. 4, fig. 6 shows an uplink packet forwarding flow by taking an implementation manner of loading the virtual network device br0 in the kernel to support two dialing modes simultaneously as an example. As shown, the process includes the following steps:
s601: the LAN port receives the message and sends it to the virtual network device br 0.
S602 to S603: the virtual network device br0 determines whether the destination MAC address of the packet is a MAC address configured on the LAN port, if so, determines that the packet is a local packet, and executes S604, otherwise, executes S609.
S604 to S605: and judging whether the message is a PPPoE message, if so, discarding the message according to the first processing mode, and if not, executing S606.
S606 to S608: and inquiring a routing table according to the destination IP address of the message, matching the routing table with the WAN port, performing PPP packet, and then sending the message through the WAN port.
S609 to S610: determining the message which is not the local message, and judging whether the gateway is configured to be in a routing bridging promiscuous mode, if so, executing S611, otherwise, executing S614.
S611 to S612: and judging whether the message received from the LAN port is a PPPoE message, if not, discarding the message according to the second processing mode, and if so, executing S613.
S613: and judging whether the route bridging mixed mode is started, if so, executing S608, otherwise, executing S612.
S614 to S615: and judging whether the gateway is configured to dial in a routing mode, if so, executing S612, otherwise, judging whether the gateway is configured to dial in a bridging mode, if so, executing S608, and otherwise, executing S612.
In the above embodiment, the messages received by the LAN port are divided into the messages of the local machine and the messages of the non-local machine, the PPPoE messages in the messages of the local machine are discarded, and when the routing bridging hybrid mode is started, the PPPoE messages in the messages of the non-local machine are directly sent through the WAN port, so that the direct dial-up networking of the PC at the LAN port is realized.
The first processing mode and the second processing mode are different in message discarding position, the first processing mode is to discard the message by calling a netif _ receive _ skb function, and the second processing mode is to discard the message by calling a handle _ bridge function.
It should be noted that the steps S601 to S615 are not in a strict execution order, and for example, S611 may be executed before 5610, or may be executed in parallel with S610.
The relevant steps in the flow shown in fig. 6 are the same as those in the flow shown in fig. 4, and are not repeated here.
Fig. 7 exemplarily shows a flowchart of a packet forwarding method in the downlink direction according to an embodiment of the present application. As shown, this flow is performed by a gateway configured to route bridging hybrid modes.
As shown, the process may include the following steps:
s701: and acquiring the PPPoE message received from the WAN port.
In some scenarios, when a user dials in a bridge mode through a PC, the PC needs to perform message interaction with an external network to establish network connection. Therefore, after the gateway forwards the PPPoE message sent by the PC to the external network, the WAN port of the gateway receives the PPPoE message returned by the external network, and the destination MAC address of the PPPoE message is the MAC address configured on the WAN port of the gateway.
S702 to S703: and judging whether the destination MAC address of the PPPoE message is the MAC address configured on the WAN port, if not, discarding the PPPoE message, otherwise, executing S704.
S704: and matching the routing table to a corresponding LAN port, and sending the PPPoE message through the corresponding LAN port.
In the step, a routing table can be inquired according to the destination IP address of the received PPPoE message, the corresponding LAN port is matched, and the PPPoE message is sent to the PC through the corresponding LAN port, so that the PC on the LAN side can dial up directly to surf the internet.
Based on the flow shown in fig. 7, fig. 8 shows a downlink packet forwarding flow by taking an implementation manner of loading the virtual network device br0 in the kernel to support two dialing modes simultaneously as an example. As shown, the process includes the following steps:
s801: after receiving the message, the WAN port sends the message to the virtual network device br 0.
S802 the virtual network device br0 determines whether the gateway is set to the routing bridging promiscuous mode, if so, performs S803, otherwise, performs S807.
S803 to S804: and judging whether the message is a PPPoE message or a PPP message, if not, executing a message receiving process of the local computer, otherwise, executing S805.
S805 to S806: and judging whether the destination MAC address of the message is the MAC address configured on the WAN port, if so, executing the flow of receiving the message by the bridge, and executing S809, otherwise, executing S804.
S807: and judging whether the dialing is set to be a routing mode dialing or not, if so, executing S804, otherwise, executing S808.
S808: and judging whether the dialing is set to be in a bridge mode, if not, executing S804, otherwise, executing S806.
S809-S810 judges whether the destination MAC address of the message is the MAC address configured on the corresponding WAN port, if so, the message is determined to be a local message and the message is discarded according to the first processing mode, otherwise, S811 is executed.
S811: and judging whether the message is a PPPoE message, if not, executing S812, otherwise, executing S814.
S812 to S813: and searching a routing table according to the destination IP address of the message to match the message to a corresponding LAN port, and sending the PPPoE message through the corresponding LAN port.
S814 to S815: and judging whether the route bridging mixed mode is started, if not, discarding the message according to a second processing mode, otherwise, executing S812.
Steps S801 to S815 are identical to steps S801 to S815 in description, and are not repeated here.
In the above embodiment, the destination MAC address is not a PPPoE message configured on the WAN port, the routing table is searched according to the destination IP address of the PPPoE message, and after matching to the corresponding LAN port, the PPPoE message is sent to the PC through the corresponding LAN port, thereby implementing direct dial-up networking of the PC at the LAN port.
Based on the same technical concept, the embodiment of the present application provides a gateway, and the gateway can implement the functions in the above embodiments.
As shown in fig. 3, the gateway includes: a receiving module 301, a control module 302, a bridging module 303, a routing module 304.
A receiving module 301, configured to obtain a message received from a LAN port;
the control module 302 determines whether the message is a PPPoE message and whether the destination MAC address of the message is an MAC address configured on the LAN port;
the bridging module 303, if the message is a PPPoE message and the destination MAC address is not an MAC address configured on the LAN port, determines to perform bridging mode dialing, and sends the message through the WAN port;
if the message is a non-PPPoE message and the destination MAC address is a MAC address configured on the LAN port, the routing module 304 determines to dial in the routing mode, matches the message to the WAN port according to the routing table, and sends the message through the WAN port.
Optionally, the control module is further configured to: if the message is a PPPoE message and the destination MAC address is not the MAC address configured on the LAN port, acquiring a flag bit for indicating whether the routing mode dialing is currently carried out or not; if the current dialing in the routing mode is judged according to the zone bit, the message currently received from the LAN port is discarded.
Optionally, the flag bit is set in a PPPoE process of routing mode dialing; a routing module further configured to: when the routing mode dialing is carried out, setting the value of the zone bit as a first value, wherein the zone bit of the first value is used for indicating that the routing mode dialing is currently carried out; and after the dialing of the routing mode is finished, setting the value of the zone bit as a second value, wherein the zone bit of the second value is used for indicating that the dialing of the routing mode is not carried out currently.
Optionally, the receiving module is further configured to obtain a PPPoE message received from the WAN port; the control module is also used for judging whether the destination MAC address of the PPPoE message is the MAC address configured on the WAN port; and the routing module is also used for matching the destination MAC address of the PPPoE message to the corresponding LAN port according to the routing table and sending the PPPoE message through the corresponding LAN port if the destination MAC address of the PPPoE message is the MAC address configured on the WAN port.
And the control module is also used for discarding the message if the message is a non-PPPoE message and the destination MAC address of the message is the MAC address configured on the LAN port.
It should be noted that, the gateway provided in the embodiment of the present invention can implement all the method steps implemented by the method embodiment, and can achieve the same technical effect, and detailed descriptions of the same parts and beneficial effects as those of the method embodiment in this embodiment are not repeated herein.
The embodiment of the present application further provides a computer-readable storage medium, where computer-executable instructions are stored in the computer-readable storage medium, and the computer-executable instructions are used to enable a computer to execute the method performed by the gateway in the foregoing embodiment.
As will be appreciated by one skilled in the art, embodiments of the present application may be provided as a method, system, or computer program product. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present application is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to the application. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
It will be apparent to those skilled in the art that various changes and modifications may be made in the present application without departing from the spirit and scope of the application. Thus, if such modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is intended to include such modifications and variations as well.
Claims (10)
1. A message forwarding method is characterized by comprising the following steps:
acquiring a message received from an LAN port;
judging whether the message is a PPPoE message or not and whether the destination MAC address of the message is the MAC address configured on the LAN port or not;
if the message is a PPPoE message and the destination MAC address is not the MAC address configured on the LAN port, judging to carry out dialing in a bridging mode, and sending the message through a WAN port;
if the message is a non-PPPoE message and the destination MAC address is the MAC address configured on the LAN port, the dialing of the routing mode is judged, the message is matched with the WAN port according to a routing table, and the message is sent through the WAN port.
2. The method of claim 1, further comprising:
if the message is a non-PPPoE message and the destination MAC address is the MAC address configured on the LAN port, acquiring a flag bit for indicating whether the routing mode dialing is currently carried out or not;
if the current dialing in the routing mode is judged according to the zone bit, the message currently received from the LAN port is discarded.
3. The method of claim 2, wherein the flag is set in a PPPoE procedure for routing mode dialing;
the method further comprises the following steps:
when the routing mode dialing is carried out, setting the value of the zone bit as a first value, wherein the zone bit of the first value is used for indicating that the routing mode dialing is currently carried out;
and after the dialing of the routing mode is finished, setting the value of the zone bit as a second value, wherein the zone bit of the second value is used for indicating that the dialing of the routing mode is not carried out currently.
4. The method of claim 1, further comprising:
acquiring a PPPoE message received from a WAN port;
and if the destination MAC address of the PPPoE message is the MAC address configured on the WAN port, matching the destination MAC address with the corresponding LAN port according to a routing table, and sending the PPPoE message through the corresponding LAN port.
5. The method of claim 1, further comprising:
and if the message is a PPPoE message and the destination MAC address is the MAC address configured on the LAN port, discarding the message.
6. A gateway, comprising:
the receiving module is used for acquiring the message received from the LAN port;
the control module is used for judging whether the message is a PPPoE message or not and whether the destination MAC address of the message is the MAC address configured on the LAN port or not;
if the message is a PPPoE message and the destination MAC address is not the MAC address configured on the LAN port, the bridging module judges to dial in a bridging mode and sends the message through a WAN port;
if the message is a non-PPPoE message and the destination MAC address is the MAC address configured on the LAN port, the routing module judges to dial in a routing mode, matches the message to the WAN port according to a routing table and sends the message through the WAN port.
7. The gateway of claim 6, wherein the control module is further configured to:
if the message is a PPPoE message and the destination MAC address is not the MAC address configured on the LAN port, acquiring a flag bit for indicating whether the routing mode dialing is currently carried out or not;
if the current dialing in the routing mode is judged according to the zone bit, the message currently received from the LAN port is discarded.
8. The gateway of claim 7, wherein the flag bit is set in a PPPoE procedure for routing mode dialing;
the routing module is further configured to:
when the routing mode dialing is carried out, setting the value of the zone bit as a first value, wherein the zone bit of the first value is used for indicating that the routing mode dialing is currently carried out;
and after the dialing of the routing mode is finished, setting the value of the zone bit as a second value, wherein the zone bit of the second value is used for indicating that the dialing of the routing mode is not carried out currently.
9. The gateway of claim 6, wherein the receiving module is further configured to obtain a PPPoE message received from a WAN port;
the control module is further configured to determine whether a destination MAC address of the PPPoE packet is an MAC address configured on the WAN port;
and the routing module is further configured to match the destination MAC address of the PPPoE message to the corresponding LAN port according to a routing table if the destination MAC address of the PPPoE message is the MAC address configured on the WAN port, and send the PPPoE message through the corresponding LAN port.
10. The gateway of claim 6, wherein the control module is further configured to:
and if the message is a non-PPPoE message and the destination MAC address of the message is the MAC address configured on the LAN port, discarding the message.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010425003.5A CN111614565B (en) | 2020-05-19 | 2020-05-19 | Message forwarding method and gateway |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010425003.5A CN111614565B (en) | 2020-05-19 | 2020-05-19 | Message forwarding method and gateway |
Publications (2)
Publication Number | Publication Date |
---|---|
CN111614565A true CN111614565A (en) | 2020-09-01 |
CN111614565B CN111614565B (en) | 2022-05-10 |
Family
ID=72198318
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202010425003.5A Active CN111614565B (en) | 2020-05-19 | 2020-05-19 | Message forwarding method and gateway |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN111614565B (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN114938347A (en) * | 2021-02-04 | 2022-08-23 | 青岛海信宽带多媒体技术有限公司 | Router and router ipv6 self-adaption method and device |
Citations (14)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US6711162B1 (en) * | 1995-09-08 | 2004-03-23 | 3Com Corporation | Method and apparatus for providing proxy service, route selection, and protocol conversion for service endpoints within data networks |
US7088737B1 (en) * | 2000-10-27 | 2006-08-08 | Redback Networks Inc. | Method and apparatus for combining packets having different protocol encapsulations within a circuit |
CN101483606A (en) * | 2009-02-26 | 2009-07-15 | 中国网络通信集团公司 | Internal data switch control method for home gateway and home gateway therefor |
CN102387073A (en) * | 2011-10-18 | 2012-03-21 | 深圳市共进电子股份有限公司 | Method and system for realizing mixed connecting manner of bridge and router of user equipment |
CN103052172A (en) * | 2012-12-28 | 2013-04-17 | 上海寰创通信科技股份有限公司 | PPPoE (point-to-point protocol over Ethernet) realization method for WLAN (wireless local area networks) sub net terminal |
CN105025387A (en) * | 2014-04-29 | 2015-11-04 | 中国电信股份有限公司 | Method and system for internet protocol television (IPTV) intelligent terminal to carry out IPTV business and internet business |
CN105472050A (en) * | 2014-08-20 | 2016-04-06 | 深圳市中兴微电子技术有限公司 | Network access method and network access device |
CN106888130A (en) * | 2017-04-21 | 2017-06-23 | 新华三技术有限公司 | The method to set up and device of router |
CN108307694A (en) * | 2015-11-23 | 2018-07-20 | 华为技术有限公司 | A kind of network connection information acquisition methods and router |
CN110233748A (en) * | 2019-04-22 | 2019-09-13 | 四川省农业科学院服务中心 | Method that is a kind of while realizing network wireless covering and cable network TV |
CN110808923A (en) * | 2019-09-23 | 2020-02-18 | 华为技术有限公司 | Data transmission method, device, equipment and storage medium of distributed network |
CN110943897A (en) * | 2019-10-08 | 2020-03-31 | 中移(杭州)信息技术有限公司 | PPPoE data message transmission method, device, equipment and storage medium |
CN111131541A (en) * | 2019-12-25 | 2020-05-08 | 深圳市共进电子股份有限公司 | Network communication method, device, electronic equipment and storage medium |
CN111162976A (en) * | 2019-12-20 | 2020-05-15 | 北京邮电大学 | Campus network PPPoE proxy dialing method and device |
-
2020
- 2020-05-19 CN CN202010425003.5A patent/CN111614565B/en active Active
Patent Citations (14)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US6711162B1 (en) * | 1995-09-08 | 2004-03-23 | 3Com Corporation | Method and apparatus for providing proxy service, route selection, and protocol conversion for service endpoints within data networks |
US7088737B1 (en) * | 2000-10-27 | 2006-08-08 | Redback Networks Inc. | Method and apparatus for combining packets having different protocol encapsulations within a circuit |
CN101483606A (en) * | 2009-02-26 | 2009-07-15 | 中国网络通信集团公司 | Internal data switch control method for home gateway and home gateway therefor |
CN102387073A (en) * | 2011-10-18 | 2012-03-21 | 深圳市共进电子股份有限公司 | Method and system for realizing mixed connecting manner of bridge and router of user equipment |
CN103052172A (en) * | 2012-12-28 | 2013-04-17 | 上海寰创通信科技股份有限公司 | PPPoE (point-to-point protocol over Ethernet) realization method for WLAN (wireless local area networks) sub net terminal |
CN105025387A (en) * | 2014-04-29 | 2015-11-04 | 中国电信股份有限公司 | Method and system for internet protocol television (IPTV) intelligent terminal to carry out IPTV business and internet business |
CN105472050A (en) * | 2014-08-20 | 2016-04-06 | 深圳市中兴微电子技术有限公司 | Network access method and network access device |
CN108307694A (en) * | 2015-11-23 | 2018-07-20 | 华为技术有限公司 | A kind of network connection information acquisition methods and router |
CN106888130A (en) * | 2017-04-21 | 2017-06-23 | 新华三技术有限公司 | The method to set up and device of router |
CN110233748A (en) * | 2019-04-22 | 2019-09-13 | 四川省农业科学院服务中心 | Method that is a kind of while realizing network wireless covering and cable network TV |
CN110808923A (en) * | 2019-09-23 | 2020-02-18 | 华为技术有限公司 | Data transmission method, device, equipment and storage medium of distributed network |
CN110943897A (en) * | 2019-10-08 | 2020-03-31 | 中移(杭州)信息技术有限公司 | PPPoE data message transmission method, device, equipment and storage medium |
CN111162976A (en) * | 2019-12-20 | 2020-05-15 | 北京邮电大学 | Campus network PPPoE proxy dialing method and device |
CN111131541A (en) * | 2019-12-25 | 2020-05-08 | 深圳市共进电子股份有限公司 | Network communication method, device, electronic equipment and storage medium |
Non-Patent Citations (2)
Title |
---|
TL LINK: ""How to Configure a Router"", 《TECHYLIB.COM》 * |
王家乐等: ""基于PPPOE协议的带宽接入网技术分析"", 《昆明理工大学学报(理工版)》 * |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN114938347A (en) * | 2021-02-04 | 2022-08-23 | 青岛海信宽带多媒体技术有限公司 | Router and router ipv6 self-adaption method and device |
CN114938347B (en) * | 2021-02-04 | 2024-05-10 | 青岛海信宽带多媒体技术有限公司 | Router and router ipv6 self-adaption method and device |
Also Published As
Publication number | Publication date |
---|---|
CN111614565B (en) | 2022-05-10 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN106936939B (en) | Message processing method, related device and NVO3 network system | |
US9338093B2 (en) | Mobile phone docking station VPNs | |
EP3113426B1 (en) | Data packet processing method and device | |
JP4927939B2 (en) | Automatic home agent selection | |
US9825802B2 (en) | Management of seamless handover between different communication systems in an IP dual-mode terminal | |
EP3125476B1 (en) | Service function chaining processing method and device | |
EP3878214B1 (en) | Local identifier locator network protocol (ilnp) breakout | |
US8009614B2 (en) | Mobile communications system conforming to mobile IP, and home agent, mobile node and method used in the mobile communications system | |
CN114124618B (en) | Message transmission method and electronic equipment | |
US20100121946A1 (en) | Method and device for identifying and selecting an interface to access a network | |
US20050138166A1 (en) | IP network node and middleware for establishing connectivity to both the IPv4 and IPv6 networks | |
CA2536457C (en) | Ttl exploration technique for determining capabilities and configuration of a peer router | |
EP2732599A1 (en) | Simultaneous packet data network (pdn) access | |
CN114465776B (en) | Flood attack defense method and related device | |
US7146410B1 (en) | System and method for executing control protocols among nodes in separate IP networks | |
US9438475B1 (en) | Supporting relay functionality with a distributed layer 3 gateway | |
CN111614565B (en) | Message forwarding method and gateway | |
CN105636086A (en) | Network mode switching processing method, network mode switching processing device and terminal comprising network mode switching processing device | |
US9509659B2 (en) | Connectivity platform | |
CN111327530B (en) | Data sending method and device, network system and switch | |
US7966385B2 (en) | Methods and apparatus for virtual network configuration | |
JP2004515165A (en) | Automatic tunneling in heterogeneous networks | |
CN113542441B (en) | Communication processing method and device | |
KR20060095729A (en) | Home link setting method, home gateway device, and mobile terminal | |
CN113300998A (en) | Method and device for realizing data encryption transmission and communication system |
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 |