WO2013071765A1 - 为用户终端分配ip地址的方法、装置和系统 - Google Patents

为用户终端分配ip地址的方法、装置和系统 Download PDF

Info

Publication number
WO2013071765A1
WO2013071765A1 PCT/CN2012/078280 CN2012078280W WO2013071765A1 WO 2013071765 A1 WO2013071765 A1 WO 2013071765A1 CN 2012078280 W CN2012078280 W CN 2012078280W WO 2013071765 A1 WO2013071765 A1 WO 2013071765A1
Authority
WO
WIPO (PCT)
Prior art keywords
address
dhcp
user terminal
message
physical interface
Prior art date
Application number
PCT/CN2012/078280
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 WO2013071765A1 publication Critical patent/WO2013071765A1/zh

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L61/00Network arrangements, protocols or services for addressing or naming
    • H04L61/50Address allocation
    • H04L61/5007Internet protocol [IP] addresses
    • H04L61/5014Internet protocol [IP] addresses using dynamic host configuration protocol [DHCP] or bootstrap protocol [BOOTP]

Definitions

  • the embodiments of the present invention relate to the field of communications technologies, and in particular, to a method, an apparatus, and a system for allocating an IP address to a user terminal.
  • DHCP Dynamic Host Configuration Protocol
  • TCP/IP Transmission Control Protocol/Internet Protocol
  • an IP address can be assigned to a user terminal that is a DHCP client (Client) by a DHCP server (Server) to avoid IP address conflicts between different user terminals and improve the efficiency of IP address allocation.
  • a DHCP relay device is required to transmit a DHCP message for requesting or assigning an IP address between the user terminal and the DHCP server.
  • a method for assigning an IP address to a user terminal based on a DHCP relay device usually
  • the DHCP relay device receives the DHCP packet from the user terminal for applying for the IP address, and adds the physical interface IP address of the DHCP relay device to the DHCP message (also referred to as the gateway interface IP address, Gateway IP Address, GIADDR ) and sent to the DHCP server; the physical interface IP address is the IP address of the physical interface that the DHCP relay device communicates with the user terminal.
  • the DHCP server allocates an IP address to the user terminal from the address pool corresponding to the IP address of the physical interface, and returns the DHCP packet for assigning the IP address with the physical interface IP address as the destination address to use the DHCP relay device to set the IP address. Send to the corresponding user terminal.
  • the DHCP server and the DHCP relay device are configured. Between, only corresponds to back The routing of the IP address of the ring interface is reachable. The route between the DHCP server and the DHCP relay device corresponding to the IP address of the other interface is unreachable. In this case, the DHCP relay The DHCP message cannot be transmitted between the device and the DHCP server based on the above-mentioned prior art. Therefore, the DHCP protocol cannot be used to assign an IP address to the user terminal.
  • the present invention provides a method, apparatus and system for allocating an IP address to a user terminal for improving the versatility of the prior art for assigning an IP address to a user terminal based on a DHCP protocol.
  • the present invention provides a method for allocating an IP address to a user terminal, including: receiving a first DHCP message from a user terminal for requesting an IP address;
  • the second DHCP message carries an IP address of the first physical interface and at least one path IP address, where the DHCP relay device passes the The first physical interface is connected to the user terminal, and a route corresponding to the path IP address between the DHCP relay device and the DHCP server is reachable;
  • the destination IP address of the DHCP response message is the path An IP address assigned by the DHCP server to the user terminal, and an address pool corresponding to an IP address of the first physical interface;
  • the present invention provides another method for allocating an IP address to a user terminal, including: receiving a second DHCP message sent by a DHCP relay device for requesting an IP address; and the second DHCP message carrying An IP address of the first physical interface of the DHCP relay device, and at least one path IP address;
  • the present invention also provides a DHCP relay device, including:
  • a first packet obtaining module configured to receive a first DHCP message from the user terminal for requesting an IP address
  • a second packet generating module configured to generate a second DHCP packet according to the first DHCP packet, where the second DHCP packet carries an IP address of the first physical interface and at least one path IP address, where:
  • the DHCP relay device is connected to the user terminal by using the first physical interface, and a route corresponding to the path IP address between the DHCP relay device and the DHCP server is reachable;
  • a second packet sending module configured to send the second DHCP packet to the DHCP server according to the reachable route corresponding to the path IP address;
  • a response message receiving module configured to receive a DHCP response message returned by the DHCP server, where the DHCP response message carries an IP address assigned by the DHCP server to the user terminal, where: the DHCP response message is The destination IP address is the path IP address; the IP address assigned by the DHCP server to the user terminal is from an address pool corresponding to the IP address of the first physical interface;
  • an IP address sending module configured to send, to the user terminal, an IP address that is allocated by the DHCP server to the user terminal.
  • the present invention also provides a DHCP server, including:
  • a request message receiving module configured to receive a second DHCP message sent by the DHCP relay device for requesting an IP address, where the second DHCP message carries an IP address of the first physical interface of the DHCP relay device, And at least one path IP address;
  • An IP address allocation module configured to allocate an IP address to the user terminal in the corresponding address pool according to the IP address of the first physical interface
  • the response message generating module is configured to allocate an IP address to the user terminal in the corresponding address pool according to the IP address of the first physical interface;
  • the present invention provides a system for allocating an IP address to a user terminal, including: the DHCP relay device and the DHCP server.
  • the method, device and system for assigning an IP address to a user terminal provided by the present invention, in DHCP
  • the device After the device carries the path IP address in the DHCP message, and delivers the packet to the DHCP server through the reachable route corresponding to the path IP address, the physical interface of the DHCP relay device and the DHCP server are not available in the prior art.
  • the problem of assigning an IP address to a user terminal by using the DHCP protocol is not improved, and the versatility of assigning an IP address to a user terminal based on the DHCP protocol is improved.
  • FIG. 1 is a flowchart of a method for allocating an IP address to a user terminal according to Embodiment 1 of the present invention
  • FIG. 2 is a flowchart of a method for allocating an IP address for a user terminal according to Embodiment 2 of the present invention
  • 3 is a flowchart of a method for allocating an IP address to a user terminal
  • FIG. 3b is a schematic diagram of a scenario in which the user terminal A and the DHCP server are located on the same network plane according to an embodiment of the present invention
  • Figure 3c is a schematic diagram of a scenario in which the user terminal A and the DHCP server are located on different network planes according to an embodiment of the present invention
  • FIG. 4 is a schematic structural diagram of a DHCP relay device according to Embodiment 3 of the present invention.
  • FIG. 5 is a schematic structural diagram of a DHCP server according to Embodiment 5 of the present invention.
  • FIG. 6 is a schematic structural diagram of a system for allocating an IP address to a user terminal according to Embodiment 6 of the present invention. detailed description
  • FIG. 1 is a flowchart of a method for allocating an IP address to a user terminal according to Embodiment 1 of the present invention, where include:
  • the DHCP relay device receives the first DHCP message from the user terminal for requesting the IP address.
  • the user terminal is a DHCP client.
  • the first DHCP message may be broadcast to the sub-network to which the user terminal belongs.
  • the DHCP relay device can receive the first DHCP message through a physical interface that communicates with the user terminal.
  • the second DHCP message carries an IP address of the first physical interface and at least one path IP address
  • the DHCP relay device passes The first physical interface is connected to the user terminal, and a route corresponding to the path IP address between the DHCP relay device and the DHCP server is reachable.
  • a DHCP relay device usually has multiple physical interfaces. Each physical interface has its own IP address. The IP addresses of different physical interfaces are different.
  • the DHCP servers of different physical interfaces can be the same or different. For convenience of description, the physical interface that communicates the DHCP relay device with the user terminal is referred to as a first physical interface; the other physical interfaces of the DHCP relay device are referred to as a second physical interface;
  • the path IP address refers to: an IP address corresponding to a reachable route between the DHCP relay device and the DHCP server; if the path IP address is used on the DHCP relay device, PING Through the DHCP server.
  • the path IP address may be configured in the attribute information of each physical interface of the DHCP relay device.
  • the path IP address may be any one or more of the following addresses: an IP address of the DHCP relay device loopback interface, an IP address of the first physical interface, and an IP address of the second physical interface; wherein the loopback interface is DHCP A virtual logical interface with an IP address assigned to the relay device. The route between the DHCP relay device and the DHCP server corresponding to the IP address of the loopback interface is reachable.
  • the DHCP relay device After receiving the first DHCP message, the DHCP relay device adds an IP address of the first physical interface and at least one path IP address to the first DHCP message, so as to generate a second DHCP message.
  • the DHCP relay device sends a DHCP message via a reachable route corresponding to the path IP address, thereby improving the DHCP server receiving the report from the DHCP relay device. The probability of the text.
  • the DHCP response message carrying an IP address assigned by the DHCP server to the user terminal, where: a destination IP address of the DHCP response message The address is the path IP address; the IP address assigned by the DHCP server to the user terminal is from an address pool corresponding to the IP address of the first physical interface.
  • the DHCP relay device may send the IP address to the user terminal by using a broadcast method.
  • the DHCP relay device In the method for allocating an IP address to a user terminal, the DHCP relay device carries the path IP address in the DHCP message, and delivers the message to the DHCP server through the reachable route corresponding to the path IP address.
  • the problem that the physical interface of the DHCP relay device and the DHCP server are unreachable in the prior art, and the DHCP protocol cannot be used to assign an IP address to the user terminal is improved, and the versatility of assigning an IP address to the user terminal based on the DHCP protocol is improved.
  • FIG. 2 is a flowchart of a method for allocating an IP address for a user terminal according to Embodiment 2 of the present invention, including:
  • the DHCP server allocates an IP address to the user terminal according to the address pool corresponding to the IP address of the first physical interface, which is beneficial to ensure the IP address assigned to the user terminal and the IP address of the first physical interface. Belong to the same network segment.
  • the DHCP response message carries an IP address assigned to the user terminal, and the destination IP address of the DHCP response message is the path IP address.
  • the DHCP server can send a broadcast to the DHCP relay device.
  • the DHCP server receives the second DHCP message sent by the DHCP relay device, and assigns an IP address to the user terminal according to the IP address of the first physical interface, and according to the path.
  • the IP address is returned to the DHCP response.
  • FIG. 3 is a flowchart of a method for allocating an IP address to a user terminal according to Embodiment 3 of the present invention, including:
  • User terminal A which is a DHCP client, broadcasts the first DHCP message for requesting an IP address in the subnet to which it belongs.
  • the DHCP relay device that covers the user terminal A receives the first DHCP request packet, and determines whether the route corresponding to the IP address of the first physical interface is reachable between the DHCP relay device and the DHCP server corresponding to the first physical interface. If the route is reachable, execute 33, otherwise, execute 34.
  • the first physical interface of the DHCP relay device is a physical interface between the DHCP relay device and the user terminal A.
  • the DHCP relay device determines whether the route based on the IP address of the first physical interface is reachable between the DHCP relay device and the DHCP server according to the pre-acquired information.
  • the pre-acquired information may include, but is not limited to, related information pre-configured by the network management according to the network networking condition, status information of whether the first physical interface recorded first and the corresponding DHCP server are faulty.
  • the DHCP relay device adds the IP address of the first physical interface to the "GIADDR" field of the first DHCP message to generate a second DHCP message, and sends a second DHCP message to the DHCP server for requesting the DHCP server. Assign an IP address to user terminal A; 35.
  • the path IP address in the embodiment of the present invention may be the IP address of the first physical interface.
  • the DHCP relay device adds the IP address of the first physical interface in the "GIADDR" field of the first DHCP message, and adds the path IP address in the "OPTION 125" field of the first DHCP message to obtain the second
  • the DHCP message is sent to the DHCP server according to the reachable route corresponding to the path IP address;
  • a scenario in which the DHCP relay device and the DHCP server corresponding to the first physical interface are unreachable based on the IP address of the first physical interface may include but not limited to the following scenarios: scenario 1: user terminal A and DHCP monthly
  • scenario 1 user terminal A and DHCP monthly
  • the server is located on the same network plane.
  • Figure 3b the IP address of the physical interface corresponding to the DHCP relay device is unreachable between the DHCP server and the DHCP relay device on the network.
  • the IP address corresponding to the loopback interface is not available. The route between the addresses is reachable;
  • Scenario 2 The user terminal A and the DHCP server are located on the same network plane. As shown in Figure 3b, the IP address of the second physical interface of the DHCP relay device is reachable between the DHCP server and the DHCP relay device. However, the route corresponding to the IP address of the first physical interface of the DHCP relay device is unreachable;
  • Scenario 3 The user terminal A and the DHCP server are located on different network planes. As shown in FIG. 3c, the user terminal A is located on the public network and the DHCP server is located on the private network (also referred to as a virtual private network, called a VPN). In the scenario, the IP address of the physical interface of the DHCP relay device is unreachable between the DHCP relay device and the DHCP server. However, the routes based on the IP address of the loopback interface are reachable. In Figure 3c, "C" represents user terminal A,
  • R indicates the physical interface of the DHCP relay device
  • L indicates the loopback interface of the DHCP relay device
  • the DHCP relay device can pre-configure the path IP address on the attribute configuration information of the first physical interface.
  • An optional configuration method is to use the following command line: "IP Relay ip-address ⁇ ip-address>[vpn-instance ⁇ Vpn-instance >],, .
  • "ip-address” indicates the path IP address option. This option can include one or more addresses.
  • "vpn-instance” is optional and indicates that the DHCP server is available. Information about the VPN instance where the VPN is located.
  • the information of the command line "ip-address" can be the IP address of the loopback interface of the DHCP relay device; in the scenario 2, the command line is "ip-address”.
  • the information of the option may be the IP address of the second physical interface of the DHCP relay device; in the scenario 2, if there is a routing path based on other types of IP addresses between the DHCP server and the DHCP relay device, the command line.
  • the information of the ip-address option may also include the IP address corresponding to the routing path, such as the IP address of the loopback interface of the DHCP relay device.
  • the information of the command line "ip-address" may be IP address of the loopback interface of the DHCP relay device.
  • the DHCP relay device sends a second DHCP packet to the DHCP server according to the reachable route of the public network.
  • the DHCP relay device needs to be in accordance with the above command line.
  • the information of the instance option determines the private network reachable route and sends the second DHCP packet to the DHCP server according to the private network reachable route.
  • the reachable route corresponds.
  • the IP address can be used as the path IP address of the DHCP relay device.
  • the DHCP server receives the second DHCP packet, and obtains the IP address of the first physical interface carried in the GIADDR field of the second DHCP packet, and the user terminal is in the corresponding address pool according to the IP address of the first physical interface. Assign an IP address.
  • the DHCP server determines whether the "OPTION 125" field of the second DHCP message carries the path IP address, and if so, executes 37, otherwise, performs 38.
  • the DHCP server generates a DHCP response message, and broadcasts the DHCP response message to the downstream network device.
  • the DHCP response message is in the "OPTION 125" field of the second DHCP message, and the path IP address carried in the field is the destination address, and The IP address assigned by the DHCP server to the user terminal is included;
  • the DHCP server can generate multiple DHCP response messages with the same number of path IP addresses, each DHCP.
  • the response message uses one of the path IP addresses as the destination address.
  • the DHCP server generates a DHCP response message and broadcasts the message to the downstream network device.
  • a DHCP response message uses the IP address of the first physical interface carried in the "GIADDR" field of the second DHCP message as the destination address, and includes the IP address assigned by the DHCP server to the user terminal; .
  • the DHCP relay device receives the DHCP response packet sent by the DHCP server, and broadcasts the DHCP response packet within the subnet corresponding to the first physical interface.
  • the user terminal receives the DHCP response message, and obtains an IP address assigned by the DHCP server carried in the DHCP response message.
  • the present embodiment provides a method for providing the common field of the existing DHCP message, such as the "OPTION 125" field, carrying the common IP address, and the method provided in this embodiment.
  • the changes to the existing network communication process are small, and have the advantages of low cost and easy implementation.
  • the technical solution of the embodiment may be modified, such as using a field other than the "OPTION 125" field to carry a general IP address, and the method for realizing the IP address allocation to the user terminal is similar to this embodiment. Let me repeat.
  • FIG. 4 is a schematic structural diagram of a DHCP relay device according to Embodiment 3 of the present invention.
  • the DHCP relay device shown in FIG. 4 includes: a first packet obtaining module 41, a second packet generating module 42, a second packet sending module 43, a response packet receiving module 44, and an IP address sending module 45.
  • the first message obtaining module 41 is configured to receive a first DHCP message from the user terminal for requesting an IP address.
  • the second packet generating module 42 is configured to generate a second DHCP packet according to the first DHCP packet, where the second DHCP packet carries an IP address of the first physical interface and at least one path IP address, where:
  • the DHCP relay device is connected to the user terminal by using the first physical interface, and a route corresponding to the path IP address between the DHCP relay device and the DHCP server is reachable.
  • the second packet sending module 43 is configured to send the second DHCP packet to the DHCP server according to the reachable route corresponding to the path IP address.
  • the response message receiving module 44 is configured to receive a DHCP response message returned by the DHCP server, where the DHCP response message carries an IP address assigned by the DHCP server to the user terminal, where: the DHCP response message is The destination IP address is the path IP address; the IP address assigned by the DHCP server to the user terminal is from an address pool corresponding to the IP address of the first physical interface.
  • the IP address sending module 45 is configured to send, to the user terminal, an IP address that the DHCP server allocates for the user terminal.
  • the second request packet generating module 42 is specifically configured to add an IP address of the first physical interface, and the first DHCP in a “GIADDR” field of the first DHCP packet. At least one of the path IP addresses is added to the "OPTION 125" field of the message to generate the second DHCP message.
  • the path IP address may be any one or more of the following addresses: an IP address of a loopback interface of the DHCP relay device; an IP address of the first physical interface, and a second physics of the DHCP relay device An IP address of the interface, where the second physical interface is a physical interface of the DHCP relay device except the first physical interface.
  • the DHCP relay device provided in this embodiment carries the path IP address in the DHCP message, and transmits the message to the DHCP server through the reachable route corresponding to the path IP address, thereby solving the DHCP in the prior art.
  • the physical interface of the relay device and the DHCP server are unreachable.
  • the DHCP protocol cannot be used to assign IP addresses to user terminals. This improves the versatility of assigning IP addresses to user terminals based on the DHCP protocol.
  • the working mechanism of the DHCP relay device provided in this embodiment can be referred to the corresponding records in FIG. 1 and FIG. 3a, and is not mentioned here.
  • FIG. 5 is a schematic structural diagram of a DHCP server according to Embodiment 5 of the present invention.
  • the DHCP server includes: a request message receiving module 51, an IP address assigning module 52, a response message generating module 53 and a response message sending module 54.
  • the request message receiving module 51 is configured to receive a second DHCP message sent by the DHCP relay device for requesting an IP address, where the second DHCP message carries an IP address of the first physical interface of the DHCP relay device. And at least one path IP address.
  • the IP address allocation module 52 is configured to allocate an IP address to the user terminal in the corresponding address pool according to the IP address of the first physical interface.
  • the response message generating module 53 is configured to allocate an IP address to the user terminal in the corresponding address pool according to the IP address of the first physical interface;
  • the response message sending module 54 is configured to send the DHCP response message to the DHCP relay device.
  • the request message receiving module 51 is further configured to: after receiving the second DHCP message, acquire the first physical interface in a “GIADDR” field of the second DHCP message.
  • the IP address is obtained in the "OPTION 125" field of the second DHCP message, and at least one of the path IP addresses is obtained.
  • the DHCP server receives the second DHCP message sent by the DHCP relay device, and assigns an IP address to the user terminal according to the IP address of the first physical interface in the second DHCP message, and according to the second DHCP report.
  • the path IP address in the text returns a DHCP response message, thereby solving the problem that the physical interface of the DHCP relay device and the DHCP server are unreachable in the prior art, and the DHCP protocol cannot be used to assign an IP address to the user terminal, which improves the
  • the DHCP protocol assigns the versatility of an IP address to a user terminal.
  • FIG. 6 is a schematic structural diagram of a system for allocating an IP address to a user terminal according to Embodiment 6 of the present invention.
  • the system shown in Fig. 6 includes: a DHCP relay device 61 and a DHCP server 62, and the DHCP relay device 61 communicates with the DHCP server 62.
  • the user terminal 63 communicates with the DHCP relay device 61.
  • multiple hop relays may exist between the DHCP relay device and the DHCP server according to the actual networking requirements.
  • the structure of the DHCP relay device and the technical effects that can be achieved refer to the description of the corresponding embodiment in FIG. 4, the structure of the DHCP server and the technical effects that can be achieved.
  • modules in the apparatus in the embodiments may be distributed in the apparatus of the embodiment as described in the embodiments, or may be correspondingly changed in one or more apparatuses different from the embodiment.
  • the modules of the above embodiments may be combined into one module, or may be further split into a plurality of sub-modules.
  • the aforementioned program can be stored in a computer readable storage medium.
  • the program when executed, performs the steps including the above-described method embodiments; and the foregoing storage medium includes: a medium that can store program codes, such as a ROM, a RAM, a magnetic disk, or an optical disk.

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)
  • Small-Scale Networks (AREA)

