WO2011160367A1 - 网络地址转换转发方法及装置 - Google Patents

网络地址转换转发方法及装置 Download PDF

Info

Publication number
WO2011160367A1
WO2011160367A1 PCT/CN2010/077877 CN2010077877W WO2011160367A1 WO 2011160367 A1 WO2011160367 A1 WO 2011160367A1 CN 2010077877 W CN2010077877 W CN 2010077877W WO 2011160367 A1 WO2011160367 A1 WO 2011160367A1
Authority
WO
WIPO (PCT)
Prior art keywords
data packet
forwarding
uplink
information
rule
Prior art date
Application number
PCT/CN2010/077877
Other languages
English (en)
French (fr)
Inventor
许煜芝
Original Assignee
中兴通讯股份有限公司
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 中兴通讯股份有限公司 filed Critical 中兴通讯股份有限公司
Publication of WO2011160367A1 publication Critical patent/WO2011160367A1/zh

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L45/00Routing or path finding of packets in data switching networks
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L61/00Network arrangements, protocols or services for addressing or naming
    • H04L61/09Mapping addresses
    • H04L61/25Mapping addresses of the same type
    • H04L61/2503Translation of Internet protocol [IP] addresses
    • H04L61/2514Translation of Internet protocol [IP] addresses between local and global IP addresses