Abstract

本发明公开了一种为用户终端分配IP地址的方法、装置和系统,其中方法包括:接收来自用户终端的用于请求IP地址的第一DHCP报文;根据第一DHCP报文,生成第二DHCP报文;所述第二DHCP报文中携带第一物理接口的IP地址和至少一个通路IP地址;根据与通路IP地址对应的可达路由,向DHCP服务器发送第二DHCP报文;接收DHCP应答报文,该报文携带DHCP服务器为用户终端分配的IP地址;其中:DHCP应答报文的目的IP地址为通路IP地址;DHCP服务器为用户终端分配的IP地址,来自与第一物理接口的IP地址对应的地址池;向用户终端发送DHCP服务器为其分配的IP地址。本发明提高了基于DHCP协议为用户终端动态分配IP地址的通用性。

Description

为用户终端分配 IP地址的方法、 装置和系统 本申请要求于 2011年 11月 18 日提交中国专利局、 申请号为 201110369801.1、 发明名称为 "为用户终端分配 IP地址的方法、 装置 和系统" 的中国专利申请的优先权, 其全部内容通过引用结合在本申 请中。
技术领域
本发明实施例涉及通信技术领域, 尤其涉及一种为用户终端分配 IP 地址的方法、 装置和系统。 背景技术 动态主机配置协议( Dynamic Host Configuration Protocol ,筒称 DHCP ) 是基于传输控制协议 /因特网协议 (筒称 TCP/IP ) 的一种动态地址分配协 议。 在实际应用中, 通常可由 DHCP服务器 (Server ) 为作为 DHCP客户 端( Client )的用户终端分配 IP地址, 以避免不同用户终端之间的 IP地址 沖突, 提高 IP地址的分配效率。 如果用户终端与 DHCP服务器位于不同 物理网段,通常需要通过 DHCP中继( Relay )设备在上述用户终端和 DHCP 服务器之间传递用于请求或分配 IP地址的 DHCP报文。
现有基于 DHCP 中继设备为用户终端分配 IP 地址的方法, 通常是
DHCP中继设备接收来自用户终端的用于申请 IP地址的 DHCP报文, 在 该 DHCP报文中增加 DHCP中继设备的物理接口 IP地址 (也称为网关接 口 IP地址, Gateway IP Address, 筒称 GIADDR ) , 并发送给 DHCP服务 器; 该物理接口 IP地址为 DHCP中继设备与所述用户终端通信的物理接 口的 IP地址。 DHCP服务器从该物理接口 IP地址对应的地址池中为用户 终端分配 IP地址, 并以该物理接口 IP地址作为目的地址返回用于分配 IP 地址的 DHCP报文, 以通过 DHCP中继设备将 IP地址发送给相应用户终 端。
但是, 在实际网络部署和规划中, 为了节省路由表容量, DHCP服务 器的路由表中仅配置了 DHCP中继设备的回环接口 ( Loopback Interface ) IP路由, 因此, 在 DHCP服务器和 DHCP中继设备之间, 仅有对应于回 环接口的 IP地址的路由是可达的 (Reachable ) , DHCP服务器和 DHCP 中继设备之间对应于其他接口的 IP地址的路由是不可达的( Unreachable )„ 在这种情况下, DHCP中继设备和 DHCP服务器之间无法基于上述现有技 术传递 DHCP报文, 从而无法采用 DHCP协议为用户终端分配 IP地址。 发明内容
本发明提供一种为用户终端分配 IP地址的方法、 装置和系统, 用以提高 基于 DHCP协议为用户终端分配 IP地址的现有技术的通用性。
一方面, 本发明提供了一种为用户终端分配 IP地址的方法, 包括: 接收来自用户终端的用于请求 IP地址的第一 DHCP报文;
根据所述第一 DHCP报文, 生成第二 DHCP报文; 所述第二 DHCP报文 中携带第一物理接口的 IP地址和至少一个通路 IP地址, 其中, 所述 DHCP 中继设备通过所述第一物理接口与所述用户终端相连, 所述 DHCP中继设备 和 DHCP服务器之间对应于所述通路 IP地址的路由是可达的;
根据与所述通路 IP地址对应的可达路由,向所述 DHCP服务器发送所述 第二 DHCP报文;
接收所述 DHCP服务器返回的 DHCP应答报文,所述 DHCP应答报文携 带所述 DHCP 务器为所述用户终端分配的 IP地址; 其中: 所述 DHCP应 答报文的目的 IP地址为所述通路 IP地址; 所述 DHCP服务器为所述用户终 端分配的 IP地址, 来自与所述第一物理接口的 IP地址对应的地址池;
向所述用户终端发送所述 DHCP 务器为所述用户终端分配的 IP地址。 另一方面,本发明还提供了另一种为用户终端分配 IP地址的方法,包括: 接收 DHCP中继设备发送的用于请求 IP地址的第二 DHCP报文; 所述 第二 DHCP报文携带所述 DHCP中继设备的第一物理接口的 IP地址, 以及 至少一个通路 IP地址;
根据所述第一物理接口的 IP地址,在对应的地址池中为用户终端分配 IP 地址;
生成 DHCP应答 文, 其中, 所述 DHCP应答 4艮文携带为所述用户终端 向所述 DHCP中继设备发送所述 DHCP应答报文。 另一方面, 本发明还提供了一种 DHCP中继设备, 包括:
第一报文获取模块, 用于接收来自用户终端的用于请求 IP地址的第一 DHCP报文;
第二报文生成模块, 用于根据所述第一 DHCP报文, 生成第二 DHCP报 文; 所述第二 DHCP报文中携带第一物理接口的 IP地址和至少一个通路 IP 地址, 其中: 所述 DHCP中继设备通过所述第一物理接口与所述用户终端相 连, 所述 DHCP中继设备和 DHCP服务器之间对应于所述通路 IP地址的路 由是可达的;
第二报文发送模块, 用于根据与所述通路 IP地址对应的可达路由, 向所 述 DHCP服务器发送所述第二 DHCP报文;
应答报文接收模块,用于接收所述 DHCP服务器返回的 DHCP应答报文, 所述 DHCP应答 文携带所述 DHCP 务器为所述用户终端分配的 IP地址; 其中: 所述 DHCP应答报文的目的 IP地址为所述通路 IP地址; 所述 DHCP 服务器为所述用户终端分配的 IP地址, 来自与所述第一物理接口的 IP地址 对应的地址池;
IP地址发送模块, 用于向所述用户终端发送所述 DHCP服务器为所述用 户终端分配的 IP地址。
另一方面, 本发明还提供了一种 DHCP服务器, 包括:
请求报文接收模块,用于接收 DHCP中继设备发送的用于请求 IP地址的 第二 DHCP报文;所述第二 DHCP报文携带所述 DHCP中继设备的第一物理 接口的 IP地址, 以及至少一个通路 IP地址;
IP地址分配模块, 用于根据所述第一物理接口的 IP地址, 在对应的地址 池中为用户终端分配 IP地址;
应答报文生成模块, 用于根据所述第一物理接口的 IP地址, 在对应的地 址池中为用户终端分配 IP地址; 文。
另一方面, 本发明还提供了一种为用户终端分配 IP地址的系统, 包括: 上述 DHCP中继设备和上述 DHCP服务器。
本发明提供的为用户终端分配 IP地址的方法、 装置和系统中, DHCP中 继设备将通路 IP地址携带在 DHCP报文中, 并通过通路 IP地址对应的可达 路由向该 DHCP服务器传递报文, 由此解决了现有技术中 DHCP中继设备物 理接口与 DHCP服务器路由不可达,无法采用 DHCP协议为用户终端分配 IP 地址的问题, 提高了基于 DHCP协议为用户终端分配 IP地址的通用性。 附图说明
为了更清楚地说明本发明实施例或现有技术中的技术方案, 下面将对实 施例或现有技术描述中所需要使用的附图作筒单地介绍, 显而易见地, 下面 描述中的附图仅仅是本发明的一些实施例, 对于本领域普通技术人员来讲, 在不付出创造性劳动性的前提下, 还可以根据这些附图获得其他的附图。
图 1为本发明实施例一提供的为用户终端分配 IP地址的方法流程图; 图 2为本发明实施例二提供的为用户终端分配 IP地址的方法流程图; 图 3 a为本发明实施例三提供的为用户终端分配 I P地址的方法流程图; 图 3b为本发明实施例提供的用户终端 A和 DHCP服务器位于同一网 络平面的场景示例;
图 3c为本发明实施例提供的用户终端 A和 DHCP服务器位于不同网 络平面的场景示例;
图 4为本发明实施例三提供的 DHCP中继设备的结构示意图;
图 5为本发明实施例五提供的 DHCP服务器的结构示意图;
图 6为本发明实施例六提供的为用户终端分配 IP地址的系统的结构示 意图。 具体实施方式
为使本发明的目的、 技术方案和优点更加清楚, 下面将结合附图, 对本 发明实施例进行清楚、 完整地描述, 显然, 所描述的实施例是本发明一部分 实施例, 而不是全部的实施例。 基于本发明中的实施例, 本领域普通技术人 员在没有付出创造性劳动前提下所获得的所有其他实施例, 都属于本发明保 护的范围。
本发明以下实施例的序号仅仅为了描述, 不代表实施例的优劣。
图 1为本发明实施例一提供的为用户终端分配 IP地址的方法流程图, 包括:
11 : DHCP 中继设备接收来自用户终端的用于请求 IP 地址的第一 DHCP报文。
在本发明实施例中, 所述的用户终端就是 DHCP客户端。 在一种可选 的实现方式中, 当本发明实施例所述的用户终端接入子网络并进行 DHCP 初始化时, 可向所述用户终端自身所属的子网络广播所述第一 DHCP 报 文。 DHCP中继设备能够通过与该用户终端通信的物理接口, 接收所述第 一 DHCP报文。
12:根据所述第一 DHCP报文,生成第二 DHCP报文;所述第二 DHCP 4艮文中携带第一物理接口的 IP地址和至少一个通路 IP地址, 其中: 所述 DHCP中继设备通过所述第一物理接口与所述用户终端相连, 所述 DHCP 中继设备和 DHCP服务器之间对应所述通路 IP地址的路由是可达的。
DHCP中继设备通常包括多个物理接口; 每个物理接口都有其对应的 IP地址,不同物理接口的 IP地址是不相同的; 不同物理接口对应的 DHCP 服务器可以相同也可以不同。 为便于描述, 将 DHCP中继设备与所述用户 终端通信的物理接口, 称为第一物理接口; DHCP中继设备的其他物理接 口, 则称为第二物理接口; 下文不再赘述。
在本发明的实施例中,上述通路 IP地址是指: DHCP中继设备与 DHCP 月良务器之间可达路由对应的 IP地址; 如在 DHCP中继设备上采用上述通 路 IP地址, 可 PING通 DHCP 务器。 可选的, 上述通路 IP地址可先配 置在 DHCP中继设备的各物理接口的属性信息中。 所述通路 IP地址可以 为以下地址中的任意一个或多个: DHCP中继设备回环接口的 IP地址, 第 一物理接口的 IP地址,和第二物理接口的 IP地址;其中,回环接口是 DHCP 中继设备上设置的分配有 IP 地址的虚拟逻辑接口, DHCP 中继设备和 DHCP服务器之间对应于该回环接口的 IP地址的路由是可达的。
可选的, DHCP中继设备在接收到所述第一 DHCP报文之后, 在第一 DHCP报文中添加第一物理接口的 IP地址、 以及至少一个通路 IP地址, 从而生成第二 DHCP报文。
13: 根据与所述通路 IP地址对应的可达路由, 向 DHCP服务器发送 所述第二 DHCP报文。 在实际的网络中, 第一物理接口对应的 DHCP服务器, 和第一物理接 口之间的路由不一定是可达的, 因此, 如果 DHCP中继设备按照现有技术 直接根据第一物理接口的 IP地址对应的路由发送 DHCP报文, DHCP服 务器是无法接收到的, 从而无法为用户终端分配 IP地址。 区别于现有技 术, 在本发明的实施例中, DHCP中继设备经由与所述通路 IP地址相对应 的可达路由发送 DHCP报文, 因此提高了 DHCP服务器接收到来自 DHCP 中继设备的报文的几率。
14: 接收所述 DHCP月良务器返回的 DHCP应答 4艮文, 所述 DHCP应 答报文携带所述 DHCP服务器为所述用户终端分配的 IP地址; 其中: 所 述 DHCP应答报文的目的 IP地址为所述通路 IP地址; 所述 DHCP服务器 为所述用户终端分配的 IP地址, 来自与所述第一物理接口的 IP地址对应 的地址池。
15:向所述用户终端发送所述 DHCP 务器为所述用户终端分配的 IP 地址。
DHCP中继设备在接收到 DHCP服务器返回的 DHCP应答报文之后, 可选的, 可采用广播的方式, 向该用户终端发送所述 IP地址。
本实施例提供的为用户终端分配 IP地址的方法中, DHCP中继设备将 通路 IP地址携带在 DHCP报文中, 并通过通路 IP地址对应的可达路由与 该 DHCP服务器传递报文,由此解决了现有技术中 DHCP中继设备物理接 口与 DHCP服务器路由不可达, 无法采用 DHCP协议为用户终端分配 IP 地址的问题, 提高了基于 DHCP协议为用户终端分配 IP地址的通用性。
图 2为本发明实施例二提供的为用户终端分配 IP地址的方法流程图, 包括:
21: 接收 DHCP中继设备发送的用于请求 IP地址的第二 DHCP报文; 所述第二 DHCP报文携带所述 DHCP中继设备的第一物理接口的 IP地址, 以及至少一个通路 IP地址。
22: 根据所述第一物理接口的 IP地址, 在对应的地址池中为所述用户终 端分配 IP地址。
DHCP服务器根据第一物理接口的 IP地址对应的地址池为用户终端分配 IP地址, 有利于保证为用户终端分配的 IP地址, 与第一物理接口的 IP地址 属于同一网段。
23: 生成 DHCP应答报文, 其中, 所述 DHCP应答报文携带为用户终 端分配的 IP地址,所述 DHCP应答 文的目的 IP地址为所述通路 IP地址。
24: 向所述 DHCP中继设备发送所述 DHCP应答报文。
可选的, DHCP 服务器可采用广播的方式, 向 DHCP 中继设备发送
DHCP应答报文。
本实施例提供的为用户终端分配 IP地址的方法中, DHCP服务器接收 DHCP中继设备发送的第二 DHCP报文, 根据第一物理接口的 IP地址, 为该用户终端分配 IP地址, 并根据通路 IP地址, 返回 DHCP应答 4艮文, 由此解决了现有技术中 DHCP中继设备物理接口与 DHCP服务器路由不可 达,无法采用 DHCP协议为用户终端分配 IP地址的问题,提高了基于 DHCP 协议为用户终端分配 IP地址的通用性。
图 3 a为本发明实施例三提供的为用户终端分配 I P地址的方法流程图, 包括:
31 : 作为 DHCP客户端的用户终端 A在自身所属的子网内, 广播用 于请求 IP地址的第一 DHCP报文。
32: 覆盖用户终端 A的 DHCP中继设备接收第一 DHCP请求报文, 确定 DHCP中继设备与第一物理接口对应的 DHCP服务器之间,对应于第 一物理接口的 IP地址的路由是否可达; 如果路由是可达的, 执行 33 , 否 则, 执行 34。
DHCP中继设备的上述第一物理接口, 是该 DHCP中继设备与用户终 端 A通信的物理接口。
DHCP 中继设备可根据预先获取的信息, 确定 DHCP 中继设备与 DHCP服务器之间,基于第一物理接口的 IP地址的路由是否可达。该预先 获取的信息可包括但不限于: 网管根据网络组网情况预先配置的相关信 息、在先记录的第一物理接口与相应 DHCP服务器的路由是否发生故障的 状态信息等。
33: DHCP中继设备在第一 DHCP报文的 "GIADDR" 字段添加第一 物理接口的 IP地址, 以生成第二 DHCP报文; 并向 DHCP服务器发送第 二 DHCP报文, 用于请求 DHCP服务器为用户终端 A分配 IP地址; 执行 35。
当对应于第一物理接口的 IP地址的路由是可达的, 本发明实施例中 的通路 IP地址可以为所述第一物理接口的 IP地址。
34: DHCP中继设备在第一 DHCP报文的 "GIADDR" 字段添加第一 物理接口的 IP地址、 以及在第一 DHCP报文的 " OPTION 125" 字段添加 所述通路 IP地址, 以得到第二 DHCP报文; 根据与通路 IP地址对应的可 达路由, 向 DHCP服务器发送第二 DHCP报文; 执行 35。
DHCP中继设备与第一物理接口对应的 DHCP服务器之间, 基于第一 物理接口的 IP地址之间路由不可达的场景, 可包括但不限于以下情形: 场景一: 用户终端 A和 DHCP月良务器位于同一网络平面, 如图 3b所 示, 网络中 DHCP服务器与 DHCP中继设备之间, 对应于 DHCP中继设 备的物理接口的 IP地址的路由不可达, 但是, 对应于回环接口的 IP地址 之间的路由可达;
场景二: 用户终端 A和 DHCP服务器位于同一网络平面, 如图 3b所 示, 网络中 DHCP服务器与 DHCP中继设备之间, 对应于 DHCP中继设 备的第二物理接口的 IP地址的路由可达, 但对应于 DHCP中继设备的第 一物理接口的 IP地址的路由不可达;
场景三: 用户终端 A和 DHCP服务器位于不同网络平面, 如图 3c所 示, 用户终端 A位于公网而 DHCP月良务器位于私网 (也称为, 虚拟专用 网,筒称 VPN ) ,该场景下由于 VPN的访问限制, DHCP中继设备和 DHCP 服务器之间, 对应于 DHCP的物理接口的 IP地址的路由不可达, 但二者 基于回环接口的 IP地址的路由可达; 图 3c中, "C" 表示用户终端 A,
"R" 表示 DHCP中继设备的物理接口, "L" 表示 DHCP中继设备的回 环接口。
DHCP中继设备可在第一物理接口的属性配置信息上预先配置通路 IP 地址, 一种可选的配置方式是采用 以下命令行: " IP Relay ip-address<ip-address> [vpn-instance< vpn-instance >],, 。 该命令行中, "ip-address"表示通路 IP地址选项, 该选项包括的地址数量可为一个或多 个; "vpn-instance" 为可选项, 表示当 DHCP服务器处于 VPN时其所在 的 VPN实例信息。 具体对应到上述场景中: 在场景一情形下, 该命令行 "ip-address"选 项的信息, 可为 DHCP中继设备的回环接口 IP地址; 在场景二情形下, 该命令行 "ip-address"选项的信息, 可为 DHCP中继设备的第二物理接口 的 IP地址; 场景二情形下, 如果 DHCP服务器与 DHCP中继设备之间存 在基于其他类型 IP地址的路由通路, 则该命令行 "ip-address"选项的信息 还可包括这些路由通路对应的 IP地址, 如 DHCP中继设备的回环接口的 IP地址等;在场景三情形下,该命令行" ip-address"选项的信息可为 DHCP 中继设备的回环接口的 IP地址。对于上述场景一和场景二, DHCP中继设 备是根据公网的可达路由, 向 DHCP服务器发送第二 DHCP报文; 而对于 上述场景三, DHCP中继设备需要根据上述命令行中 "vpn-instance" 选项 的信息, 确定私网可达路由, 并根据私网可达路由向 DHCP服务器发送第 二 DHCP报文。
需要说明的是, 无论哪种场景,如果 DHCP中继设备与 DHCP服务器 路由之间, 基于第一物理接口的 IP地址的路由不可达, 但基于其他 IP地 址的路由可达时, 可达路由对应的 IP地址均可作为 DHCP中继设备的通 路 IP地址。
35 : DHCP 服务器接收第二 DHCP 报文, 获取第二 DHCP 报文的 " GIADDR"字段携带的第一物理接口的 IP地址,根据第一物理接口的 IP 地址, 在相应地址池中为该用户终端分配 IP地址。
36: DHCP服务器确定第二 DHCP报文的 "OPTION 125" 字段是否 携带有通路 IP地址, 如果有, 则执行 37, 否则, 执行 38。
37: DHCP 服务器生成 DHCP应答报文, 并向下游网络设备广播该 DHCP应答报文; 该 DHCP应答报文以第二 DHCP报文的 " OPTION 125,, 字段携带的通路 IP地址为目的地址、 且包括有 DHCP服务器为该用户终 端分配的 IP地址; 执行 39。
如果 "OPTION 125" 字段携带多个通路 IP地址, 则为了提高 DHCP 中继设备接收到应答报文的可靠性, DHCP服务器可生成与通路 IP地址数 量相同的多个 DHCP应答报文, 每个 DHCP应答报文以其中一个通路 IP 地址作为目的地址。
38: DHCP 服务器生成 DHCP应答报文, 并向下游网络设备广播该 DHCP应答报文; 该 DHCP应答报文以第二 DHCP报文的 " GIADDR" 字 段携带的第一物理接口的 IP地址为目的地址、 且包括有 DHCP服务器为 该用户终端分配的 IP地址; 执行 39。
39: DHCP中继设备接收 DHCP服务器发送的 DHCP应答报文, 在第 一物理接口对应的子网范围内广播该 DHCP应答报文。
310: 该用户终端接收 DHCP应答报文, 获取该 DHCP应答报文中携 带的 DHCP服务器为其分配的 IP地址。
本实施例在实现图 1和图 2对应实施例相似技术效果的基础上, 利用 了现有 DHCP报文的私有字段, 如 "OPTION 125" 字段, 携带通用 IP地 址, 因此本实施例提供的方法对现有网络通信过程的改动较小, 具有成本 低、 易实现等优点。 需要说明的是, 可对本实施例技术方案进行变形, 如 采用 "OPTION 125" 字段之外的其他字段携带通用 IP地址, 其实现为用 户终端分配 IP地址的方法与本实施例相似, 在此不再赘述。
图 4为本发明实施例三提供的 DHCP中继设备的结构示意图。 如图 4所 示的 DHCP中继设备包括: 第一报文获取模块 41、 第二报文生成模块 42、 第 二报文发送模块 43、 应答报文接收模块 44和 IP地址发送模块 45。
第一报文获取模块 41可用于接收来自用户终端的用于请求 IP地址的第 一 DHCP报文。
第二报文生成模块 42可用于根据所述第一 DHCP报文,生成第二 DHCP 报文;所述第二 DHCP报文中携带第一物理接口的 IP地址和至少一个通路 IP 地址, 其中: 所述 DHCP中继设备通过所述第一物理接口与所述用户终端相 连, 所述 DHCP中继设备和 DHCP服务器之间对应于所述通路 IP地址的路 由是可达的。
第二报文发送模块 43可用于根据与所述通路 IP地址对应的可达路由, 向所述 DHCP服务器发送所述第二 DHCP报文。
应答报文接收模块 44可用于接收所述 DHCP服务器返回的 DHCP应答 报文,所述 DHCP应答报文携带所述 DHCP服务器为所述用户终端分配的 IP 地址; 其中: 所述 DHCP应答报文的目的 IP地址为所述通路 IP地址; 所述 DHCP 务器为所述用户终端分配的 IP地址,来自与所述第一物理接口的 IP 地址对应的地址池。 IP地址发送模块 45可用于向所述用户终端发送所述 DHCP服务器为 所述用户终端分配的 IP地址。
可选的, 所述第二请求报文生成模块 42 , 具体可用于在所述第一 DHCP报文的 " GIADDR" 字段中添加所述第一物理接口的 IP地址、 以及 在所述第一 DHCP 报文的 "OPTION 125" 字段中添加至少一个所述通路 IP地址, 生成所述第二 DHCP报文。 所述通路 IP地址可以为以下地址中 的任意一个或多个: : 所述 DHCP中继设备的回环接口的 IP地址; 第一 物理接口的 IP地址, 和所述 DHCP中继设备的第二物理接口的 IP地址, 所述第二物理接口为所述 DHCP 中继设备除所述第一物理接口之外的其 他物理接口。
本实施例提供的 DHCP中继设备, 将通路 IP地址携带在 DHCP报文 中, 并通过通路 IP地址对应的可达路由与该 DHCP 务器传递4艮文, 由 此解决了现有技术中 DHCP 中继设备物理接口与 DHCP服务器路由不可 达,无法采用 DHCP协议为用户终端分配 IP地址的问题,提高了基于 DHCP 协议为用户终端分配 IP地址的通用性。 本实施例提供的 DHCP中继设备 的工作机理, 可参见图 1和图 3a的相应记载, 在此不再赞述。
图 5为本发明实施例五提供的 DHCP服务器的结构示意图。 如图 5所示 DHCP服务器包括: 请求报文接收模块 51、 IP地址分配模块 52、 应答报文 生成模块 53和应答报文发送模块 54。
请求报文接收模块 51可用于接收 DHCP中继设备发送的用于请求 IP地 址的第二 DHCP报文;所述第二 DHCP报文携带所述 DHCP中继设备的第一 物理接口的 IP地址, 以及至少一个通路 IP地址。
IP地址分配模块 52可用于根据所述第一物理接口的 IP地址, 在对应的 地址池中为用户终端分配 IP地址。
应答报文生成模块 53可用于根据所述第一物理接口的 IP地址, 在对应 的地址池中为用户终端分配 IP地址;
应答报文发送模块 54可用于向所述 DHCP中继设备发送所述 DHCP应 答报文。
可选的,请求报文接收模块 51还可用于在接收到所述第二 DHCP报文之 后, 在所述第二 DHCP报文的 "GIADDR" 字段, 获取所述第一物理接口的 IP地址; 在所述第二 DHCP报文的 "OPTION 125" 字段, 获取至少一个所 述通路 IP地址。
本实施例提供的 DHCP服务器接收 DHCP中继设备发送的第二 DHCP 报文, 根据第二 DHCP报文中的第一物理接口的 IP地址, 为该用户终端 分配 IP地址, 并根据第二 DHCP报文中的通路 IP地址, 返回 DHCP应答 报文,由此解决了现有技术中 DHCP中继设备物理接口与 DHCP服务器路 由不可达, 无法采用 DHCP协议为用户终端分配 IP地址的问题, 提高了 基于 DHCP协议为用户终端分配 IP地址的通用性。本实施例提供的 DHCP 服务器的工作机理, 可参见图 1和图 3a的相应记载, 在此不再赘述。
图 6为本发明实施例六提供的为用户终端分配 IP地址的系统的结构示 意图。 如图 6所示的系统包括: DHCP中继设备 61和 DHCP服务器 62, DHCP中继设备 61与 DHCP服务器 62通信。 用户终端 63与 DHCP中继 设备 61通信。可选的,根据实际组网的需要,在 DHCP中继设备和 DHCP 月^务器之间可存在多跳中继。 其中: DHCP中继设备的结构及其可达到的 技术效果, 可参见图 4对应实施例的记载, DHCP服务器的结构及其可达 到的技术效果, 可参见图 5对应实施例的记载, 在此不再赘述。
本领域普通技术人员可以理解: 附图只是一个实施例的示意图, 附图 中的模块或流程并不一定是实施本发明所必须的。
本领域普通技术人员可以理解: 实施例中的装置中的模块可以按照实 施例描述分布于实施例的装置中, 也可以进行相应变化位于不同于本实施 例的一个或多个装置中。 上述实施例的模块可以合并为一个模块, 也可以 进一步拆分成多个子模块。
本领域普通技术人员可以理解: 实现上述各方法实施例的全部或部分 步骤可以通过程序指令相关的硬件来完成。 前述的程序可以存储于一计算 机可读取存储介质中。 该程序在执行时, 执行包括上述各方法实施例的步 骤; 而前述的存储介质包括: ROM、 RAM, 磁碟或者光盘等各种可以存 储程序代码的介质。
最后应说明的是: 以上实施例仅用以说明本发明的技术方案, 而非对其 限制; 尽管参照前述实施例对本发明进行了详细的说明, 本领域的普通技术 人员应当理解: 其依然可以对前述各实施例所记载的技术方案进行修改, 或 者对其中部分技术特征进行等同替换; 而这些修改或者替换, 并不使相应技 术方案的本质脱离本发明各实施例技术方案的精神和范围。

Claims

权利要求
1、 一种为用户终端分配因特网协议 IP地址的方法, 其特征在于, 包括: 动态主机配置协议 DHCP中继设备接收来自用户终端的用于请求 IP地址 的第一 DHCP报文;
根据所述第一 DHCP报文, 生成第二 DHCP报文; 所述第二 DHCP报文 中携带第一物理接口的 IP地址和至少一个通路 IP地址, 其中, 所述 DHCP 中继设备通过所述第一物理接口与所述用户终端相连, 所述 DHCP中继设备 和 DHCP服务器之间对应于所述通路 IP地址的路由是可达的;
根据与所述通路 ip地址对应的可达路由,向所述 DHCP服务器发送所述 第二 DHCP报文;
接收所述 DHCP服务器返回的 DHCP应答报文,所述 DHCP应答报文携 带所述 DHCP 务器为所述用户终端分配的 IP地址; 其中: 所述 DHCP应 答报文的目的 IP地址为所述通路 IP地址; 所述 DHCP服务器为所述用户终 端分配的 IP地址, 来自与所述第一物理接口的 IP地址对应的地址池;
向所述用户终端发送所述 DHCP 务器为所述用户终端分配的 IP地址。
2、 根据权利要求 1所述的方法, 其特征在于, 所述通路 IP地址为以下 地址中的任意一个或多个: 所述 DHCP中继设备的回环接口的 IP地址, 第一 物理接口的 IP地址, 和第二物理接口的 IP地址。
3、 根据权利要求 1或 2所述的方法, 其特征在于, 生成所述第二 DHCP 报文包括:
通过在所述第一 DHCP报文的网关 IP地址 GIADDR字段中添加所述第 一物理接口的 IP地址、以及在所述第一请求 DHCP报文的选项 OPTION 125 字段中添加至少一个所述通路 IP地址, 生成所述第二 DHCP报文。
4、 一种为用户终端分配因特网协议 IP地址的方法, 其特征在于, 包括: 动态主机配置协议 DHCP服务器接收 DHCP中继设备发送的用于请求 IP 地址的第二 DHCP报文;所述第二 DHCP报文携带所述 DHCP中继设备的第 一物理接口的 IP地址, 以及至少一个通路 IP地址;
根据所述第一物理接口的 IP地址,在对应的地址池中为用户终端分配 IP 地址;
生成 DHCP应答 4艮文, 其中, 所述 DHCP应答 4艮文携带为所述用户终端 向所述 DHCP中继设备发送所述 DHCP应答报文。
5、 根据权利要求 4所述的方法, 其特征在于, 所述通路 IP地址为以下 地址中的任意一个或多个: 所述 DHCP中继设备的回环接口的 IP地址, 第一 物理接口的 IP地址, 和第二物理接口的 IP地址。
6、 根据权利要求 4或 5所述的方法, 其特征在于, 在接收到所述第二 DHCP报文之后, 还包括:
在所述第二 DHCP报文的网关 IP地址 GIADDR字段, 获取所述第一物 理接口的 IP地址; 在所述第二 DHCP报文的选项 OPTION 125字段, 获取至 少一个所述通路 IP地址。
7、 一种动态主机配置协议 DHCP中继设备, 其特征在于, 包括: 第一报文获耳 ^莫块, 用于接收来自用户终端的用于请求因特网协议 IP地 址的第一 DHCP报文;
第二报文生成模块, 用于根据所述第一 DHCP报文, 生成第二 DHCP报 文; 所述第二 DHCP报文中携带第一物理接口的 IP地址和至少一个通路 IP 地址, 其中, 所述 DHCP中继设备通过所述第一物理接口与所述用户终端相 连, 所述 DHCP中继设备和 DHCP服务器之间对应于所述通路 IP地址的路 由可达;
第二报文发送模块, 用于根据与所述通路 IP地址对应的可达路由, 向所 述 DHCP服务器发送所述第二 DHCP报文;
应答报文接收模块,用于接收所述 DHCP服务器返回的 DHCP应答报文, 所述 DHCP应答 文携带所述 DHCP 务器为所述用户终端分配的 IP地址; 其中: 所述 DHCP应答报文的目的 IP地址为所述通路 IP地址; 所述 DHCP 服务器为所述用户终端分配的 IP地址, 来自与所述第一物理接口的 IP地址 对应的地址池;
IP地址发送模块, 用于向所述用户终端发送所述 DHCP服务器为所述用 户终端分配的 IP地址。
8、 根据权利要求 7所述的 DHCP中继设备, 其特征在于,
所述第二报文生成模块,具体用于在所述第一 DHCP报文的网关 IP地址 GIADDR字段中添加所述第一物理接口的 IP地址、以及在所述第一 DHCP报 文的选项 OPTION 125字段中添加至少一个所述通路 IP地址, 生成所述第二 DHCP报文。
9、 一种动态主机配置协议 DHCP服务器, 其特征在于, 包括: 请求报文接收模块, 用于接收 DHCP中继设备发送的用于请求因特网协 议 IP地址的第二 DHCP报文; 所述第二 DHCP报文携带所述 DHCP中继设 备的第一物理接口的 IP地址, 以及至少一个通路 IP地址;
IP地址分配模块, 用于根据所述第一物理接口的 IP地址, 在对应的地址 池中为用户终端分配 IP地址;
应答报文生成模块, 用于根据所述第一物理接口的 IP地址, 在对应的地 址池中为用户终端分配 IP地址; 文。
10、 根据权利要求 9所述的 DHCP服务器, 其特征在于,
所述请求报文接收模块, 还用于在接收到所述第二 DHCP报文之后, 在 所述第二 DHCP报文的网关 IP地址 GIADDR字段, 获取所述第一物理接口 的 IP地址; 在所述第二 DHCP报文的选项 OPTION 125字段, 获取至少一个 所述通路 IP地址。
11、一种为用户终端分配因特网协议 IP地址的系统,其特征在于, 包括: 如权利要求 7或 8所述的动态主机配置 DHCP中继设备; 以及
如权利要求 9或 10所述的 DHCP服务器。
PCT/CN2012/078280 2011-11-18 2012-07-06 为用户终端分配ip地址的方法、装置和系统 WO2013071765A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201110369801.1 2011-11-18
CN201110369801.1A CN102404418B (zh) 2011-11-18 2011-11-18 为用户终端分配ip地址的方法、装置和系统