Definitions

  • the present invention relates to the field of communications, and in particular, to a network address translation and forwarding method and apparatus.
  • IP networks have become an indispensable tool in people's daily lives.
  • the scale of the network is expanding, and the number of network users is increasing.
  • IPV4 network address the address resource of public network is very limited.
  • NAT Network Address Translation
  • IPV4 network address the address resource of public network is very limited.
  • NAT technology uses internal addresses in the internal network of the LAN.
  • the internal nodes want to communicate with the external network, they translate the internal addresses into public addresses on the gateway, so that they can be used normally on the external network.
  • Technology can enable multiple computers to share network connections, which solves the problem of shortage of public IP addresses.
  • the hardware is used to achieve high NAT forwarding efficiency, but the cost is relatively high, and the interface customization is not flexible. It is generally used in high-end devices.
  • the existing software mode mainly uses the information of the quintuple (source IP address, source port number, destination IP address, destination port, and protocol) in the packet to match the forwarding entry table established by the first packet, thereby completing the data. Forward.
  • GPON Gigabit-Capable Passive Optical Network
  • ITU-TG.984.X ITU-TG.984.X standard
  • Many advantages such as rich user interfaces are considered by most operators as ideal technologies for broadband and integrated transformation of access network services.
  • GPON terminals are mostly used for Layer 2 data exchange.
  • home gateway GPON terminals will be a development trend.
  • the GPON terminal private network and the public network network. The efficiency of address translation is not high, which seriously restricts the development of GPON technology.
  • the technical problem to be solved by the present invention is to provide a network address translation and forwarding method and apparatus, so as to improve forwarding efficiency while realizing network address translation.
  • the present invention provides a network address translation and forwarding method, which is implemented based on a network address translation and forwarding device, and the method includes:
  • an uplink forwarding rule or a downlink saved on the network address translation forwarding device a forwarding rule, where the uplink forwarding rule includes a network address translation NAT rule and a service transmission channel information, the downlink forwarding rule includes a NAT rule, and the NAT rule includes a quintuple information of the data packet and a corresponding NAT translation.
  • the network address translation is performed, and the processed uplink data packet is sent to the corresponding service transmission channel;
  • the network address translation is performed, and the processed downlink data packet is sent to the corresponding port.
  • the network address translation forwarding device may The downlink data packet performs normal NAT and forwarding, and generates a corresponding uplink forwarding rule or a downlink forwarding rule.
  • the network address translation forwarding device is configured to store a correspondence between the label control information TCI and the service transmission channel information; record connection information of the network connection, where the connection information includes a network connection IP address and a corresponding TCI, and the network The IP address of the connection is the IP address after the NAT conversion;
  • the step of generating a corresponding uplink forwarding rule includes:
  • the network address translation forwarding device matches the connection information of the corresponding network connection according to the NAT translated IP address in the NAT rule corresponding to the uplink data packet;
  • the quintuple information in the row data packet and the corresponding service transmission channel information are recorded in the corresponding uplink forwarding rule.
  • the method further includes:
  • the ARP learns the MAC address corresponding to the IP address of the next hop routing node, converts the destination MAC address to the MAC address corresponding to the IP address of the next hop routing node, and records the IP address and its corresponding MAC address.
  • the step of processing the downlink data packet by the matching downlink forwarding rule further includes: modifying a MAC address in the downlink data packet.
  • the step of generating a corresponding uplink forwarding rule further includes: matching a corresponding TCI according to the NAT-transformed IP address, and recording the TCI into a corresponding uplink forwarding rule;
  • the step of forwarding the rule further includes: matching the corresponding TCI according to the destination IP address of the downlink data packet, and recording the TCI into the corresponding downlink forwarding rule;
  • the step of processing, by the network address translation and forwarding device, the uplink data packet according to the matched corresponding uplink forwarding rule further includes: modifying a TCI in the uplink data packet;
  • the step of processing the downlink data packet by the corresponding downlink forwarding rule further includes: modifying the TCI in the downlink data packet.
  • the modifying the TCI in the uplink data packet is: adding a corresponding TCI in the uplink data packet; modifying the TCI in the downlink data packet to delete the downlink datagram TCI in the text.
  • connection information of the network connection recorded by the network address translation forwarding device further includes PPP information
  • the step of generating a corresponding uplink forwarding rule includes: matching the corresponding PPP information according to the NAT-transformed IP address, and recording the PPP information into a corresponding uplink forwarding rule;
  • the step further includes: according to the purpose of the downlink data packet
  • the IP address matches the corresponding PPP information, and the PPP information is recorded in the corresponding downlink forwarding rule.
  • the step of processing the uplink data packet by the network address translation forwarding device according to the matched corresponding uplink forwarding rule is further The method further includes: modifying the PPP information in the uplink data packet; the step of processing, by the network address translation forwarding device, the downlink data packet according to the matched corresponding downlink forwarding rule, further comprising: modifying the downlink datagram PPP information in the text.
  • the modifying the PPP information in the uplink data packet is: adding PPP header information to the uplink data packet; and modifying the PPP information in the downlink data packet to be in the downlink The PPP header information is removed from the data packet.
  • the service transmission channel information includes data logical transmission channel information and corresponding transmission aggregation entity information in the GPON, and the TCI includes virtual local area network information and priority information.
  • the present invention further provides a network address translation and forwarding device, and the device includes:
  • a forwarding table configured to save an uplink forwarding rule or a downlink forwarding rule, where the uplink forwarding rule includes a network address translation NAT rule and a service transmission channel information, and the lower forwarding rule includes a NAT rule, where the NAT rule includes five data packets. Tuple information and its corresponding NAT translated IP address and port;
  • a receiving matching module configured to receive an uplink data packet or a downlink data packet, and match, according to the quintuple information in the uplink data packet or the downlink data packet, a corresponding uplink forwarding rule saved in the forwarding table or Downlink forwarding rules;
  • a forwarding processing module configured to be connected to the receiving matching module, and configured to: if the uplink data packet matches the corresponding uplink forwarding rule, perform the uplink data packet according to the matched corresponding uplink forwarding rule Processing, and sending the processed uplink data packet to the corresponding service transmission channel; if the downlink data packet matches the corresponding downlink forwarding rule, the data packet is sent to the corresponding port according to the matching data.
  • the device further includes a normal NAT forwarding module connected to the receiving and matching module, wherein the normal NAT forwarding module is configured to: if the uplink data packet does not match the corresponding uplink forwarding rule or the downlink data If the packet does not match the corresponding downlink forwarding rule, perform normal NAT and forwarding on the uplink data packet or the downlink data packet, and generate a corresponding uplink forwarding rule or a downlink forwarding rule.
  • a normal NAT forwarding module connected to the receiving and matching module, wherein the normal NAT forwarding module is configured to: if the uplink data packet does not match the corresponding uplink forwarding rule or the downlink data If the packet does not match the corresponding downlink forwarding rule, perform normal NAT and forwarding on the uplink data packet or the downlink data packet, and generate a corresponding uplink forwarding rule or a downlink forwarding rule.
  • the device further includes a configuration record module, and a rule generation module connected to the configuration record module, the normal NAT forwarding module, and the forwarding table, where
  • the configuration record module is configured to save a correspondence between the label control information TCI and the service transmission channel information, and record connection information of the network connection, where the connection information includes a network connection IP address and a corresponding TCI, and the network connection IP address is The NAT-transformed IP address; and the rule generation module is configured to: match the NAT-connected IP address in the NAT rule corresponding to the uplink data packet to the corresponding network connection connection information; The TCI in the connection information matches the corresponding service transmission channel information, and generates the uplink forwarding rule including the quintuple information in the uplink data packet and the corresponding service transmission channel information.
  • the rule generating module is further configured to: match the corresponding TCI according to the NAT translated IP address, and record the TCI into a corresponding uplink forwarding rule; according to the destination IP address of the downlink data packet Matching the corresponding TCI, and recording the TCI into the corresponding downlink forwarding rule;
  • the forwarding processing module is further configured to: process the uplink data packet according to the matched corresponding uplink forwarding rule, including: modifying a TCI in the uplink data packet; TCI.
  • the rule generating module is further configured to: match the corresponding PPP information according to the NAT translated IP address, and record the PPP information into a corresponding uplink forwarding rule; according to the downlink data
  • the destination IP address matches the corresponding PPP information, and the PPP information is recorded in the corresponding downlink forwarding rule;
  • the forwarding processing module is further configured to: process the uplink data packet according to the matched corresponding uplink forwarding rule, and modify the PPP information in the uplink data packet; The PPP information in the downlink data packet is changed.
  • the network address translation forwarding method and device of the present invention processes the uplink and downlink data packets according to the quintuple information of the data packet to match the established uplink and downlink forwarding rules, and sends the uplink data packet to the corresponding service transmission.
  • Channels improve the efficiency of data packet forwarding and forwarding.
  • FIG. 1 is a block diagram of an embodiment of a network address translation forwarding device
  • FIG. 2 is a flow chart of an embodiment of generating a forwarding table
  • 3 is a flow chart of an embodiment of data packet forwarding.
  • the main idea of the network address translation and forwarding method and device of the present invention is to process the uplink and downlink data packets according to the quintuple information of the data packet, and send the uplink data packet to the corresponding data packet.
  • the service transmission channel improves the efficiency of data packet forwarding and forwarding.
  • the network address translation forwarding method of the present invention is implemented by a network address translation forwarding device, and the method includes:
  • the network address translation and forwarding device receives the data packet, and matches the uplink and downlink forwarding rules stored in the forwarding table according to the quintuple information of the data packet, where the data packet includes an uplink data packet and a downlink data packet.
  • the uplink forwarding rule includes a network address translation (NAT) rule and a service transmission channel information
  • the downlink forwarding rule includes a NAT rule, where the NAT rule includes a quintuple information of the data packet and a corresponding NAT translated IP address. (NAT IP) and port (NAT Port);
  • the network address translation forwarding device processes the data packet according to the matched corresponding forwarding rule, and sends the processed uplink data packet to the corresponding service transmission channel, and the processing is performed.
  • the downlink data packet is sent to the corresponding port. That is, if the uplink data packet matches the corresponding uplink forwarding rule, the network address translation forwarding device root The uplink data packet is sent to the corresponding service transmission channel; if the downlink data packet matches the corresponding downlink forwarding rule, the network address translation forwarding device pairs the downlink data according to the matched corresponding downlink forwarding rule.
  • the packet is processed, and the processed downlink data packet is sent to the corresponding port.
  • the network address translation forwarding device performs normal network address translation (NAT) and forwarding on the data packet, and generates a corresponding NAT rule. That is, if the uplink data packet does not match the corresponding uplink forwarding rule or the downlink data packet does not match the corresponding downlink forwarding rule, the network address translation forwarding device sends the uplink data packet or the The downlink data packet is subjected to normal NAT and forwarding, and a corresponding uplink forwarding rule or a downlink forwarding rule is generated.
  • NAT network address translation
  • the network address translation forwarding device is configured to store a correspondence between Tag Control Information (TCI) and a service transmission channel; and when creating a network connection, record connection information of the network connection, The network connection IP address and the corresponding TCI are included;
  • the NAT rule includes a quintuple information of the data packet and a corresponding NAT translated IP address (NAT IP) and a port (NAT Port);
  • the process of generating an uplink forwarding rule in the forwarding table includes:
  • the network address translation forwarding device matches the connection information of the corresponding network connection according to the NAT IP in the NAT rule of the uplink data packet;
  • the quintuple information and the corresponding service transmission channel information are recorded in the corresponding uplink forwarding rule according to the TCI matching corresponding service transmission channel information in the corresponding connection information.
  • the downlink forwarding rule is generated by the network address translation forwarding device according to the NAT rule of the downlink data packet.
  • the network address translation and forwarding device performs NAT on the upper and lower data packets, and before forwarding, finds the IP corresponding to the next routing node according to the routing information. And learning the MAC address corresponding to the IP address of the next hop routing node through the Address Resolution Protocol (ARP), and converting the destination MAC address into the next hop routing node. Corresponding MAC address is forwarded, and the corresponding relationship between the IP address and the MAC address is recorded. When the uplink and downlink forwarding rules are generated, the corresponding MAC address is matched according to the IP address, and the corresponding MAC address is matched and recorded.
  • ARP Address Resolution Protocol
  • the process of processing the uplink and downlink data packets according to the uplink and downlink forwarding rules further includes modifying the MAC addresses in the uplink and downlink data packets.
  • the network address translation and forwarding device In order to implement the processing of the TCI in the process of the forwarding and forwarding, the network address translation and forwarding device generates the uplink forwarding rule, and matches the corresponding TCI according to the IP address converted by the NAT, and records the corresponding TCI in the corresponding uplink forwarding rule.
  • the network address translation forwarding device When the network address translation forwarding device generates the downlink forwarding rule, the corresponding TCI is matched according to the destination IP address, and is recorded in the corresponding uplink forwarding rule; the process of processing the data packet according to the forwarding rule includes modifying TCI in the data message.
  • Modifying the TCI in the data packet refers to adding a corresponding TCI to the uplink data packet or deleting a TCI in the downlink data packet.
  • the connection information recorded by the device further includes corresponding PPP information, and when the network address translation forwarding device generates the uplink forwarding rule, the corresponding PPP information is matched according to the NAT translated IP address, and recorded.
  • the network address translation forwarding device In the corresponding uplink forwarding rule, the network address translation forwarding device generates the downlink forwarding rule, matches the corresponding PPP information according to the destination IP address, and records the corresponding PPP information in the corresponding downlink forwarding rule;
  • the process of processing the data packet includes: modifying the PPP information in the data packet when the network connection is a PPP connection.
  • the correspondence between the TCI and the service transmission channel is configured according to the networking requirement, and the service transmission channel information includes the G-PON Encapsulation Method Port (GemPort) information and the corresponding transmission in the GPON.
  • G-PON Encapsulation Method Port GemPort
  • a transmission entity Transmission Container, Tcont, which is used for GPON uplink packet bandwidth scheduling
  • the TCI includes a virtual local area network (VLAN), logically dividing the local area network device into network segments to implement virtual work.
  • Group data exchange Information and priority (Priority, ie 802.1p priority in data packets) information.
  • the present invention also provides an embodiment of a network address translation forwarding device.
  • the network address translation forwarding device includes: a forwarding table configured to save an uplink forwarding rule or a downlink forwarding rule, where the uplink forwarding rule includes a network address translation NAT rule and a service transmission channel
  • the information includes: the NAT rule includes a quintuple information of the data packet and the corresponding NAT-transformed IP address and port; and the receiving matching module is configured to receive the uplink data packet or a downlink data packet, according to the uplink data packet or the downlink data packet; and a forwarding processing module, configured to be connected to the receiving and matching module, and configured to: if the uplink data packet matches the corresponding uplink forwarding The rule, the uplink data packet is processed according to the matched corresponding uplink forwarding rule, and the processed uplink data packet is sent to the corresponding service transmission channel; if the downlink data packet matches the corresponding The downlink forwarding rule is sent to the corresponding port according to the
  • the device includes:
  • the forwarding table 110 is configured to save a forwarding rule, where the uplink forwarding rule includes a NAT rule and a service transmission channel information, and the downlink forwarding rule includes a NAT rule.
  • the receiving matching module 120 is configured to receive the data packet, and match the corresponding uplink and downlink forwarding rules in the forwarding table 110 according to the quintuple information in the data packet.
  • the forwarding processing module 130 is configured to be connected to the receiving and matching module 120, and configured to process the data packet according to the forwarding rule when the receiving matching module 120 matches the corresponding forwarding rule, and send the processed uplink data packet to the corresponding
  • the service transmission channel sends the processed downlink data packet to the corresponding port.
  • the apparatus in this embodiment may further include a normal NAT forwarding module 140 connected to the receiving matching module 120, configured to perform normal network address translation and forwarding on data packets that are not matched to the forwarding rule, and generate corresponding
  • the NAT rule includes the quintuple information of the data packet and its corresponding NAT translated IP address (NAT IP) and port (NAT Port).
  • the device in this embodiment may further include a configuration record module 150, and a rule generation module 160 connected to the configuration record module 150, the normal NAT forwarding module 140, and the forwarding table 110.
  • the configuration record module 150 is configured to store a correspondence between the tag control information (TCI) and the service transmission channel, and record the connection information of the network connection when the network connection is created, including the network connection IP address and the corresponding TCI;
  • the rule generating module 160 is configured to match, according to the NAT IP in the NAT rule of the uplink data packet, the connection information of the corresponding network connection;
  • the uplink forwarding rule is generated according to the TCI matching corresponding service transmission channel information in the corresponding connection information.
  • the uplink and downlink forwarding rules in the embodiment may further include a corresponding TCI
  • the rule generating module 160 may be further configured to: match the corresponding TCI according to the NAT IP address in the NAT rule of the uplink data packet; The destination IP address of the data 4 matches the corresponding TCI; and when the upper and lower forwarding rules are generated, the matched TCI is recorded in the corresponding uplink and downlink forwarding rules.
  • the process of forwarding the data message according to the forwarding rule by the forwarding processing module 130 includes modifying the TCI in the data>3 ⁇ 4 text.
  • connection information recorded by the configuration record module 150 in this embodiment may further include corresponding PPP information
  • the rule generation module 160 may be further configured to match the corresponding PPP information according to the NAT IP address in the NAT rule of the uplink data packet. And matching the corresponding PPP information according to the destination IP address of the downlink data packet; and recording the matched PPP information into the corresponding upper and lower forwarding rules.
  • the process of processing the data packet according to the forwarding rule by the forwarding processing module 130 includes modifying the PPP information in the data when the network connection is a PPP connection.
  • the correspondence between the TCI and the service transmission channel is configured according to the networking requirements.
  • the service transmission channel information includes the data logical transmission channel (GemPort) information in the GPON and the corresponding transmission aggregation entity (Tcont), and the TCI includes the virtual local area network (VLAN) information and Priority information.
  • GemPort data logical transmission channel
  • Tcont transmission aggregation entity
  • VLAN virtual local area network
  • quintuple information that is, source IP address information, source port information, destination IP address information, destination port information, and protocol
  • the quintuple information is an identifier of various packets, and is also an index of a forwarding table
  • Gateway MAC information that is, media access control of the next hop of the packet (Media Access
  • PPP information used to record whether the Internet connection is a PPP connection, and record the session identifier of the PPP connection;
  • TCI that is, TCI after message conversion;
  • GemPort information that is, the GemPort information that the packet passes, only the uplink packet, that is, the packet sent to the GPON OLT will use the information
  • Tcont information that is, the Tcont information that the packet passes, and only the uplink packet uses the information
  • the network address translation forwarding device records the connection information of the following network connections when creating an Internet connection:
  • IP address information used to record the IP address corresponding to the Internet connection
  • TCI used to record Vlan/Priority information corresponding to the Internet connection
  • PPP tag used to record whether the Internet connection is a PPP connection
  • the PPP session identifier is used to record the session identifier when the Internet connection is a PPP connection. If the Internet connection is not a PPP connection, the identifier is 0.
  • the network address translation and forwarding device of the GPON terminal is preconfigured to save the following information:
  • TCI and GemPort The relationship between TCI and GemPort is used to record the GemPort information corresponding to the TCI.
  • the ARP table information is configured to record the information corresponding to the IP address and the MAC address.
  • the forwarding table records all the forwarding rules.
  • the GPON terminal forwards the packet according to the forwarding table information. If the packet matches the forwarding table, the forwarding processing module directly forwards the packet. Otherwise, the packet enters the normal NAT forwarding mode, and the protocol stack follows the normal rule. Forward.
  • Step S201 Obtain a normal NAT rule.
  • the NAT rule includes the quintuple, interface, gateway, and so on.
  • Step S202 Match the ARP table information according to the rule gateway IP address information to find a corresponding
  • the MAC address that is, the MAC address of the next hop of the packet, if found, proceeds to step S203, otherwise the process ends;
  • Step S203 determining whether it is an uplink rule or a downlink rule according to the interface information, because the processing manners of the uplink packet and the downlink packet are inconsistent, if it is an uplink rule, the process proceeds to step S204, otherwise, the process proceeds to step S208;
  • Step S204 The uplink rule matches the Internet connection information according to the NAT IP information, and if yes, the process proceeds to step S205, otherwise the process ends.
  • Step S205 Obtain TCI and PPP information of the Internet connection, and need TCI and PPP related information when the packet NAT is converted. If the matching proceeds to step S206, the process ends.
  • Step S206 Match the corresponding GemPort according to the TCI, that is, the uplink packet is sent to
  • Step S207 Find the corresponding Tcont according to the GemPort, that is, the Tcont information sent by the uplink packet, if the matching proceeds to step S210, otherwise the process ends;
  • Step S208 The downlink rule matches the Internet connection information according to the destination IP address information, and if yes, the process proceeds to step S209, otherwise the process ends.
  • Step S209 Obtain TCI and PPP information of the Internet connection, and need TCI and PPP related information when the packet NAT is converted. If the matching proceeds to step S210, the process ends.
  • Step S210 The quintuple is used as an index to match whether the rule exists in the forwarding table. If it does not exist, a new forwarding rule is added. Otherwise, the original forwarding rule is modified, and the NAT IP, NAT Port, and gateway corresponding to the quintuple are recorded. MAC, TCI, PPP, Gemport, and Tcont information. After the rule is modified, the generation process of the forwarding table is ended.
  • Step S301 After receiving the data packet, match the forwarding table according to the quintuple information in the packet. If the matching information is matched, go to step S302, otherwise enter the normal NAT process, and find the corresponding next hop according to the routing information.
  • the gateway IP obtains the translated NAT IP address and NAT port information through NAT, and learns the MAC address corresponding to the gateway IP through ARP protocol, performs quintuple conversion of the packet, and translates the MAC address, and sends the converted text. And generate corresponding forwarding rules;
  • Step S302 determining whether the message is an uplink message or a downlink message, if the uplink message proceeds to step S303, otherwise proceeding to step S309;
  • Step S303 Uplinking the message, modifying the source MAC in the message is the MAC of the GPON terminal, and the destination MAC is the MAC of the next hop gateway;
  • Step S304 Modify the source IP address of the message to be the NAT IP address, and the source port is the NAT port information.
  • Step S305 Modify the TCI in the packet, and add the corresponding Vlan and Priority information to the packet.
  • Step S306 determining whether the Internet connection is a PPP connection, if the process proceeds to step S307, otherwise proceeding to step S308;
  • Step S307 When the Internet connection is a PPP connection, the PPP header information such as the session identifier needs to be added to the packet.
  • Step S308 After the modified packet is recalculated, the checksum is re-calculated, and then sent to the corresponding Gemport and Tcont information, so that the uplink packet is forwarded and ended.
  • Step S309 The downlink MAC address is modified, and the source MAC in the ⁇ message is the MAC of the GPON terminal, and the destination MAC is the MAC of the next hop;
  • Step S310 Modify the destination IP address of the ⁇ message as the NAT IP address, and the destination port is the NAT Port information;
  • Step S311 Modify the TCI in the packet, and delete the corresponding Vlan and Priority information in the packet.
  • Step S312 determining whether the Internet connection is a PPP connection, if the process proceeds to step S313, otherwise proceeds to step S314;
  • Step S313 When the Internet connection is a PPP connection, the PPP header is removed from the packet. Interest rate
  • Step S314 After the modified packet is recalculated, the destination MAC address is forwarded to the corresponding Lan port, so that the downlink packet is forwarded and ended.
  • the method and the device of the invention can not only realize the forwarding of the network address, but also complete the processing of the TCI and the matching of the GemPort and the Tcont information through the processing of the related information, thereby further improving the forwarding efficiency and being applicable to the network environment of the PPP dialing. .
  • the network address translation and forwarding method and apparatus of the present invention generate an uplink and downlink forwarding rule of data, and match the established uplink and downlink forwarding rules to the uplink and downlink datagrams according to the quintuple information of the data packet.
  • the text is processed, and the uplink data packet is sent to the corresponding service transmission channel to improve the efficiency of converting and forwarding data packets.

Abstract

本发明公开了一种网络地址转换转发方法及装置。装置包括:转发表,其保存上行转发规则或下行转发规则,其中上行转发规则包括NAT规则和业务传输通道信息;接收匹配模块,其接收上行数据报文或下行数据报文,根据上行数据报文或下行数据报文中的五元组信息匹配对应的上行转发规则或下行转发规则;转发处理模块,若上行数据报文匹配到对应的上行转发规则,则根据该上行转发规则对上行数据报文进行处理,并将处理后的上行数据报文发送到对应的业务传输通道,若下行数据报文匹配到对应的下行转发规则,则根据该下行转发规则对下行数据报文进行处理,并将处理后的下行数据报文发送到对应的端口。本发明可以在实现网络地址转换的同时提高转发效率。

Description

网络地址转换转发方法及装置
技术领域
本发明涉及通信领域, 尤其涉及一种网络地址转换转发方法及装置。
背景技术
随着网络的发展, IP网络已经成为人们日常生活中必不可少的工具, 网 络的规模在不断扩大, 网络用户的数量在不断增加, 然而由于历史原因以及
IPV4 网络地址的局限性, 公网的地址资源十分有限。 目前网络地址转换 ( Network Address Translation, NAT )技术是解决这个问题的主要方法。 简 单的说, NAT技术就是在局域网内部网络中使用内部地址, 而当内部节点要 与外部网络进行通讯时, 就在网关上将内部地址转换成公网地址, 从而在外 部网络上正常使用, NAT技术可以使多台计算机共享网络连接, 很好地解决 了公网 IP地址紧缺的问题。
目前用于实现 NAT转发功能的方法有硬件和软件两种方式。硬件方式最 大的优点是速度, 使用硬件来实现 NAT转发效率比较高, 但是成本比较高, 并且接口定制不灵活, 一般用于高端设备中。 现有软件方式主要是通过报文 中的五元组(源 IP地址、 源端口号、 目的 IP地址、 目的端口以及协议)等 信息, 匹配由首报文建立的转发条目表, 从而完成数据的转发。
千兆无源光网络( Gigabit-Capable Passive Optical Network, GPON )技术 是基于 ITU-TG.984.X标准的最新一代宽带无源光综合接入标准,具有高带宽、 高效率、 大范围覆盖、 用户接口丰富等众多优点, 被大多数运营商视为实现 接入网业务宽带化、 综合化改造的理想技术。 目前从现网应用来看, GPON 终端大部分应用于二层数据交换, 但是随着 GPON技术的发展, 家庭网关式 GPON终端将是一个发展的趋势, 目前 GPON终端私网和公网之间网络地址 转换的效率不高, 严重制约 GPON技术的发展。
发明内容 本发明要解决的技术问题是提供一种网络地址转换转发方法及装置, 以 在实现网络地址转换的同时提高转发效率。
为解决以上技术问题, 本发明提供了一种网络地址转换转发方法, 该方 法基于网络地址转换转发装置实现, 该方法包括:
网络地址转换转发装置接收上行数据报文或下行数据报文, 根据所述上 行数据报文或下行数据报文中的五元组信息匹配所述网络地址转换转发装置 上保存的上行转发规则或下行转发规则, 其中, 所述上行转发规则包括网络 地址转换 NAT规则和业务传输通道信息,所述下行转发规则包括 NAT规则, 所述 NAT规则包括数据报文的五元组信息及其对应的 NAT转换后的 IP地址 和端口;
若所述上行数据报文匹配到对应的上行转发规则, 则所述网络地址转换 并将处理后的上行数据报文发送到对应的业务传输通道;
若所述下行数据报文匹配到对应的下行转发规则, 则所述网络地址转换 并将处理后的下行数据报文发送到对应的端口。
优选地, 若所述上行数据报文未匹配到对应的上行转发规则或所述下行 数据报文未匹配到对应的下行转发规则, 则所述网络地址转换转发装置对所 述上行数据报文或所述下行数据报文进行普通 NAT及转发,并生成对应的上 行转发规则或下行转发规则。
优选地, 所述网络地址转换转发装置配置保存标签控制信息 TCI与业务 传输通道信息的对应关系; 记录网络连接的连接信息, 其中所述连接信息包 括网络连接 IP地址及对应的 TCI且所述网络连接 IP地址即所述 NAT转换后 的 IP地址;
其中所述生成对应的上行转发规则的步骤包括:
所述网络地址转换转发装置根据所述上行数据报文对应的 NAT规则中 的所述 NAT转换后的 IP地址匹配对应的网络连接的连接信息;
根据对应的连接信息中的 TCI匹配对应的业务传输通道信息, 将所述上 行数据报文中的五元组信息及对应的业务传输通道信息记录到对应的上行转 发规则中。
优选地, 在所述网络地址转换转发装置对所述上行数据报文或所述下数 据报文进行普通 NAT之后及在所述转发之前, 还包括:
根据路由信息找到对应下一跳路由节点的 IP地址, 并通过地址解析协议
ARP学习到所述下一跳路由节点的 IP地址对应的 MAC地址, 将目的 MAC 地址转换为所述下一跳路由节点的 IP地址对应的 MAC地址, 并记录所述 IP 地址与其对应的 MAC地址的对应关系;
行转发规则或下行转发规则中;
所述网络地址转换转发装置根据匹配到的对应的上行转发规则对所述上 行数据报文进行处理的步骤还包括: 修改所述上行数据报文中的 MAC地址; 所述网络地址转换转发装置根据匹配到的对应的下行转发规则对所述下行数 据报文进行处理的步骤还包括: 修改所述下行数据报文中的 MAC地址。
优选地, 所述生成对应的上行转发规则的步骤还包括: 根据所述 NAT转 换后的 IP地址匹配对应的 TCI,并将所述 TCI记录到对应的上行转发规则中; 所述生成对应的下行转发规则的步骤还包括: 根据所述下行数据报文的目的 IP地址匹配对应的 TCI, 并将所述 TCI记录到对应的下行转发规则中;
所述网络地址转换转发装置根据匹配到的对应的上行转发规则对所述上 行数据报文进行处理的步骤还包括: 修改所述上行数据报文中的 TCI; 所述 网络地址转换转发装置根据匹配到的对应的下行转发规则对所述下行数据报 文进行处理的步骤还包括: 修改所述下行数据报文中的 TCI。
优选地, 所述修改所述上行数据报文中的 TCI是, 在所述上行数据报文 中增加对应的 TCI; 所述修改所述下行数据报文中的 TCI是, 删除所述下行 数据报文中的 TCI。
优选地, 所述网络地址转换转发装置记录的所述网络连接的连接信息中 还包括 PPP信息, 则, 所述生成对应的上行转发规则的步骤包括: 根据所述 NAT转换后的 IP 地址匹配对应的 PPP信息,并将所述 PPP信息记录到对应的上行转发规则中; 所述生成对应的下行转发规则的步骤还包括: 根据所述下行数据报文的目的
IP地址匹配对应的 PPP信息 ,并将所述 PPP信息记录到对应下行转发规则中; 所述网络地址转换转发装置根据匹配到的对应的上行转发规则对所述上 行数据报文进行处理的步骤还包括: 修改所述上行数据报文中的 PPP信息; 所述网络地址转换转发装置根据匹配到的对应的下行转发规则对所述下行数 据报文进行处理的步骤还包括: 修改所述下行数据报文中的 PPP信息。
优选地, 所述修改所述上行数据报文中的 PPP信息是, 在所述上行数据 报文中加入 PPP头信息; 所述修改所述下行数据报文中的 PPP信息是, 在所 述下行数据报文中去除 PPP头信息。
优选地, 所述业务传输通道信息包括 GPON中的数据逻辑传输通道信息 及对应的传输聚合实体信息, 所述 TCI包括虚拟局域网信息及优先级信息。
为解决以上技术问题, 本发明还提供一种网络地址转换转发装置, 该装 置包括:
转发表, 其设置为保存上行转发规则或下行转发规则, 其中上行转发规 则包括网络地址转换 NAT规则和业务传输通道信息, 所述下转发规则包括 NAT规则, 所述 NAT规则包括数据报文的五元组信息及其对应的 NAT转换 后的 IP地址和端口;
接收匹配模块, 其设置为接收上行数据报文或下行数据报文, 根据所述 上行数据报文或下行数据报文中的五元组信息匹配所述转发表中保存的对应 的上行转发规则或下行转发规则; 以及
转发处理模块, 其与所述接收匹配模块连接, 并设置为: 若所述上行数 据报文匹配到对应的上行转发规则, 则根据匹配到的对应的上行转发规则对 所述上行数据报文进行处理, 并将处理后的上行数据报文发送到对应的业务 传输通道; 若所述下行数据报文匹配到对应的下行转发规则, 则根据匹配到 据"¾文发送到对应的端口。 优选地, 所述装置还包括与所述接收匹配模块连接的普通 NAT转发模 块,其中所述普通 NAT转发模块设置为若所述上行数据报文未匹配到对应的 上行转发规则或所述下行数据报文未匹配到对应的下行转发规则, 则对所述 上行数据报文或所述下行数据报文进行普通 NAT及转发,并生成对应的上行 转发规则或下行转发规则。
优选地, 所述装置还包括配置记录模块, 以及与所述配置记录模块、 普 通 NAT转发模块、 转发表连接的规则生成模块, 其中,
所述配置记录模块设置为保存标签控制信息 TCI与业务传输通道信息的 对应关系, 记录网络连接的连接信息, 其中所述连接信息包括网络连接 IP地 址及对应的 TCI且所述网络连接 IP地址即所述 NAT转换后的 IP地址; 以及 所述规则生成模块设置为:根据所述上行数据报文对应的 NAT规则中的 所述 NAT转换后的 IP地址匹配对应的网络连接的连接信息; 根据对应的连 接信息中的 TCI匹配对应的业务传输通道信息, 生成包括所述上行数据报文 中的五元组信息及对应的业务传输通道信息的所述上行转发规则。
优选地, 所述规则生成模块还设置为: 根据所述 NAT转换后的 IP地址 匹配对应的 TCI, 并将所述 TCI记录到对应的上行转发规则中; 根据所述下 行数据 文的目的 IP地址匹配对应的 TCI, 并将所述 TCI记录到对应的下行 转发规则中; 以及
所述转发处理模块还设置为: 根据匹配到的对应的上行转发规则对所述 上行数据报文进行处理的过程包括修改所述上行数据报文中的 TCI; 根据匹 述下行数据报文中的 TCI。
优选地, 所述规则生成模块还设置为: 根据所述 NAT转换后的 IP地址 匹配对应的 PPP信息, 并将所述 PPP信息记录到对应的上行转发规则中; 根 据所述下行数据^艮文的目的 IP地址匹配对应的 PPP信息,并将所述 PPP信息 记录到对应下行转发规则中; 以及
所述转发处理模块还设置为: 根据匹配到的对应的上行转发规则对所述 上行数据报文进行处理的过程包括修改所述上行数据报文中的 PPP信息; 根 改所述下行数据报文中的 PPP信息。
本发明的网络地址转换转发方法及装置根据数据报文的五元组信息匹配 已建立的上、 下行转发规则对上、 下行数据报文进行处理, 并将上行数据报 文发送到对应的业务传输通道, 提高数据报文的转换转发效率。 附图概述
图 1为网络地址转换转发装置实施例的模块示意图;
图 2为生成转发表的实施例流程图;
图 3为数据报文转发的实施例流程图。
本发明的较佳实施方式
本发明网络地址转换转发方法及装置的主要思想是根据数据报文的五元 组信息匹配已建立的上、 下行转发规则对上、 下行数据报文进行处理, 并将 上行数据报文发送到对应的业务传输通道, 提高数据报文的转换转发效率。
本发明网络地址转换转发方法,该方法基于网络地址转换转发装置实现, 该方法包括:
网络地址转换转发装置接收数据报文, 根据所述数据报文的五元组信息 匹配转发表中保存的上、 下行转发规则, 所述数据报文包括上行数据报文和 下行数据报文, 所述上行转发规则包括网络地址转换(NAT )规则和业务传 输通道信息, 所述下行转发规则包括 NAT规则, 所述 NAT规则包括数据报 文的五元组信息及其对应的 NAT转换后的 IP地址( NAT IP )及端口 ( NAT Port ) ;
若匹配到对应的转发规则, 所述网络地址转换转发装置根据匹配的对应 转发规则对所述数据报文进行处理, 并将处理后的上行数据报文发送到对应 的业务传输通道, 将处理后的下行数据报文发送到对应的端口。 即, 若所述 上行数据报文匹配到对应的上行转发规则, 则所述网络地址转换转发装置根 的上行数据报文发送到对应的业务传输通道; 若所述下行数据报文匹配到对 应的下行转发规则, 则所述网络地址转换转发装置根据匹配到的对应的下行 转发规则对所述下行数据报文进行处理, 并将处理后的下行数据报文发送到 对应的端口。
若未匹配到转发规则, 所述网络地址转换转发装置对所述数据报文进行 普通网络地址转换(NAT )及转发, 并生成对应的 NAT规则。 即, 若所述上 行数据报文未匹配到对应的上行转发规则或所述下行数据报文未匹配到对应 的下行转发规则, 则所述网络地址转换转发装置对所述上行数据报文或所述 下行数据报文进行普通 NAT及转发,并生成对应的上行转发规则或下行转发 规则。 在这里所述的普通 NAT后的转发, 即利用普通的 NAT规则经过多层 信息查找找到转发数据报文所对应的各种信息, 这种查找过程可参见下述图 2中所描述的生成上、 下行转发规则的过程以查找到所需信息。
为了建立上、 下行转发规则, 所述网络地址转换转发装置配置保存标签 控制信息( Tag Control Information, TCI )与业务传输通道的对应关系; 且在 创建网络连接时, 记录该网络连接的连接信息, 其中包括网络连接 IP地址及 对应的 TCI; 所述 NAT规则包括数据报文的五元组信息及其对应的 NAT转 换后的 IP地址( NAT IP )及端口 ( NAT Port ) ;
所述转发表中上行转发规则的生成的过程包括:
所述网络地址转换转发装置根据对上行数据报文的 NAT规则中的 NAT IP匹配对应的网络连接的连接信息;
根据对应的连接信息中的 TCI匹配对应的业务传输通道信息将五元组信 息及对应业务传输通道信息记录到对应的上行转发规则中。
所述下行转发规则是所述网络地址转换转发装置根据所述下行数据报文 的 NAT规则生成的。
为了在转换转发过程中一并实现对 MAC信息的处理, 所述网络地址转 换转发装置对所述上、 下数据报文进行 NAT后, 转发前, 根据路由信息找到 对应下一路由节点的 IP , 以及通过地址解析协议( ARP ) 学习到下一跳路由 节点的 IP地址对应的 MAC地址, 将目的 MAC地址转换为下一跳路由节点 对应的 MAC地址后再转发, 同时记录所述 IP地址与 MAC地址的对应关系; 生成所述上、下行转发规则时,根据所述 IP地址关联匹配对应的 MAC地址, 并记录到对应的上、 下行转发规则中; 根据上、 下行转发规则对所述上、 下 行数据报文进行处理的过程还包括修改上、 下行数据报文中的 MAC地址。 为了在转换转发过程中一并实现对 TCI的处理, 所述网络地址转换转发 装置生成所述上行转发规则时, 根据 NAT转换后的 IP地址匹配对应的 TCI, 并记录到对应的上行转发规则中; 所述网络地址转换转发装置生成所述下行 转发规则时, 根据目的 IP地址匹配对应的 TCI , 并记录到对应的上行转发规 则中; 根据所述转发规则对数据报文进行处理的过程包括修改所述数据报文 中的 TCI。
修改所述数据报文中的 TCI指在所述上行数据报文中增加对应的 TCI或 删除所述下行数据报文中的 TCI。
为了支持 PPP拨号方式, 所述装置记录的连接信息还包括对应的 PPP信 息, 所述网络地址转换转发装置生成所述上行转发规则时, 根据 NAT转换后 的 IP地址匹配对应的 PPP信息, 并记录到对应的上行转发规则中; 所述网络 地址转换转发装置生成所述下行转发规则时, 根据目的 IP地址匹配对应的 PPP信息, 并记录到对应的下行转发规则中; 根据所述转发规则对所述数据 报文进行处理的过程包括, 在所述网络连接为 PPP连接时, 修改所述数据报 文中的 PPP信息。
本发明中,所述 TCI与业务传输通道的对应关系是根据组网要求配置的, 所述业务传输通道信息包括 GPON 中数据逻辑传输通道 ( G-PON Encapsulation Method Port , GemPort ) 信息及对应的传输聚合实体 ( Transmission Container, Tcont, 其用于 GPON上行报文带宽调度)信息, 所述 TCI包括虚拟局域网 ( Virtual Local Area Network, VLAN, 将局域网设 备从逻辑上划分成一个个网段, 实现虚拟工作组的数据交换)信息及优先级 ( Priority, 即数据报文中的 802.1p优先级)信息。
为了实现以上方法,本发明还提供了一种网络地址转换转发装置实施例。 该网络地址转换转发装置, 包括: 转发表, 其设置为保存上行转发规则或下 行转发规则,其中上行转发规则包括网络地址转换 NAT规则和业务传输通道 信息, 所述下转发规则包括 NAT规则, 所述 NAT规则包括数据报文的五元 组信息及其对应的 NAT转换后的 IP地址和端口; 接收匹配模块, 其设置为 接收上行数据报文或下行数据报文, 根据所述上行数据报文或下行数据报文 则; 以及转发处理模块, 其与所述接收匹配模块连接, 并设置为: 若所述上 行数据报文匹配到对应的上行转发规则, 则根据匹配到的对应的上行转发规 则对所述上行数据报文进行处理, 并将处理后的上行数据报文发送到对应的 业务传输通道; 若所述下行数据报文匹配到对应的下行转发规则, 则根据匹 行数据报文发送到对应的端口。
如图 1所示, 该装置包括:
转发表 110 , 用于保存转发规则, 其中上行转发规则包括 NAT规则及业 务传输通道信息, 下行转发规则包括 NAT规则;
接收匹配模块 120, 用于接收数据报文, 以及根据数据报文中的五元组 信息, 与转发表 110中的对应的上、 下行转发规则匹配;
转发处理模块 130, 与接收匹配模块 120连接, 用于在接收匹配模块 120 匹配到对应的转发规则时, 根据该转发规则对数据报文进行处理, 并将处理 后的上行数据报文发送到对应的业务传输通道, 将处理后的下行数据报文发 送到对应的端口。
优选地, 本实施例中所述装置还可以包括与接收匹配模块 120连接的普 通 NAT转发模块 140, 用于对未匹配到转发规则的数据报文进行普通网络地 址转换及转发, 并生成对应的 NAT规则, 所述 NAT规则包括数据报文的五 元组信息及其对应的 NAT转换后的 IP地址( NAT IP )及端口 ( NAT Port ) 。
优选地, 本实施例中所述装置还可以包括配置记录模块 150, 以及与配 置记录模块 150、 普通 NAT转发模块 140、 转发表 110连接的规则生成模块 160。 其中: 配置记录模块 150, 用于保存标签控制信息 (TCI )与业务传输 通道的对应关系, 以及在创建网络连接时, 记录该网络连接的连接信息, 其 中包括网络连接 IP地址及对应的 TCI; 所述规则生成模块 160, 用于根据上 行数据报文的 NAT规则中的 NAT IP匹配对应的网络连接的连接信息; 以及 根据对应的连接信息中的 TCI匹配对应的业务传输通道信息, 生成所述上行 转发规则。
优选地, 本实施例中所述上、 下行转发规则还可以包括对应的 TCI, 规 则生成模块 160还可以用于: 根据上行数据报文的 NAT规则中的 NAT IP地 址匹配对应的 TCI; 根据下行数据 4艮文的目的 IP地址匹配对应的 TCI; 以及 在生成上、 下行转发规则时, 将匹配的 TCI记录到对应的上、 下行转发规则 中。 转发处理模块 130根据转发规则对数据报文进行处理的过程包括修改数 据>¾文中的 TCI。
优选地, 本实施例中的配置记录模块 150记录的连接信息还可以包括对 应的 PPP信息,规则生成模块 160还可以用于根据上行数据报文的 NAT规则 中的 NAT IP地址匹配对应的 PPP信息; 根据下行数据报文的目的 IP地址匹 配对应的 PPP信息; 以及将匹配的 PPP信息记录到对应的上、 下行转发规则 中。 转发处理模块 130根据转发规则对数据报文进行处理的过程包括在网络 连接为 PPP连接时, 修改数据 4艮文中的 PPP信息。
TCI 与业务传输通道的对应关系是根据组网要求配置的, 业务传输通道 信息包括 GPON 中数据逻辑传输通道(GemPort )信息及对应的传输聚合实 体(Tcont ) , TCI包括虚拟局域网 ( VLAN )信息及优先级(Priority )信息。 以下结合附图对本发明的较佳实施例进行说明:
本发明转发规则的较佳实施方式中包括如下信息:
( 1 )五元组信息, 即源 IP地址信息、 源端口信息、 目的 IP地址信息、 目的端口信息及协议, 该五元组信息是各种报文的标识, 也是转发表的索引;
( 2 ) NAT IP信息, 即 NAT转换后的 IP地址信息;
( 3 ) NAT Port信息, 即 NAT转换后的端口信息;
( 4 ) 网关 MAC信息, 即报文下一跳的介质访问控制 (Media Access
Control, MAC )地址信息;
( 5 ) PPP信息, 用于记录该 Internet连接是否为 PPP连接, 并记录 PPP 连接的会话标识; ( 6 ) TCI, 即报文转换后的 TCI;
( 7 ) GemPort信息, 即报文通过的 GemPort信息, 只有上行报文, 即发 送到 GPON OLT的报文会使用该信息;
( 8 ) Tcont信息, 即报文通过的 Tcont信息, 只有上行报文会使用该信 息;
以上部分信息的来源如下:
1、 GPON终端与 Internet通信时, 需要建立一个 Internet连接, 在建立的 过程中需要 IP地址、 TCI等信息。 为了能够实现转发, 网络地址转换转发装 置在创建 Internet连接时将记录如下网络连接的连接信息:
( 1 )子网序号, 用于索引各个 Internet连接信息;
( 2 ) IP地址信息 , 用于记录 Internet连接对应的 IP地址;
( 3 ) TCI, 用于记录 Internet连接对应的 Vlan/Priority信息;
( 4 ) PPP标记, 用于记录 Internet连接是否为 PPP连接;
( 5 ) PPP会话标识, 用于记录 Internet连接为 PPP连接时的会话标识, 如果 Internet连接不是 PPP连接, 该标识为 0。
2、 GPON终端的网络地址转换转发装置预先配置保存以下信息:
TCI与 GemPort的关系, 用于记录 TCI对应的 GemPort信息。
GemPort与 Tcont的关系, 用于记录 GemPort对应的 Tcont信息。
3、 在协议栈学习到地址解析协议(Address Resolution Protocol, ARP ) 后将配置 ARP表信息, 用于记录 IP地址和 MAC地址对应的信息。 该转发表记录所有转发规则 , GPON终端将根据该转发表信息转发报文, 如果报文能够匹配转发表, 将由转发处理模块直接进行转发, 否则进入普通 的 NAT转发模式, 由协议栈按照正常规则转发。
下面结合附图对本发明的技术方法作进一步的详细说明。
如图 2所示, 生成转发表的实施例流程包括以下几个步骤: 步骤 S201 : 获取普通 NAT规则;
当报文没有找到对应的转发表时, 报文会走普通的 NAT 流程, 当普通 NAT学习到报文的转发规则时, 配置给规则生成模块, NAT规则中包括五元 组、 接口、 网关等信息;
步骤 S202: 根据规则的网关 IP地址信息匹配 ARP表信息找到对应的
MAC地址, 也就是报文下一跳的 MAC地址, 若能够找到, 进入步骤 S203 , 否则结束流程;
步骤 S203: 根据接口信息判断是上行规则还是下行规则, 因为上行报文 和下行报文的处理方式是不一致的, 若是上行规则, 进入步骤 S204, 否则进 入步骤 S208;
步骤 S204: 上行规则根据 NAT IP信息匹配 Internet连接信息, 若匹配到 进入步骤 S205, 否则结束流程;
步骤 S205: 获取该 Internet连接的 TCI和 PPP信息,在报文 NAT转换时 需要 TCI和 PPP相关信息, 若匹配到进入步骤 S206, 否则结束流程;
步骤 S206: 根据 TCI 匹配对应的 GemPort, 也就是上行报文发送到的
GemPort信息, 若匹配到进入步骤 S207, 否则结束流程;
步骤 S207: 根据 GemPort找到对应的 Tcont, 也就是上行报文发送到的 Tcont信息, 若匹配到进入步骤 S210, 否则结束流程;
步骤 S208: 下行规则根据目的 IP地址信息匹配 Internet连接信息, 若匹 配到进入步骤 S209, 否则结束流程;
步骤 S209: 获取该 Internet连接的 TCI和 PPP信息,在报文 NAT转换时 需要 TCI和 PPP相关信息, 若匹配到进入步骤 S210, 否则结束流程;
步骤 S210: 以五元组为索引, 匹配该规则在转发表中是否存在, 如果不 存在,添加新的转发规则,否则修改原来的转发规则,记录五元组对应的 NAT IP、 NAT Port、 网关 MAC、 TCI、 PPP, Gemport和 Tcont信息, 完成规则修 改后结束转发表的生成流程。
如图 3所示, 描述了数据报文处理实施例中的相关流程: 步骤 S301 : 接收到数据报文后, 根据报文中的五元组信息匹配转发表, 若匹配到对应的信息, 进入步骤 S302, 否则进入普通 NAT流程, 根据路由 等信息找到对应下一跳的网关 IP, 通过 NAT得到转换后的 NAT IP地址和 NAT Port信息 , 并通过 ARP协议学习到网关 IP对应的 MAC地址 , 进行报 文的五元组转换, 及 MAC地址转换, 发送转换后的 文, 并生成相应的转 发规则;
步骤 S302: 判断报文是上行报文还是下行报文, 若是上行报文进入步骤 S303 , 否则进入步骤 S309;
步骤 S303: 上行 ^艮文, 修改 ^艮文中的源 MAC为 GPON终端的 MAC, 目的 MAC为下一跳网关的 MAC;
步骤 S304: 修改 ^艮文的源 IP为 NAT IP地址, 源端口为 NAT Port信息; 步骤 S305: 修改报文中的 TCI, 在报文中加上相应的 Vlan和 Priority信 息;
步骤 S306: 判断 Internet连接是否为 PPP连接, 若是进入步骤 S307, 否 则进入步骤 S308;
步骤 S307: 当 Internet连接为 PPP连接时, 需要在报文中加入会话标识 等 PPP头信息;
步骤 S308 : 将修改后的报文, 重新计算校验和之后, 发送到对应的 Gemport和 Tcont信息中, 从而完成上行报文的转发, 结束。
步骤 S309: 下行 ^艮文, 修改 ^艮文中的源 MAC为 GPON终端的 MAC, 目的 MAC为下一跳的 MAC;
步骤 S310:修改 ^艮文的目的 IP地址为 NAT IP地址,目的端口为 NAT Port 信息;
步骤 S311: 修改报文中的 TCI , 在报文中删除相应的 Vlan和 Priority信 息;
步骤 S312: 判断 Internet连接是否为 PPP连接, 若是进入步骤 S313 , 否 则进入步骤 S314;
步骤 S313: 当 Internet连接为 PPP连接时, 需要在报文中去除 PPP头信 息;
步骤 S314: 将修改后的报文, 重新计算校验和之后, 根据目的 MAC地 址转发到对应的 Lan侧端口, 从而完成下行报文的转发, 结束。 本发明方法和装置不仅可以实现网络地址的转发, 而且通过相关信息的 处理, 同时完成了 TCI的处理和 GemPort、 Tcont信息的匹配, 从而进一步提 高了转发的效率, 并且适用于 PPP拨号的网络环境。
本领域普通技术人员可以理解上述方法中的全部或部分步骤可通过程序 来指令相关硬件完成, 所述程序可以存储于计算机可读存储介质中, 如只读 存储器、 磁盘或光盘等。 可选地, 上述实施例的全部或部分步骤也可以使用 一个或多个集成电路来实现。 相应地, 上述实施例中的各模块可以釆用硬件 的形式实现, 也可以釆用软件功能模块的形式实现。 本发明不限制于任何特 定形式的硬件和软件的结合。
工业实用性 本发明的网络地址转换转发方法及装置, 生成数据 "^文的上、 下行转发 规则, 根据数据报文的五元组信息匹配已建立的上、 下行转发规则对上、 下 行数据报文进行处理, 并将上行数据报文发送到对应的业务传输通道, 提高 数据报文的转换转发效率。

Claims

权 利 要 求 书
1、 一种网络地址转换转发方法, 包括:
网络地址转换转发装置接收上行数据报文或下行数据报文, 根据所述上 行数据报文或下行数据报文中的五元组信息匹配所述网络地址转换转发装置 上保存的上行转发规则或下行转发规则, 其中, 所述上行转发规则包括网络 地址转换 NAT规则和业务传输通道信息,所述下行转发规则包括 NAT规则, 所述 NAT规则包括数据报文的五元组信息及其对应的 NAT转换后的 IP地址 和端口;
若所述上行数据报文匹配到对应的上行转发规则, 则所述网络地址转换 并将处理后的上行数据报文发送到对应的业务传输通道;
若所述下行数据报文匹配到对应的下行转发规则, 则所述网络地址转换 并将处理后的下行数据报文发送到对应的端口。
2、 如权利要求 1所述的方法, 还包括: 若所述上行数据报文未匹配到对 应的上行转发规则或所述下行数据报文未匹配到对应的下行转发规则, 则所 述网络地址转换转发装置对所述上行数据报文或所述下行数据报文进行普通 NAT及转发, 并生成对应的上行转发规则或下行转发规则。
3、 如权利要求 2所述的方法, 还包括: 所述网络地址转换转发装置配置 保存标签控制信息 TCI与业务传输通道信息的对应关系; 记录网络连接的连 接信息,其中所述连接信息包括网络连接 IP地址及对应的 TCI且所述网络连 接 IP地址即所述 NAT转换后的 IP地址;
其中所述生成对应的上行转发规则的步骤包括:
所述网络地址转换转发装置根据所述上行数据报文对应的 NAT规则中 的所述 NAT转换后的 IP地址匹配对应的网络连接的连接信息;
根据对应的连接信息中的 TCI匹配对应的业务传输通道信息, 将所述上 行数据报文中的五元组信息及对应的业务传输通道信息记录到对应的上行转 发规则中。
4、 如权利要求 2或 3所述的方法, 其中,
在所述网络地址转换转发装置对所述上行数据报文或所述下数据报文进 行普通 NAT之后及在所述转发之前, 还包括:
根据路由信息找到对应下一跳路由节点的 IP地址, 并通过地址解析协议 ARP学习到所述下一跳路由节点的 IP地址对应的 MAC地址, 将目的 MAC 地址转换为所述下一跳路由节点的 IP地址对应的 MAC地址, 并记录所述 IP 地址与其对应的 MAC地址的对应关系;
行转发规则或下行转发规则中;
所述网络地址转换转发装置根据匹配到的对应的上行转发规则对所述上 行数据报文进行处理的步骤还包括: 修改所述上行数据报文中的 MAC地址; 所述网络地址转换转发装置根据匹配到的对应的下行转发规则对所述下行数 据报文进行处理的步骤还包括: 修改所述下行数据报文中的 MAC地址。
5、 如权利要求 2或 3所述的方法, 其中:
所述生成对应的上行转发规则的步骤还包括:根据所述 NAT转换后的 IP 地址匹配对应的 TCI , 并将所述 TCI记录到对应的上行转发规则中; 所述生 成对应的下行转发规则的步骤还包括: 根据所述下行数据报文的目的 IP地址 匹配对应的 TCI, 并将所述 TCI记录到对应的下行转发规则中;
所述网络地址转换转发装置根据匹配到的对应的上行转发规则对所述上 行数据报文进行处理的步骤还包括: 修改所述上行数据报文中的 TCI; 所述 网络地址转换转发装置根据匹配到的对应的下行转发规则对所述下行数据报 文进行处理的步骤还包括: 修改所述下行数据报文中的 TCI。
6、 如权利要求 5所述的方法, 其中:
所述修改所述上行数据报文中的 TCI是, 在所述上行数据报文中增加对 应的 TCI;
所述修改所述下行数据报文中的 TCI是, 删除所述下行数据报文中的
TCI。
7、 如权利要求 3所述的方法, 其中: 所述网络地址转换转发装置记录的 所述网络连接的连接信息中还包括 PPP信息, 则,
所述生成对应的上行转发规则的步骤包括: 根据所述 NAT转换后的 IP 地址匹配对应的 PPP信息,并将所述 PPP信息记录到对应的上行转发规则中; 所述生成对应的下行转发规则的步骤还包括: 根据所述下行数据报文的目的 IP地址匹配对应的 PPP信息 ,并将所述 PPP信息记录到对应下行转发规则中; 所述网络地址转换转发装置根据匹配到的对应的上行转发规则对所述上 行数据报文进行处理的步骤还包括: 修改所述上行数据报文中的 PPP信息; 所述网络地址转换转发装置根据匹配到的对应的下行转发规则对所述下行数 据报文进行处理的步骤还包括: 修改所述下行数据报文中的 PPP信息。
8、 如权利要求 7所述的方法, 其中:
所述修改所述上行数据报文中的 PPP信息是, 在所述上行数据报文中加 入 PPP头信息;
所述修改所述下行数据报文中的 PPP信息是, 在所述下行数据报文中去 除 PPP头信息。
9、 如权利要求 3所述的方法, 其中: 所述业务传输通道信息包括 GPON 中的数据逻辑传输通道信息及对应的传输聚合实体信息, 所述 TCI包括虚拟 局域网信息及优先级信息。
10、 一种网络地址转换转发装置, 包括:
转发表, 其设置为保存上行转发规则或下行转发规则, 其中上行转发规 则包括网络地址转换 NAT规则和业务传输通道信息, 所述下转发规则包括 NAT规则, 所述 NAT规则包括数据报文的五元组信息及其对应的 NAT转换 后的 IP地址和端口;
接收匹配模块, 其设置为接收上行数据报文或下行数据报文, 根据所述 上行数据报文或下行数据报文中的五元组信息匹配所述转发表中保存的对应 的上行转发规则或下行转发规则; 以及
转发处理模块, 其与所述接收匹配模块连接, 并设置为: 若所述上行数 据报文匹配到对应的上行转发规则, 则根据匹配到的对应的上行转发规则对 所述上行数据报文进行处理, 并将处理后的上行数据报文发送到对应的业务 传输通道; 若所述下行数据报文匹配到对应的下行转发规则, 则根据匹配到 据"¾文发送到对应的端口。
11、如权利要求 10所述的装置, 还包括与所述接收匹配模块连接的普通
NAT转发模块, 其中所述普通 NAT转发模块设置为若所述上行数据报文未 匹配到对应的上行转发规则或所述下行数据报文未匹配到对应的下行转发规 成对应的上行转发规则或下行转发规则。
12、 如权利要求 11所述的装置, 还包括配置记录模块, 以及与所述配置 记录模块、 普通 NAT转发模块、 转发表连接的规则生成模块, 其中,
所述配置记录模块设置为保存标签控制信息 TCI与业务传输通道信息的 对应关系, 记录网络连接的连接信息, 其中所述连接信息包括网络连接 IP地 址及对应的 TCI且所述网络连接 IP地址即所述 NAT转换后的 IP地址; 以及 所述规则生成模块设置为:根据所述上行数据报文对应的 NAT规则中的 所述 NAT转换后的 IP地址匹配对应的网络连接的连接信息; 根据对应的连 接信息中的 TCI匹配对应的业务传输通道信息, 生成包括所述上行数据报文 中的五元组信息及对应的业务传输通道信息的所述上行转发规则。
13、 如权利要求 11或 12所述的装置, 其中,
所述规则生成模块还设置为: 根据所述 NAT转换后的 IP地址匹配对应 的 TCI, 并将所述 TCI记录到对应的上行转发规则中; 根据所述下行数据报 文的目的 IP地址匹配对应的 TCI, 并将所述 TCI记录到对应的下行转发规则 中; 以及
所述转发处理模块还设置为: 根据匹配到的对应的上行转发规则对所述 上行数据报文进行处理的过程包括修改所述上行数据报文中的 TCI; 根据匹 述下行数据报文中的 TCI。
14、 如权利要求 11或 12所述的装置, 其中, 所述规则生成模块还设置为: 根据所述 NAT转换后的 IP地址匹配对应 的 PPP信息, 并将所述 PPP信息记录到对应的上行转发规则中; 根据所述下 行数据 文的目的 IP地址匹配对应的 PPP信息,并将所述 PPP信息记录到对 应下行转发规则中; 以及
所述转发处理模块还设置为: 根据匹配到的对应的上行转发规则对所述 上行数据报文进行处理的过程包括修改所述上行数据报文中的 PPP信息; 根 改所述下行数据报文中的 PPP信息。
PCT/CN2010/077877 2010-06-25 2010-10-19 网络地址转换转发方法及装置 WO2011160367A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201010220510.1 2010-06-25
CN201010220510.1A CN101877728B (zh) 2010-06-25 2010-06-25 网络地址转换转发方法及装置

Publications (1)

Publication Number Publication Date
WO2011160367A1 true WO2011160367A1 (zh) 2011-12-29

Family

ID=43020190

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2010/077877 WO2011160367A1 (zh) 2010-06-25 2010-10-19 网络地址转换转发方法及装置

Country Status (2)

Country Link
CN (1) CN101877728B (zh)
WO (1) WO2011160367A1 (zh)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10644902B1 (en) * 2016-02-25 2020-05-05 Juniper Networks, Inc Method, system, and apparatus for classifying uplink and downlink traffic in networks
CN114785698A (zh) * 2022-05-11 2022-07-22 武汉光迅科技股份有限公司 一种roadm系统中拓扑发现及连接性验证的方法和设备

Families Citing this family (21)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102571613B (zh) * 2012-03-09 2015-04-29 华为技术有限公司 一种转发报文的方法及网络设备
CN103516692A (zh) * 2012-06-28 2014-01-15 中兴通讯股份有限公司 一种实现DS-Lite数据报文加速处理的方法和系统
CN103475559B (zh) * 2013-09-18 2017-01-11 北京锐安科技有限公司 一种根据报文内容对报文进行处理并转发的方法和系统
CN103533103A (zh) * 2013-10-31 2014-01-22 成都西加云杉科技有限公司 基于网络地址转换的通信方法和装置
CN104125311B (zh) * 2014-06-18 2018-02-02 安一恒通(北京)科技有限公司 基于wfp框架的数据传输方法及装置
US10042849B2 (en) * 2014-09-22 2018-08-07 Oracle Financial Services Software Limited Simplifying invocation of import procedures to transfer data from data sources to data targets
CN106330715A (zh) * 2015-06-30 2017-01-11 杭州华三通信技术有限公司 报文处理方法及装置
CN105162901B (zh) * 2015-09-30 2019-05-14 北京特立信电子技术股份有限公司 一种基于sopc的nat的实现方法及装置
CN105939269A (zh) * 2015-12-18 2016-09-14 杭州迪普科技有限公司 基于网络地址转换规则的报文转换方法及装置
CN109672576B (zh) * 2017-10-13 2023-06-09 中兴通讯股份有限公司 一种抽样检测客户终端设备的方法及设备
CN108156034B (zh) * 2017-12-22 2021-10-01 武汉噢易云计算股份有限公司 一种基于深度神经网络辅助的报文转发方法和报文转发系统
CN108882063B (zh) * 2018-05-30 2021-01-15 烽火通信科技股份有限公司 一种无源光网络非对称系统业务映射方法
CN110120895B (zh) * 2019-04-11 2023-01-17 北京字节跳动网络技术有限公司 测试移动终端通讯的方法、装置、介质及电子设备
CN110602149A (zh) * 2019-10-11 2019-12-20 北京字节跳动网络技术有限公司 一种外网访问方法、系统、分流服务器和内网设备
CN111314497B (zh) * 2020-01-20 2022-03-11 广州芯德通信科技股份有限公司 一种同时支持多种nat类型生效方法及系统
CN111988445B (zh) * 2020-08-19 2022-12-20 北京天融信网络安全技术有限公司 一种报文转发方法、装置、存储介质和电子设备
CN114697388B (zh) * 2020-12-11 2024-01-30 成都鼎桥通信技术有限公司 数据传输方法及装置
CN112566185B (zh) * 2020-12-18 2023-11-21 京信网络系统股份有限公司 基站业务数据分流方法、装置、存储介质和基站
CN113132242B (zh) * 2021-03-19 2022-11-15 翱捷科技股份有限公司 一种网络设备及其共享发送和接收缓存的方法
CN114978807A (zh) * 2022-05-12 2022-08-30 北京天融信网络安全技术有限公司 一种通信方法及电子设备
CN116800672B (zh) * 2023-08-24 2024-01-12 北京城建智控科技股份有限公司 加速报文转发的方法、装置、电子设备及存储介质

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6650641B1 (en) * 1999-07-02 2003-11-18 Cisco Technology, Inc. Network address translation using a forwarding agent
CN101068212A (zh) * 2007-06-11 2007-11-07 中兴通讯股份有限公司 一种网络地址转换转发的装置及方法
CN101605105A (zh) * 2009-07-14 2009-12-16 中兴通讯股份有限公司 一种对分片报文进行网络地址转换的方法及设备

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1232080C (zh) * 2002-05-15 2005-12-14 华为技术有限公司 网络中节省ip地址提供内部服务器的方法
US7941512B2 (en) * 2004-12-13 2011-05-10 Cisco Technology, Inc. Use of IPv6 in access networks

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6650641B1 (en) * 1999-07-02 2003-11-18 Cisco Technology, Inc. Network address translation using a forwarding agent
CN101068212A (zh) * 2007-06-11 2007-11-07 中兴通讯股份有限公司 一种网络地址转换转发的装置及方法
CN101605105A (zh) * 2009-07-14 2009-12-16 中兴通讯股份有限公司 一种对分片报文进行网络地址转换的方法及设备

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10644902B1 (en) * 2016-02-25 2020-05-05 Juniper Networks, Inc Method, system, and apparatus for classifying uplink and downlink traffic in networks
CN114785698A (zh) * 2022-05-11 2022-07-22 武汉光迅科技股份有限公司 一种roadm系统中拓扑发现及连接性验证的方法和设备
CN114785698B (zh) * 2022-05-11 2023-06-27 武汉光迅科技股份有限公司 一种roadm系统中拓扑发现及连接性验证的方法和设备

Also Published As

Publication number Publication date
CN101877728A (zh) 2010-11-03
CN101877728B (zh) 2014-12-31

Similar Documents

Publication Publication Date Title
WO2011160367A1 (zh) 网络地址转换转发方法及装置
JP5368459B2 (ja) ユーザ装置における三重動作サービスのサポート
US9705706B2 (en) Multiple prefix connections with translated virtual local area network
WO2005069551A1 (ja) ユーザmacフレーム転送方法、エッジ転送装置、およびプログラム
WO2010020107A1 (zh) 号码自动路由方法、更新方法、撤销方法、路由器及设备
WO2011140843A1 (zh) 一种报文转发的方法、装置及系统
WO2010057386A1 (zh) 数据包转发方法、系统及设备
TW201223206A (en) Multipath Transmission Control Protocol proxy
WO2009021458A1 (fr) Procédé, appareil et système de connexion d'un réseau de couche 2 à un réseau de couche 3
JP4705167B2 (ja) ネットワークアドレス変換またはファイアウォール設備を越える方法及びシステム
WO2012155867A1 (zh) 一种报文发送方法及接入控制器
JP2006050626A (ja) ネットワークアドレス変換方法および装置
WO2007141840A1 (ja) 中継ネットワークシステム及び端末アダプタ装置
JP5506932B2 (ja) 新たなネットワークとインターネットとの相互通信の実現方法、システム及び通信端
JP4422175B2 (ja) パケット転送装置
WO2012106935A1 (zh) 数据通信网络配置方法、网关网元及数据通信系统
WO2012083657A1 (zh) 报文处理方法、系统和用户前端设备
WO2011157126A2 (zh) 一种报文转发方法和网间路由装置
KR100896438B1 (ko) IPv6를 IPv4네트워크망으로 터널링하기 위한 시스템및 IPv6패킷 변환방법
WO2012109864A1 (zh) 报文转发方法和装置
WO2007093095A1 (fr) Procédé pour mettre en oeuvre l'acheminement de messages mpls et équipement correspondant
RU2461131C2 (ru) Сервер, система передачи и реализуемый ими способ переноса инкапсуляции по gre-туннелю
WO2014205660A1 (zh) 一种转发数据包的方法、装置和路由设备
JPWO2005079022A1 (ja) パケット通信ネットワーク、経路制御サーバ、経路制御方法、パケット転送装置、アドミッション制御サーバ、光波長パス設定方法、プログラム、および記録媒体
WO2012075768A1 (zh) 身份位置分离网络的监听方法和系统

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 10853506

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 10853506

Country of ref document: EP

Kind code of ref document: A1