Publications (1)

Publication Number Publication Date
WO2013071765A1 true WO2013071765A1 (zh) 2013-05-23

Family

ID=45886196

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2012/078280 WO2013071765A1 (zh) 2011-11-18 2012-07-06 为用户终端分配ip地址的方法、装置和系统

Country Status (2)

Country Link
CN (1) CN102404418B (zh)
WO (1) WO2013071765A1 (zh)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113438335A (zh) * 2021-06-10 2021-09-24 深圳市广和通无线股份有限公司 路由方法、装置、设备及存储介质

Families Citing this family (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102404418B (zh) * 2011-11-18 2015-01-28 北京华为数字技术有限公司 为用户终端分配ip地址的方法、装置和系统
EP2888863B1 (en) * 2012-08-24 2018-10-10 Thomson Licensing Method and apparatus for configuring dhcp client
CN103888551B (zh) * 2012-12-19 2017-09-12 华为技术有限公司 一种网络中的因特网协议地址获取方法、中继设备及系统
CN104158916A (zh) * 2013-05-13 2014-11-19 中兴通讯股份有限公司 设备接入网络的方法和装置
CN105338125B (zh) 2014-06-25 2019-11-05 华为技术有限公司 报文处理方法及装置
CN107547665B (zh) * 2016-06-23 2021-02-09 华为技术有限公司 一种dhcp地址分配的方法、设备及系统
CN106656659B (zh) * 2016-11-30 2020-12-29 浙江宇视科技有限公司 一种网络路径的选择方法以及网络硬盘录像机
CN108600408A (zh) * 2018-03-30 2018-09-28 新华三技术有限公司 请求地址的方法及装置
CN111049763B (zh) * 2019-11-08 2022-02-22 苏州浪潮智能科技有限公司 一种数据中心交换机转发表的配置方法及装置
CN112911026A (zh) * 2019-12-03 2021-06-04 北京华为数字技术有限公司 一种地址申请方法、装置及设备
CN113472621B (zh) * 2020-03-30 2023-05-30 北京沃东天骏信息技术有限公司 网络数据转发方法、装置和系统

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1949784A (zh) * 2005-10-12 2007-04-18 华为技术有限公司 Dhcp中继为dhcp客户端请求ip地址的方法
CN1960380A (zh) * 2005-11-03 2007-05-09 华为技术有限公司 一种获取业务ip地址的方法
CN102404418A (zh) * 2011-11-18 2012-04-04 华为数字技术有限公司 为用户终端分配ip地址的方法、装置和系统

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1949784A (zh) * 2005-10-12 2007-04-18 华为技术有限公司 Dhcp中继为dhcp客户端请求ip地址的方法
CN1960380A (zh) * 2005-11-03 2007-05-09 华为技术有限公司 一种获取业务ip地址的方法
CN102404418A (zh) * 2011-11-18 2012-04-04 华为数字技术有限公司 为用户终端分配ip地址的方法、装置和系统

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
DROMS R. ET AL.: "Dynamic Host Configuration Protocol.", IEEE RFC2131, March 1997 (1997-03-01) *
PATRICK M.: "DHCP Relay Agent Information Option", IEEE RFC3046., January 2001 (2001-01-01) *

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113438335A (zh) * 2021-06-10 2021-09-24 深圳市广和通无线股份有限公司 路由方法、装置、设备及存储介质

Also Published As

Publication number Publication date
CN102404418B (zh) 2015-01-28
CN102404418A (zh) 2012-04-04

Similar Documents

Publication Publication Date Title
WO2013071765A1 (zh) 为用户终端分配ip地址的方法、装置和系统
US8125993B2 (en) Network element having a DHCP lease timer
WO2010069181A1 (zh) Ipv6地址配置方法和系统
WO2017166936A1 (zh) 一种实现地址管理的方法、装置、aaa服务器及sdn控制器
WO2012163007A1 (zh) 解决网际协议地址分配冲突的方法及相关设备和系统
JP5753172B2 (ja) ネットワークアドレス変換のための管理方法および管理デバイス
JP5424007B2 (ja) 情報を提供するための方法、ホームゲートウェイおよびホームネットワークシステム
JP2011160103A (ja) ゲートウェイ装置及びプログラム、並びに、通信システム
WO2009143729A1 (zh) 实现dhcp用户业务批发的方法、系统和设备
WO2015085788A1 (zh) 一种动态主机配置协议报文处理方法及装置
WO2009071009A1 (fr) Procédé pour découvrir automatiquement des dispositifs d&#39;éléments de réseau, dispositif et système
WO2013086966A1 (zh) 基于IPv6的二层互通的方法、装置和系统
WO2014056441A1 (zh) 一种在CPE上配置IPv6过渡技术的方法及设备
WO2009129707A1 (zh) 局域网之间发送、接收信息的方法和装置以及通信的系统
WO2012109849A1 (zh) Mac地址分配方法和设备
EP2675117A1 (en) Routing method and device for host in multi-homing site
WO2011147343A1 (zh) Ip网络中地址分配方法、设备及系统
WO2014000226A1 (zh) 网络路径控制方法、设备及系统
WO2018161795A1 (zh) 一种路由优先级配置方法、设备以及控制器
CN106878481B (zh) 一种网络互连协议ip地址获取方法、装置和系统
US9503418B2 (en) Method and apparatus for obtaining remote IP address
WO2008011776A1 (fr) Procédé d&#39;affectation d&#39;adresse, ainsi que système, agent relais et serveur correspondants
CN113938353A (zh) 室内机与室外机之间的多pdn实现方法及存储介质
US20130086259A1 (en) Method for acquiring an ip address and network access device
US8549117B2 (en) Method for address translator traversal in 3GPP networks

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: 12850439

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: 12850439

Country of ref document: EP

Kind code of ref document: A1