WO2015085558A1 - Method, device and system for dynamically allocating ip address - Google Patents
Method, device and system for dynamically allocating ip address Download PDFInfo
- Publication number
- WO2015085558A1 WO2015085558A1 PCT/CN2013/089291 CN2013089291W WO2015085558A1 WO 2015085558 A1 WO2015085558 A1 WO 2015085558A1 CN 2013089291 W CN2013089291 W CN 2013089291W WO 2015085558 A1 WO2015085558 A1 WO 2015085558A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- dhcp
- switch
- address
- routing
- communication device
- Prior art date
Links
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L61/00—Network arrangements, protocols or services for addressing or naming
- H04L61/50—Address allocation
- H04L61/5007—Internet protocol [IP] addresses
- H04L61/5014—Internet protocol [IP] addresses using dynamic host configuration protocol [DHCP] or bootstrap protocol [BOOTP]
Definitions
- Embodiments of the present invention relate to the field of network technologies, and, more particularly, to a method, apparatus, and system for dynamically allocating IP addresses. Background technique
- DHCP Dynamic Hos t Conf s Protoco l
- Embodiments of the present invention provide a method, an apparatus, and a system for dynamically allocating an IP address, which are used to solve the problem that a large amount of network resources are consumed by a DHCP message sent by a broadcast method in the prior art, and the DHCP message does not need to be received.
- the performance of the server creates a problem of greater stress.
- the first aspect provides a method for dynamically allocating an IP address, where the method includes: receiving, by a switch, a packet sent by a communication device that accesses the switch;
- the switch obtains a routing address of the DHCP server corresponding to the communication device, and replaces the broadcast address of the destination address field of the DHCP message with the broadcast address, when the packet is determined to be a broadcast DHCP message.
- the routing address of the DHCP server ;
- the switch will modify the DHCP according to the routing address in the modified DHCP message.
- the message is routed to the DHCP server.
- the routing address of the DHCP server includes an IP address and a MAC address of the DHCP server
- the switch sends a broadcast address of the destination address field of the DHCP message
- the routing address of the DHCP server is replaced by: the switch replaces the broadcast IP address of the destination IP address field of the DHCP packet with the IP address of the DHCP server, and uses the destination of the DHCP packet.
- the broadcast MAC address of the MAC address field is replaced with the MAC address of the DHCP server.
- the switch before the acquiring the routing address of the DHCP server, the switch further includes: the switch receiving the switch Route indication information sent by the controller of the communication, the route indication information includes a routing address of the DHCP server, and a route for instructing the switch to route the received DHCP message sent by the switch to the DHCP server.
- the step of: obtaining the routing address of the DHCP server corresponding to the communication device, and replacing the broadcast address of the destination address field of the DHCP packet with the routing address of the DHCP server specifically: The routing address of the DHCP server is obtained, and the broadcast address of the destination address field of the DHCP packet is replaced with the routing address of the DHCP server according to the routing indication in the routing indication information.
- the method further includes: After the communication device accesses the switch, the identifier of the communication device is sent to the controller; the routing indication information further includes a mapping relationship between the identifier of the communication device and a routing address of the DHCP server; Specifically, the switch is configured to: route, by the switch, a DHCP message sent by the communication device to the DHCP server, where the routing address of the DHCP server corresponding to the communication device is specifically included, Acquiring the identifier of the communication device in the DHCP message, and acquiring the routing address of the DHCP server corresponding to the identifier of the communication device according to the mapping relationship in the routing indication information.
- the DHCP packet is specifically a DHCP discovery packet or a DHCP request packet.
- the second aspect provides a method for dynamically allocating an IP address, where the method includes: the controller generates routing indication information, where the routing indication information includes a routing address of the DHCP server, and is used to indicate that the switch will receive the broadcast mode.
- the sent DHCP message is routed to the
- the controller sends the routing indication information to a switch that communicates with the controller, so that when the switch receives the DHCP message sent by the broadcast, according to the DHCP server in the routing indication information
- the routing address routes the DHCP message to the DHCP server.
- the method before the generating the routing indication information by the controller, the method further includes: the controller receiving the communication that is sent by the switch when the communications device accesses the switch An identifier of the device, and determining a DHCP server corresponding to the communication device; the routing indication information further includes a mapping relationship between the identifier of the communication device and a routing address of the DHCP server, where the routing indication is specifically used to indicate the switch Routing the DHCP message sent from the communication device to the DHCP server, so that: the switch receives the DHCP message that is sent by the communication device and includes the identifier of the communication device. And obtaining the routing address of the DHCP server according to the mapping relationship, and routing the DHCP packet to the DHCP server according to the routing address of the DHCP server.
- the routing address of the DHCP server includes an IP address and a MAC address of the DHCP server.
- a third aspect provides a method for dynamically allocating an IP address, where the method includes: receiving, by a switch, a packet sent by a communication device that accesses the switch;
- the switch When the switch determines that the packet is a DHCP message, the switch forwards the DHCP message to a controller that communicates with the switch, so that the controller sets the communication message according to the DHCP message.
- a DHCP service is available.
- the switch before the switch forwarding the DHCP packet to the controller, the switch further includes: the switch receiving the indication information sent by the controller, where the indication information is And the switch is configured to forward the received DHCP message to the controller according to the indication information, and the switch performs, according to the indication information, forwarding the DHCP message to the control when determining that the packet is a DHCP message. Operation of the device.
- the method further includes: accessing, by the communication device, the switch by using a port on the switch The switch sends the port number of the port to the controller; when the switch receives the data packet that is sent by the controller and carries the DHCP packet and the port number, the switch passes the data packet.
- the port identified by the port number sends the DHCP packet carried in the data packet to the communication device.
- a fourth aspect provides a method for dynamically allocating an IP address, where the method includes: the controller sends indication information to a switch that communicates with the controller, where the indication information is used to indicate that the switch will receive the DHCP report. Forwarding to the controller;
- the controller receives the DHCP message forwarded by the switch to the controller when determining that the packet received by the communication device accessing the switch is a DHCP message according to the indication information; And providing a DHCP service to the communication device according to the DHCP message.
- the method further includes: the controller receiving, by the switch, when the communications device accesses the switch through a port on the switch The port number of the port; the controller providing the DHCP service to the communication device according to the DHCP message, specifically, the controller constructs a DHCP message including data corresponding to the DHCP service, and constructs a DHCP message. And the port number is encapsulated into a data packet and sent to the switch, so that the switch sends the DHCP packet carried by the data packet to the port identified by the port number in the data packet.
- the communication device includes: a receiving unit, a processing unit, and a routing unit;
- the receiving unit is configured to receive a packet sent by the communication device that accesses the switch, and is further configured to send the received packet to the processing unit;
- the processing unit is configured to receive the packet from the receiving unit, and obtain a routing address of a DHCP server corresponding to the communication device when the packet is determined to be a DHCP message sent by the broadcast device, where the The broadcast address of the destination address field of the DHCP packet is replaced with the routing address of the DHCP server, and the modified DHCP packet is sent to the routing unit.
- the routing unit is configured to receive the modified DHCP message from the processing unit, and route the modified DHCP message to the DHCP according to the routing address in the modified DHCP message server.
- the routing address of the DHCP server includes an IP address and a MAC address of the DHCP server
- the processing unit is configured to: use the destination address field of the DHCP message
- the replacing the broadcast address with the routing address of the DHCP server includes: the processing unit is configured to replace the broadcast IP address of the destination IP address field of the DHCP packet with the IP address of the DHCP server, and the DHCP
- the broadcast MAC address of the destination MAC address field of the message is replaced with the MAC address of the DHCP server.
- the receiving unit is further configured to receive routing indication information sent by a controller that communicates with the switch, where
- the routing indication information includes a routing address of the DHCP server, and a routing indication for instructing the switch to route the received DHCP message to the DHCP server;
- the processing unit is configured to determine When the packet is a DHCP message, the routing address of the DHCP server corresponding to the communication device is obtained, and the broadcast address of the destination address field of the DHCP packet is replaced with the routing address of the DHCP server.
- the processing unit is configured to: obtain the routing address of the DHCP server from the routing indication information, and replace the broadcast address of the destination address field of the DHCP packet with the routing indication in the routing indication information.
- the routing address of the DHCP server is configured to: obtain the routing address of the DHCP server from the routing indication information, and replace the broadcast address of the destination address field of the DHCP packet with the routing indication in the routing indication information.
- the routing address of the DHCP server further includes an access unit, where the access unit is configured to access the switch in the communications device And sending the identifier of the communication device to the controller; the routing indication information further includes a mapping relationship between the identifier of the communication device and a routing address of the DHCP server, where the routing indication is specifically used to indicate the switch And transmitting, by the processing unit, the routing address of the DHCP server that is sent by the communication device to the DHCP server.
- the processing unit is configured to acquire a routing address of the DHCP server corresponding to the communication device, where the processing unit includes: Acquiring the identifier of the communication device from the DHCP message, and acquiring a routing address of the DHCP server corresponding to the identifier of the communication device according to the mapping relationship in the routing indication information.
- a controller is provided, where the controller includes a generating unit and a sending unit, and the generating unit is configured to generate routing indication information, where the routing indication information includes a routing address of the DHCP server, and is used for indicating The switch routes the received DHCP message sent by the broadcast to the routing instruction of the DHCP server, and sends the route indication information to the sending unit.
- the sending unit is configured to receive the routing indication information from the generating unit, and is further configured to send the routing indication information to a switch that communicates with the controller, so that the switch receives the broadcast manner
- the DHCP message is routed to the DHCP server according to the routing address of the DHCP server in the routing indication information.
- the controller further includes a receiving unit, where the receiving unit is configured to receive the communication that is sent by the switch when the communications device accesses the switch An identifier of the device, and configured to send the identifier of the communication device to the determining unit, where the generating unit is further configured to receive an identifier of the communications device from the receiving unit, and determine, corresponding to the communications device
- the routing information generated by the generating unit further includes a mapping relationship between the identifier of the communications device and the routing address of the DHCP server, where the routing indication is specifically used to indicate that the switch is to be received from the communications device.
- the broadcasted DHCP message is routed to the DHCP server, so that: the switch receives the communication device When the DHCP message containing the identifier of the communication device is sent, the routing address of the DHCP server is obtained according to the mapping relationship, and the DHCP message is routed to the DHCP according to the routing address of the DHCP server. server.
- the routing address of the DHCP server includes an IP address and a MAC address of the DHCP server.
- a switch is provided, where the switch includes a receiving unit and a forwarding unit, and the receiving unit is configured to receive a packet sent by a communication device that accesses the switch, and send the packet to the Forwarding unit
- the forwarding unit is configured to receive the packet from the receiving unit, and forward the DHCP packet to a controller that communicates with the switch when determining that the packet is a DHCP message, so that the The controller provides a DHCP service for the communication device according to the DHCP message.
- the receiving unit is further configured to receive the indication information sent by the controller, where the indication information is used to instruct the switch to forward the received DHCP message to the
- the forwarding unit is configured to perform, according to the indication information, an operation of forwarding the DHCP message to the controller when determining that the message is a DHCP message.
- the switch further includes an access unit, where the access unit is configured to pass the communication device When the port on the switch accesses the switch, the port number of the port is sent to the controller; the receiving unit is further configured to receive the DHCP packet sent by the controller and the port number Data packet, and the data packet is sent to the forwarding unit; the forwarding unit is further configured to receive the data packet from the receiving unit, and pass the port number in the data packet The identified port sends the DHCP packet carried by the data packet to the communication device.
- a controller in an eighth aspect, includes a sending unit, a receiving unit, and a service unit;
- the sending unit is configured to send, to the switch that communicates with the controller, the indication information, where the indication information is used to instruct the switch to forward the received DHCP message to the controller;
- the receiving unit is configured to receive, by the switch, the DHCP message that is forwarded to the controller when the packet received by the communication device that accesses the switch is a DHCP message according to the indication information, and is used by the switch. Sending the DHCP message to the service unit;
- the service unit is configured to receive the DHCP message from the receiving unit, and configured to provide a DHCP service for the communication device according to the DHCP message.
- the receiving unit is further configured to receive, by the switch, the port that is sent when the communications device accesses the switch through a port on the switch a port number, and configured to send the port number to the service unit; the service unit is further configured to receive the port number from the receiving unit; the service unit is configured to use the DHCP message as the
- the providing the DHCP service by the communication device includes: the service unit is configured to construct a DHCP message including the data corresponding to the DHCP service, and the configured DHCP message and the port number are encapsulated into the data message, and are used for Sending the data packet to the sending unit; the sending unit is further configured to receive the data packet from the serving unit, and send the data packet to the switch, so that the switch Sending, by the port identified by the port number in the data packet, the DHCP packet carried by the data packet to the communication device.
- a communication system is provided, where the communication system includes a switch and a controller, and the
- the controller is configured to generate routing indication information, where the routing indication information includes a routing address of the DHCP server, and a routing indication for instructing the switch to route the received DHCP message sent by the switch to the DHCP server. And is further configured to send the routing indication information to the switch;
- the switch is configured to receive a packet sent by a communication device that accesses the switch, and obtain the DHCP server from the routing indication information when determining that the packet is a DHCP message sent by the broadcast mode. Routing the address, and according to the routing indication in the routing indication information, the DHCP The broadcast address of the destination address field of the packet is replaced with the routing address of the DHCP server, and is also used to route the modified DHCP packet to the DHCP server according to the routing address in the modified DHCP packet.
- the routing address of the DHCP server includes an IP address and a MAC address of the DHCP server
- the switch is configured to use the destination address field of the DHCP message
- the replacement of the broadcast address with the routing address of the DHCP server includes: the switch is configured to replace the broadcast IP address of the destination IP address field of the DHCP packet with the IP address of the DHCP server, and the The broadcast MAC address of the destination MAC address field of the DHCP message is replaced with the MAC address of the DHCP server.
- the switch is further configured to: after the communications device accesses the switch Sending the identifier of the communication device; the controller is further configured to determine a DHCP server corresponding to the communication device, where the routing indication information generated by the controller further includes an identifier of the communication device and the DHCP server a routing address mapping relationship, where the routing indication is specifically used to instruct the switch to route a DHCP message sent by the communication device to the DHCP server; the switch is configured to acquire the communication device.
- the routing address of the corresponding DHCP server includes: the switch is configured to obtain the identifier of the communication device from the DHCP packet, and obtain the identifier corresponding to the identifier of the communication device according to the mapping relationship in the routing indication information.
- the routing address of the DHCP server includes: the communication system includes a switch and a controller, and the switch and the controller communicate through a network;
- the controller is configured to send indication information to the switch, where the indication information is used to instruct the switch to forward the received DHCP message to the controller;
- the switch is configured to forward the DHCP message to the controller when determining that the packet is a DHCP message according to the indication information;
- the controller is further configured to provide a DHCP service for the communication device according to the DHCP message.
- the switch is further configured to: when the communications device accesses the switch through a port on the switch, send the port to the controller
- the port number is provided by the controller to provide the DHCP service to the communication device according to the DHCP message
- the controller includes: constructing a DHCP message including data corresponding to the DHCP service, and configuring the DHCP message and The port number is encapsulated into a data packet and sent to the switch; the switch is further configured to send the DHCP packet carried by the data packet to the port identified by the port number in the data packet.
- the switch when the switch receives the DHCP message sent by the communication device in a broadcast manner, the broadcast address in the DHCP message is replaced with the corresponding address of the communication device.
- the routing address of the DHCP server is only sent to the DHCP server, instead of broadcasting the message to all network devices in the broadcast range, thereby solving all the broadcasts in the prior art.
- the problem that the network device sends a large amount of network resources caused by sending DHCP messages, and the performance of the server that does not need to receive the DHCP message is greatly stressed.
- FIG. 1 is a schematic structural diagram of a networking of a communication system according to an embodiment of the present invention
- FIG. 2 is a schematic diagram of a networking structure of an SDN-based communication system according to an embodiment of the present invention
- FIG. 3 is a schematic flowchart of a method provided by Embodiment 1 of the present invention
- 5-6 is a schematic flowchart of a method provided by Embodiment 2 of the present invention.
- FIG. 7 is a schematic structural diagram of a switch according to Embodiment 3 of the present invention.
- FIG. 8 is a schematic structural diagram of a controller according to Embodiment 4 of the present invention.
- FIG. 9 is a schematic structural diagram of a switch according to Embodiment 5 of the present invention.
- FIG. 10 is a schematic structural diagram of a controller according to Embodiment 6 of the present invention.
- FIG. 11 is a schematic structural diagram of a switch according to Embodiment 7 of the present invention
- FIG. 12 is a schematic structural diagram of a controller according to Embodiment 8 of the present invention
- FIG. 11 is a schematic structural diagram of a switch according to Embodiment 7 of the present invention
- FIG. 12 is a schematic structural diagram of a controller according to Embodiment 8 of the present invention
- FIG. 12 is a schematic structural diagram of a controller according to Embodiment 8 of the present invention.
- FIG. 13 is a schematic structural diagram of a switch according to Embodiment 9 of the present invention.
- FIG. 14 is a schematic structural diagram of a controller according to Embodiment 10 of the present invention.
- FIG. 15 is a schematic structural diagram of a communication system according to Embodiment 11 of the present invention.
- FIG 16 is a block diagram showing the structure of a communication system according to Embodiment 12 of the present invention. detailed description
- FIG. 1 is a schematic structural diagram of a networking of a communication system according to an embodiment of the present invention.
- the communication system includes a switch 110 and a communication device 120, wherein the communication device 120 is coupled to the switch 110 and communicates with other network devices via the switch 110, such as a DHCP server 150 corresponding to the communication device 120.
- the communication device 120 sends a DHCP message to the DHCP server 150 in a broadcast manner, and after receiving the DHCP message, the switch 110 acquires a DHCP server corresponding to the communication device 120, and The broadcast address of the destination address field in the DHCP message is replaced with the routing address of the DHCP server 150, and the modified DHCP message is routed to the DHCP server 150.
- the communication system can also include a controller (Cont roler) 1 30, wherein the controller 130 communicates with the switch 110 over a network.
- a controller Cont roler
- the controller 1 30 is configured to generate routing indication information, and send the routing indication information to the switch 110, where the routing indication information includes a routing address of the DHCP server 150, and A routing indication for instructing the switch 110 to route the received broadcasted DHCP message to the DHCP server 150.
- the switch 110 receives the road After receiving the DHCP message sent by the communication device 120 in the broadcast mode, the DHCP message is routed to the DHCP server 150 according to the routing address of the DHCP server 150.
- the controller 130 is configured to generate the indication information and send the indication information to the switch 110, where the indication information is used to instruct the switch 110 to forward the received DHCP message to the control. 130.
- the switch 110 forwards the received DHCP message to the controller 130 when receiving the DHCP message sent by the communication device 120, and the controller 130 provides the communication device 120 with the DHCP according to the DHCP message. service.
- FIG. 1 is a schematic diagram of a networking structure of a communication system based on an SDN (software defined network) according to an embodiment of the present invention.
- the communication system can be specifically a data center system.
- the switch 110 and the controller 130 can communicate via the openf 1 ow protocol.
- the switch 110 may be a virtual switch, such as the V-switch 110-1 in FIG. 1 or a physical switch, such as P_switch 110-2 and P_switch 110-3 in FIG. 2 .
- the communication device 120 may be a virtual machine connected to the virtual switch, such as VM 120-1 and VM 120-2 in FIG. 2, or a physical host connected to the physical switch, such as Host 120-3 in FIG. Host 120-4 and Host 120-5.
- the controller 130 sends routing indication information to the V-switch 110-1, where the routing indication information includes a routing address of the DHCP server 150, and is used to indicate the V-switch 110.
- the routing indication information includes a routing address of the DHCP server 150, and is used to indicate the V-switch 110.
- -1 routes the received DHCP message sent by the broadcast to the DHCP server 150.
- the V_switch 110-1 routes the DHCP message to the DHCP server 150 according to the routing address of the DHCP server 150 in the routing indication information.
- FIG. 3 is a schematic flowchart of a method according to Embodiment 1 of the present invention. The method of Embodiment 1 of the present invention can be applied to the communication system shown in FIG. 1 or FIG.
- the switch transmits the communication device accessing the switch in a broadcast manner.
- the destination address of the DHCP message is replaced with the routing address of the DHCP server corresponding to the communication device, and the modified DHCP message is routed to the DHCP server.
- Step 210 A switch receives a packet sent by a communication device that accesses the switch.
- the communication device further includes: the communication device accessing the switch through a port on the switch before sending the message.
- Step 220 The switch acquires a routing address of the DHCP server corresponding to the communication device when the packet is a DHCP message sent by the broadcast, and replaces the broadcast address of the destination address field of the DHCP packet. Is the routing address of the DHCP server;
- the value of the destination address field of the DHCP message sent by broadcast is the broadcast address.
- the destination address field includes a destination IP address field and/or a destination MAC address field, where the value of the destination IP address field is a broadcast IP address, such as 255. 255. 255. 255, and the destination MAC address field is a broadcast MAC address. Address, such as ff: ff: ff : ff: ff : ff.
- the switch can determine whether the DHCP message is a broadcast message according to whether the broadcast address is recorded in the destination address field in the DHCP message.
- the DHCP message sent by the broadcast may be a DHCPDI SC0VER packet or a DHCPREQUEST packet.
- the routing address of the DHCP server acquired by the switch includes an IP address and/or a MAC address of the DHCP server.
- the switch sends the DHCP packet.
- the broadcast IP address of the destination IP address field is replaced with the IP address of the DHCP server, and/or the broadcast MAC address of the destination MAC address field of the DHCP message is replaced with the MAC address of the DHCP server.
- the DHCP message includes an identifier of the communication device
- the switch may acquire the mapping relationship between the identifier of the communication device and the routing address of the DHCP server corresponding to the communication device. Identify the routing address of the corresponding DHCP server.
- the identifier of the communication device may be a MAC address of the communication device or a port number of the port.
- Step 230 The switch performs the modification according to the routing address in the modified DHCP packet.
- the subsequent DHCP message is routed to the DHCP server.
- the controller may further include: the controller generates routing indication information, and sends the routing indication information to the switch, where the routing indication information includes a routing address of the DHCP server, and is used to indicate that the switch will receive The DHCP message sent by the broadcast route is routed to the DHCP server.
- the step 220 includes: the switch acquiring the routing address of the DHCP server from the routing indication information, and broadcasting the destination address field of the DHCP packet according to the routing indication in the routing indication information The address is replaced with the routing address of the DHCP server.
- the switch sends the identifier of the communication device to the controller after the communication device accesses the switch.
- the controller further includes: the controller determining a DHCP server corresponding to the communication device, and correspondingly, the generated routing indication information further includes an identifier and a location of the communication device
- the routing relationship of the routing address of the DHCP server is used to: the routing indication is specifically used to instruct the switch to route the DHCP message sent by the communication device to the DHCP server.
- the switch acquires the identifier of the communication device from the DHCP message, and obtains the DHCP server corresponding to the identifier of the communication device according to the mapping relationship in the route indication information. Routing address.
- the switch when the switch receives the DHCP message sent by the communication device in a broadcast manner, the broadcast address in the DHCP message is replaced with the routing address of the DHCP server corresponding to the communication device. Therefore, the DHCP message is sent only to the DHCP server, instead of broadcasting the message to all network devices in the broadcast range, thereby solving the problem in the prior art that the DHCP message is sent to all network devices in the broadcast range by the broadcast mode.
- Embodiment 1 of the present invention will be described in detail below with reference to FIG.
- Step 301 When the communication device accesses the switch, the switch sends the identifier of the communication device to a controller that communicates with the switch.
- the switch and the controller can communicate through the openf low protocol.
- VM 120-1 accesses V-swi tch 110-1 through port 1234 of V_swi tch 110-1, and V-swi tch 110-1 sends port number 1234 to controller 130.
- Step 302 The controller generates routing indication information, and sends the routing indication information to the switch, where the routing indication information includes a MAC address and an IP address of the DHCP server, and is used to indicate that the switch will receive the broadcast mode.
- the DHCP message sent is routed to the routing indication of the DHCP server.
- the routing indication information may be an openf low flow table, as shown in Table 1:
- the openf low flow table is used to indicate that when the received message satisfies the condition set by the matching field, the action set in the action field is executed.
- the matching field ( mat ch f ie ld ) may also be referred to as a header field (header f ie ld ).
- the conditions set by the matching field are the conditions that must be met for the DHCP message sent by the broadcast mode.
- the action set by the action field includes: The destination MAC of the message that meets the condition The address is replaced with the MAC address of the specified DHCP server, which will satisfy the condition of the packet.
- the destination IP address is replaced with the IP address of the specified DHCP server, and the packets are forwarded according to the behavior of the Layer 2 or Layer 3 switch.
- the switch determines that the received message meets the condition set by the matching domain, that is, when the received message is determined to be a DHCP message sent by the broadcast mode, Replace the destination MAC address of the packet with the MAC address of the specified DHCP server, replace the destination IP address of the packet with the IP address of the specified DHCP server, and forward the modified DHCP according to the normal Layer 2/Layer 3 switch behavior. Message.
- the fields of the matching domain include the transport layer source port number (tp_ src ), the transport layer destination port number (tp_ds t ), the data link layer packet type ( dl _ type ), and the network layer protocol type ( nw .proto ), destination MAC address ( dl _ds t ) and destination IP address ( _ds t), when the transport layer source port number is 68 in the received message, the transport layer destination port number is 67, the data link If the packet type is 0x0800 and the network layer protocol type is 17, you can determine that the packet is a DHCP packet.
- the packet can be further determined to be a DHCP message sent by broadcast.
- Ip is used to indicate that the destination IP address in the text is replaced with the dhcp server ip (the IP address of the DHCP server).
- the configured Norma is used to forward the modified packet to the normal Layer 2 or Layer 3 switch. Go out.
- the matching field of the flow table shown in Table 1 may further include an identifier of the communication device, to indicate that the action domain setting is performed when receiving the DHCP message sent by the communication device in a broadcast manner. action.
- step 302 is performed after step 301, and if it is not needed, step 302 may also be step 301. Executed before.
- Step 303 The communications device sends a DHCPDISCOVER packet in a broadcast manner.
- the DHCP messages sent by the communication device are all sent by a DHCP client installed on the communication device. Specifically, when the DHCP client starts, the DHCP client The client broadcasts a DHCPDI SCOVER message in the subnet where the communication device is located.
- the DHCPDI SCOVER 4 message is used to apply for an IP address.
- Step 304 The switch receives the DHCPDI SCOVER message, and uses the received routing indication information to determine that the DHCPDI SCOVER message is a DHCP message sent by broadcast, and then the DHCPDI SCOVER is The destination MAC address is replaced with the MAC address of the DHCP server in the routing indication information, and the destination IP address of the DHCPDI SCOVER message is replaced with the IP address of the DHCP server in the routing indication information.
- Step 305 The switch forwards the modified DHCPD I SC0VER 4 message.
- the DHCPID SCOVER message is directly routed to the DHCP server because the destination IP address of the modified DHCPDI SCOVER message is the IP address of the DHCP server and the destination MAC address is the MAC address of the DHCP server.
- Step 306 After receiving the DHCPDI SCOVER message, the DHCP server allocates an IP address that has not been allocated to the communication device from the IP address range of the communication device, and temporarily marks the assigned IP address as unavailable. use.
- Step 307 The DHCP server returns a DHCPOFFER (DHCP Provisioning) message to the communication device by using the switch, where the DHCPOFFER message includes an assigned IP address.
- DHCPOFFER DHCP Provisioning
- Step 308 After receiving the DHCPOFFER message, the communication device sends a DHCPREQUEST packet including the IP address in a broadcast manner.
- Step 309 The switch receives the DHCPREQUEST message, and uses the received routing indication information to determine that the DHCPREQUEST packet is a DHCP message sent by the broadcast, and then the destination MAC address of the DHCPREQUEST message is Replacing the MAC address of the DHCP server in the routing indication information, and replacing the destination IP address of the DHCP REQUEST message with the IP address of the DHCP server in the routing indication information;
- Step 310 The switch forwards the modified DHCPREQUEST packet.
- Figure 3 to broadcast DHCP allocation IP process (example 1)
- the message is then routed directly to the DHCP server.
- Step 311 The DHCP server returns a DHCPACK (DHCP acknowledgment) message to the communication device by using the switch, where the DHCP ACK includes the IP address and configuration parameters of the IP address.
- DHCPACK DHCP acknowledgment
- the communication device After receiving the DHCPACK packet containing the configuration parameter, the communication device uses the ARP packet to detect whether other network devices on the network are using the IP address. If it is confirmed that no other network device is using the IP address on the network, the communication device accepts the IP address and its configuration parameters, and if it is found that other network devices are using the IP address, the communication device sends the IP address to the DHCP server. DHCPDECLINE message, and resend the DHCPDISC0VER message to apply for an IP address. After receiving the DHCPDECLINE message, the DHCP server marks the IP address as unavailable.
- Step 312 When the communication device no longer needs to use the IP address, the device may actively send a DHCPRELEASE message to the DHCP server to release the IP address.
- FIG. 5 is a schematic flowchart of a method according to Embodiment 2 of the present invention. The method of Embodiment 2 of the present invention can be applied to the communication system shown in FIG. 1 or FIG.
- the switch forwards all DHCP messages sent by the communication device accessing the switch to the controller, and the controller provides a DHCP service for the communication device (if the IP address is assigned to the communication device, the switch does not The communication device provides configuration parameters of the assigned IP address, releases the assigned IP address, etc.).
- Step 410 A communications device sends a packet to a switch accessed by the communications device;
- Step 420 The switch forwards the DHCP message to a controller that communicates with the switch when determining that the packet is a DHCP message.
- the DHCP message may be specifically DHCPDISC0VER 4, DHCPREQUEST 4 or
- Step 430 The controller provides a DHCP service for the communication device according to the DHCP message. Specifically, when the DHCP message is a DHCPDISC0VER message, the controller allocates an IP address to the communication device; when the DHCP message is a DHCPREQUEST message, the controller sends the message to the communication The device provides configuration parameters for the IP address assigned to the communication device; when the 0? When the message is 0 ⁇ ?1 ⁇ 1 ⁇ £4, the controller releases the IP address assigned to the communication device.
- the switch may further include: the switch receiving the indication information sent by the controller, where the indication information is used to instruct the switch to forward the received DHCP message to the controller.
- the step 420 specifically includes: the switch performing, according to the indication information, an operation of forwarding the DHCP message to the controller when determining that the packet is a DHCP message.
- the switch when the communication device accesses the switch through a port on the switch, the switch sends a port number of the port to the controller.
- the step 430 may include: the controller constructs a DHCP message including data corresponding to the DHCP service, and encapsulates the constructed DHCP message and the port number into a data packet and sends the packet to the switch. And sending, by the switch, the DHCP message carried by the data packet to the communication device by using the port identified by the port number in the data packet.
- the DHCP message configured by the controller is a DHCPOFFER message
- the DHCPOFFER message includes the data corresponding to the DHCP service.
- the DHCP message constructed by the controller is a DHCPACK message
- the data corresponding to the DHCP service included in the DHCPACK message includes configuration parameters of an IP address allocated by the controller for the communication device.
- the switch when the switch receives the DHCP message sent by the communication device, the DHCP message is forwarded to a controller that communicates with the switch, so that the controller is configured according to the
- the DHCP message provides a DHCP service for the communication device. Therefore, the DHCP message is sent only to the controller, and the controller provides the DHCP service to the communication device instead of broadcasting the message to all network devices in the broadcast range, thereby solving the problem in the prior art. Broadcaster The problem of a large amount of network resource consumption caused by sending DHCP messages to all network devices in the broadcast range, and the problem of the performance of the server that does not need to receive the DHCP message.
- Embodiment 2 of the present invention will be described in detail below with reference to FIG.
- Step 501 When the communication device accesses the switch through a port on the switch, the switch sends the port number of the port to a controller that communicates with the switch.
- the switch and the controller can communicate through the openf low protocol.
- Step 502 The controller sends indication information to each switch that communicates with the controller, where the indication information is used to instruct the switch to forward the received DHCP message to the controller.
- the indication information may be specifically an ope nf low flow table, as shown in Table 2:
- the condition set by the matching field is a condition that the DHCP message needs to meet;
- the action set in the action field includes: forwarding the message satisfying the condition to the controller.
- the switch forwards the HDCP packet when it determines that the received packet meets the condition set by the matching domain, that is, when the received packet is a DHCP packet. Give the controller.
- the fields of the matching domain include the transport layer source port number (tp_src), the transport layer destination port number (tp_ds t ), the data link layer packet type (d l _ type ), and the network layer protocol type.
- the packet is a DHCP packet.
- the value "cont rol ler" of the act ions field of the action field in Table 2 is used to indicate that the message satisfying the condition is forwarded to the controller.
- Step 503 The communication device sends a DHCPDISCOVER message in a broadcast manner.
- the DHCP messages sent by the communication device are all sent by a DHCP client installed on the communication device. Specifically, when the DHCP client starts, the DHCP client The client broadcasts DHCPDI SC0VER 4 in the subnet where the communication device is located.
- the DHCPDI SC0VER 4 text is used to apply for an IP address.
- the DHCPDI SC0VER 4 message is used to apply for an IP address.
- Step 504 The switch receives the DHCPDI SC0VER, according to the indication information - determining the DHCPDI SC
- the switch determines that the DHCPDI SC0VER message satisfies the condition of the matching field of the flow table in Table 2, the DHCPDI SC0VER is forwarded to the controller.
- the switch encapsulates the DHCPDI SC0VER 4 by using the openf low protocol, and sends the encapsulated DHCPDI SC0VER 4 message to the controller through a secure channel between the switch and the controller (secure channe l ). .
- Step 505 The controller allocates an available IP to the communication device according to the allocation algorithm, constructs a DHCPOFFER message including the IP address, and encapsulates the DHCPOFFER message and the port number received in step 301 in the data packet.
- the data may specifically be a send-packe t message of the openf low protocol.
- Step 506 The controller sends the data packet to the switch.
- Step 507 The switch sends the DHCPOFFER message carried by the data packet to the communication device by using the port identified by the port number in the data packet.
- Step 508 After receiving the DHCPOFFER message, the communication device sends a DHCPREQUEST packet including the IP address in a broadcast manner.
- Step 509 The switch receives the DHCPREQUEST packet, and performs an operation of forwarding the DHCPREQUEST packet to the controller when determining that the DHCPREQUEST packet is a DHCP message according to the indication information.
- the switch determines that the DHCPREQUEST message satisfies the condition of the matching field of the flow table in Table 2, and forwards the DHCPREQUEST message to the controller.
- the switch encapsulates the DHCPREQUEST 4 by using the openf low protocol, and the A secure channel between the switch and the controller sends the encapsulated DHCPREQUEST message to the controller.
- Step 510 The controller constructs a DHCPACK packet, and encapsulates the DHCPACK packet and the port number in a data packet and sends the packet to the switch, where the DHCPACK packet includes the IP address and the IP address.
- Step 511 The controller sends the data packet generated in step 510 to the switch.
- Step 512 After receiving the data packet, the switch sends the DHCPACK message carried by the data packet to the communication device by using the port identified by the port number in the data packet.
- the communication device receives the DHCPACK packet containing the configuration parameter, and uses the ARP packet to detect whether the other network device on the network is using the IP address. If it is confirmed that no other network device is using the IP address on the network, the communication device accepts the IP address and its configuration parameters. If another network device is found to be using the IP address, the communication device sends a DHCPDECLINE message and resends the DHCPDI SC0VER 4 message requesting an IP address. After receiving the DHCPDECLINE message, the switch uses the received indication information to determine that the DHCPDECLINE message is a DHCP message, and forwards the DHCPDECLINE message to the controller, where the controller After receiving the DHCPDECLINE message, the IP address is marked as unavailable.
- Embodiment 3 of the present invention proposes a switch 500.
- the switch 500 includes: a receiving unit 501, a processing unit 502, and a routing unit 503.
- the receiving unit 501 is configured to receive the packet sent by the communication device that accesses the switch, and is further configured to send the received packet to the processing unit 502.
- the processing unit 502 is configured to receive the packet from the receiving unit 501, and obtain a routing address of the DHCP server corresponding to the communication device when the packet is determined to be a DHCP message sent by the broadcast, and the DHCP message is sent.
- the broadcast address of the destination address field is replaced with the routing address of the DHCP server, and the modified DHCP message is sent to the routing unit 503;
- the routing unit 503 is configured to receive, by the processing unit 502, the modified DHCP message, and route the modified DHCP message according to the routing address in the modified DHCP message to the
- the routing address of the DHCP server includes an IP address and a MAC address of the DHCP server; and the processing unit 502 is configured to: broadcast a destination address field of the DHCP message
- the replacement of the routing address of the DHCP server includes: the processing unit 502 is configured to replace the broadcast IP address of the destination IP address field of the DHCP message with the IP address of the DHCP server, and the DHCP message is The broadcast MAC address of the destination MAC address field is replaced with the MAC address of the DHCP server.
- the receiving unit may be further configured to receive routing indication information sent by a controller that is in communication with the switch, where the routing indication information includes a routing address of the DHCP server, and is used to indicate that the switch will receive the broadcast mode.
- the routing information of the DHCP server is sent to the DHCP server.
- the processing unit 502 is configured to acquire the route of the DHCP server corresponding to the communication device when the packet is determined to be a DHCP message sent by the broadcast mode.
- the address, the broadcast address of the destination address field of the DHCP message is replaced with the routing address of the DHCP server, and the processing unit 502 is configured to obtain the routing address of the DHCP server from the routing indication information, and And replacing the broadcast address of the destination address field of the DHCP message with the routing address of the DHCP server according to the routing indication in the routing indication information.
- the switch may further include an access unit, configured to send an identifier of the communication device to the controller after the communication device accesses the switch;
- the routing indication information further includes an identifier of the communication device Mapping relationship of a routing address of the DHCP server, where the routing instruction is specific For instructing the switch to route the DHCP message sent by the communication device to the DHCP server;
- the processing unit 502 is configured to obtain a routing address of the DHCP server corresponding to the communication device, Specifically, the processing unit 502 is configured to obtain the identifier of the communications device from the DHCP packet, and obtain a routing address of the DHCP server corresponding to the identifier of the communications device according to the mapping relationship in the routing indication information. .
- Embodiment 4 of the present invention proposes a controller 600.
- the controller 600 includes: a generating unit 601 and a transmitting unit 602.
- the generating unit 601 is configured to generate routing indication information, where the routing indication information includes a routing address of the DHCP server, and a routing instruction for instructing the switch to route the received DHCP message sent by the switch to the DHCP server, and use the route indication
- the routing indication information is sent to the sending unit 602.
- the routing address of the DHCP server may specifically include an IP address and a MAC address of the DHCP server.
- the sending unit 602 is configured to receive the routing indication information from the generating unit 601, and is further configured to send the routing indication information to a switch that communicates with the controller, so that the switch receives the DHCP sent by the broadcast mode. And sending, by the DHCP server, the DHCP message to the DHCP server according to the routing address of the DHCP server in the routing indication information.
- the controller may further include a receiving unit, configured to receive an identifier of the communications device that is sent by the switch when the communications device accesses the switch, and configured to send the identifier of the communications device to the determining a generating unit 601, configured to receive an identifier of the communications device from the receiving unit, and determine a DHCP server corresponding to the communications device; and correspondingly, the routing indication information generated by the generating unit 601 further includes communications The mapping between the identifier of the device and the routing address of the DHCP server, where the routing indication is specifically used to instruct the switch to route the DHCP message sent by the communication device to the DHCP server, When the switch receives the DHCP message including the identifier of the communication device, the switch obtains the routing address of the DHCP server according to the mapping relationship and according to the route of the DHCP server.
- a receiving unit configured to receive an identifier of the communications device that is sent by the switch when the communications device accesses the switch, and configured to send the identifier of
- Embodiment 5 of the present invention proposes a switch 700.
- the switch 700 includes: a receiving unit 701 and a forwarding unit 702.
- the receiving unit 701 is configured to receive a packet sent by the communication device that accesses the switch, and send the packet to the forwarding unit 702.
- the forwarding unit 702 is configured to receive the packet from the receiving unit 701, and determine that the packet is
- the DHCP message is forwarded to the controller in communication with the switch, so that the controller provides a DHCP service for the communication device according to the DHCP message.
- the receiving unit 701 is further configured to receive the indication information that is sent by the controller, where the indication information is used to instruct the switch to forward the received DHCP message to the controller.
- the forwarding unit 702 is specifically configured to The indication information performs an operation of forwarding the DHCP message to the controller when determining that the message is a DHCP message.
- the switch may further include an access unit, configured to send a port number of the port to the controller when the communication device accesses the switch through a port on the switch; and the receiving unit 701 further uses And receiving the data packet that is sent by the controller and carrying the DHCP packet and the port number, and sending the data packet to the forwarding unit 702.
- the forwarding unit 702 is further configured to receive from the receiving unit 701. Sending, by the data packet, the DHCP message carried by the data packet to the communication device by using the port identified by the port number in the data packet.
- Embodiment 6 of the present invention proposes a controller 800. As shown in FIG.
- the controller 800 includes: a transmitting unit 801, a receiving unit 802, and a service unit 803.
- the sending unit 801 is configured to send, to the switch that communicates with the controller, the indication information, where the indication information is used to instruct the switch to forward the received DHCP message to the controller;
- the receiving unit 802 is configured to receive, by the switch, the DHCP message forwarded to the controller when the packet received by the communication device that accesses the switch is a DHCP message according to the indication information, and is used by the switch Sending the DHCP message to the service unit 803;
- a service unit 803 configured to receive the DHCP message from the receiving unit 802, and used to The DHCP message provides a DHCP service for the communication device.
- the receiving unit 802 is further configured to receive, by the switch, a port number of the port that is sent when the communications device accesses the switch through a port on the switch, and send the port number to the service unit. 803; Correspondingly, the service unit 803 is further configured to receive the port number from the receiving unit 802.
- the service unit 803 is configured to provide the DHCP service to the communication device according to the DHCP message, and the method includes: the service unit 803 is configured to construct a DHCP message including data corresponding to the DHCP service, and the configured DHCP message and the The port number is encapsulated into the data packet, and is used to send the data packet to the sending unit 801.
- the sending unit 801 is further configured to receive the data packet from the service unit 803, and send the data packet to the switch, so that the switch identifies by using a port number in the data packet.
- the port sends the DHCP packet carried by the data packet to the communication device.
- Embodiment 7 of the present invention provides a switch 1000. As shown in FIG. 11, the switch 1000 includes a processor 1010 and a memory 1020, wherein the communication between the processor 1010 and the memory 1020 is completed by a bus.
- the memory 1020 is configured to store computer operation instructions.
- the memory 1020 may include a high speed RAM memory and may also include a non-volatile memory such as at least one disk memory.
- the processor 1010 is configured to execute computer operation instructions stored in the memory 1020.
- the processor 1010 may specifically be a central processing unit (CPU) and is a computer core unit.
- the processor 1010 executes the computer operation instruction, so that the switch 1000 performs the following operations: receiving a message sent by the communication device of the access switch 1000;
- the modified DHCP packet is routed to the DHCP server according to the routing address in the modified DHCP packet.
- the routing address of the DHCP server may include the IP address and the MAC address of the DHCP server.
- the broadcast address of the destination address field of the DHCP message is replaced with the routing address of the DHCP server.
- the method may include: replacing the broadcast IP address of the destination IP address field of the DHCP message with the IP address of the DHCP server, and replacing the broadcast MAC address of the destination MAC address field of the DHCP message with the DHCP The MAC address of the server.
- the processor 1010 executing the computer operation instructions may further cause the switch 1000 to perform the following operations: receiving routing indication information sent by a controller in communication with the switch 1000, the routing indication information including a routing address of the DHCP server, and Instructing the switch 1000 to route the received broadcasted DHCP message to the routing indication of the DHCP server.
- the obtaining the routing address of the DHCP server corresponding to the communication device, and replacing the broadcast address of the destination address field of the DHCP packet with the routing address of the DHCP server specifically includes: Obtaining, by the information, the routing address of the DHCP server, and replacing the broadcast address of the destination address field of the DHCP packet with the routing address of the DHCP server according to the routing indication in the routing indication information.
- Executing the computer operating instructions by the processor 1010 may further cause the switch 1000 to perform the following operations: transmitting an identification of the communication device to the controller after the communication device accesses the switch 1000.
- the routing indication information further includes a mapping relationship between the identifier of the communication device and a routing address of the DHCP server; the routing indication is specifically used to indicate that the switch 1000 will receive the broadcast device from the communication device.
- the DHCP message is routed to the DHCP server.
- the obtaining the routing address of the DHCP server corresponding to the communication device includes: obtaining the identifier of the communication device from the DHCP packet, and according to the routing indication information
- the mapping relationship in the obtaining the routing address of the DHCP server corresponding to the identifier of the communication device includes: obtaining the identifier of the communication device from the DHCP packet, and according to the routing indication information.
- Embodiment 8 of the present invention provides a controller 2000.
- the controller 2000 includes a processor (proces sor) 2010 and a memory 2020, wherein the communication between the processor 2010 and the memory 2020 is completed by a bus.
- the memory 2020 is configured to store computer operation instructions.
- Memory 2020 may include high speed RAM memory and may also include non-volatile memory, such as at least one disk memory.
- the processor 2010 is configured to execute computer operation instructions stored in the memory 2020.
- the processor 2010 may specifically be a central processing unit (CPU, cent ra l proces s ing uni t ) and is a computer core unit.
- the processor 2010 executes the computer operation instruction, so that the controller 2000 performs the following operations: generating routing indication information, where the routing indication information includes a routing address of the DHCP server, and a DHCP for indicating that the switch will receive the broadcast.
- the routing address of the DHCP server may include an IP address and a MAC address of the DHCP server; and sending the routing indication information to a switch that communicates with the controller 2000, so that When receiving the DHCP message sent by the broadcast, the switch routes the DHCP message to the DHCP server according to the routing address of the DHCP server in the routing indication information.
- the processor 2010 executing the computer operation instructions may further cause the controller 2000 to perform the following operations: receiving an identifier of the communication device sent by the switch when the communication device accesses the switch, and determining the communication device The corresponding DHCP server.
- the routing indication information further includes a mapping relationship between the identifier of the communication device and the routing address of the DHCP server, where the routing indication is specifically used to indicate that the switch will receive the broadcast mode from the communication device.
- the DHCP message is routed to the DHCP server, so that: the switch acquires the DHCP server according to the mapping relationship when receiving the DHCP message that is sent by the communication device and includes the identifier of the communication device.
- Embodiment 9 of the present invention provides a switch 3000.
- the switch 3000 includes a processor (proces sor) 3010 and a memory 3020, wherein the communication between the processor 3010 and the memory 3020 is completed by a bus.
- the memory 3020 is configured to store computer operation instructions.
- the memory 3020 may include a high speed RAM memory and may also include a non-volatile memory, such as at least one disk memory.
- the processor 3010 is configured to execute computer operation instructions stored in the memory 3020.
- the processor 3010 may specifically be a central processing unit (CPU, cent ra l proces s ing uni t ) and is a computer core unit.
- the processor 3010 executes the computer operation instruction, so that the switch 3000 performs the following operations: receiving a message sent by the communication device of the access switch 3000; and forwarding the DHCP message to the DHCP message when determining that the message is a DHCP message A controller in communication with the switch 3000 to cause the controller to provide a DHCP service to the communication device according to the DHCP message.
- the executing the computer operation instruction by the processor 3010 may further enable the switch 3000 to perform the following operations: receiving the indication information sent by the controller, where the indication information is used to instruct the switch 3000 to forward the received DHCP message to the controller .
- the processor 3010 executes the computer operation instruction to cause the switch 3000 to perform an operation of forwarding the DHCP message to the controller when determining that the message is a DHCP message according to the indication information.
- the processor 3010 executing the computer operation instructions may further cause the switch 3000 to perform the following operations: when the communication device accesses the switch 3000 through a port on the switch 3000, send the port number of the port to the controller; And sending, by the controller, the DHCP packet carrying the DHCP packet and the port number to the DHCP message carried by the data packet by using the port identified by the port number in the data packet Said communication device.
- Embodiment 10 of the present invention provides a controller 4000.
- the controller 4000 includes a processor 4010 and a memory 4020, wherein communication between the processor 4010 and the memory 4020 is accomplished by a bus.
- the memory 4020 is configured to store computer operation instructions.
- the memory 4020 may include a high speed RAM memory and may also include a non-volatile memory such as at least one disk memory.
- the processor 4010 is configured to execute computer operation instructions stored in the memory 4020.
- the processor 4010 may specifically be a central processing unit (CPU, cent ra l proces s ing uni t ) and is a computer core unit.
- the processor 4010 executes the computer operation instruction, so that the controller 4000 performs the following operations: sending indication information to the switch that communicates with the controller 4000, the indication information is used to instruct the switch to forward the received DHCP message to the control. And receiving, by the switch, the DHCP message forwarded to the controller 4000 when the packet received by the communication device that accesses the switch is a DHCP message according to the indication information; and the DHCP message according to the DHCP message A DHCP service is provided for the communication device.
- the processor 4010 executing the computer operation instructions may further cause the controller 4000 to perform the following operations: receiving a port number of the port sent by the switch when the communication device accesses the switch through a port on the switch
- the providing the DHCP service to the communication device according to the DHCP message specifically includes: constructing a DHCP message including data corresponding to the DHCP service, and encapsulating the constructed DHCP message and the port number into the datagram
- the message is sent to the switch, so that the switch sends the DHCP message carried by the data packet to the communication device by using the port identified by the port number in the data packet.
- Embodiment 11 of the present invention proposes a communication system 5000. As shown in FIG.
- the communication system 5000 includes a controller 5010 and a switch 5020, wherein the controller 5010 communicates with the switch 5020 through a network.
- the controller 5010 is configured to generate routing indication information, where the routing indication information includes a DHCP service. And the route indication of the router, and the route indication that is sent to the DHCP server by the switch to be sent by the switch to the switch 5020;
- the switch 5020 is configured to receive the packet sent by the communication device of the access switch 5020, and obtain the routing address of the DHCP server from the routing indication information when determining that the packet is a DHCP message sent by the broadcast mode. And replacing, according to the routing indication in the routing indication information, the broadcast address of the destination address field of the DHCP packet with the routing address of the DHCP server, and also according to the routing address in the modified DHCP packet.
- the modified DHCP message is routed to the DHCP server.
- the routing address of the DHCP server may include the IP address and the MAC address of the DHCP server.
- the switch 5020 is configured to replace the broadcast address of the destination address field of the DHCP packet with the routing address of the DHCP server.
- the switch 5020 is configured to replace the broadcast IP address of the destination IP address field of the DHCP message with the IP address of the DHCP server, and broadcast the MAC address of the destination MAC address field of the DHCP message. The address is replaced with the MAC address of the DHCP server.
- the switch 5020 can also be used to connect the controller to the switch 5020 after the communication device is connected.
- the controller 5010 is further configured to determine a DHCP server corresponding to the communication device, where the routing indication information generated by the controller 5010 further includes an identifier of the communication device and the DHCP server. a route mapping relationship, where the route indication is specifically used to instruct the switch 5020 to route the DHCP message sent by the communication device to the DHCP server; correspondingly, the switch 5020 is configured to acquire the communication.
- the routing address of the DHCP server corresponding to the device specifically includes: the switch 5020 is configured to obtain the identifier of the communication device from the DHCP packet, and obtain the identifier corresponding to the communication device according to the mapping relationship in the routing indication information. The routing address of the DHCP server.
- Embodiment 12 of the present invention provides a communication system 6000.
- the communication system 6000 includes a controller 6010 and a switch 6020, wherein the controller 6010 and the switch 6020 communicate through a network.
- the controller 6010 is configured to send the indication information to the switch 6020, where the indication information is used to instruct the switch 6020 to forward the received DHCP message to the controller 6010;
- the switch 6020 is configured to forward the DHCP message to the controller 6010 when determining that the message is a DHCP message according to the indication information;
- the controller 6010 is further configured to provide a DHCP service for the communication device according to the DHCP message.
- the switch 6020 may be further configured to: when the communication device accesses the switch 6020 through the port on the switch 6020, send the port number of the port to the controller 6010; the controller 6010 is configured according to the DHCP message.
- the communication device provides the DHCP service, and the controller 6010 constructs a DHCP message including the data corresponding to the DHCP service, and encapsulates the constructed DHCP message and the port number into the data packet and sends the message to the switch 6020. 6020.
- the method further sends the DHCP message carried by the data packet to the communication device by using a port identified by the port number in the data packet.
- Embodiment 12 of the present invention can be used to implement the method described in Embodiment 2 above.
- the disclosed systems, devices, and The method can be implemented in other ways.
- the device embodiments described above are merely illustrative.
- the division of the unit is only a logical function division.
- there may be another division manner for example, multiple units or components may be combined or Can be integrated into another system, or some features can be ignored, or not executed.
- the mutual coupling or direct coupling or communication connection shown or discussed may be an indirect coupling or communication connection through some interface, device or unit, and may be in an electrical, mechanical or other form.
- the components displayed for the unit may or may not be physical units, ie may be located in one place, or may be distributed over multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of the embodiment.
- each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.
- the functions, if implemented in the form of software functional units and sold or used as separate products, may be stored in a computer readable storage medium.
- the technical solution of the present invention which is essential or contributes to the prior art, or a part of the technical solution, may be embodied in the form of a software product, which is stored in a storage medium, including
- the instructions are used to cause a computer device (which may be a personal computer, server, or network device, etc.) to perform all or part of the steps of the methods described in various embodiments of the present invention.
- the foregoing storage medium includes: a USB flash drive, a removable hard disk, a read-only memory (ROM), a random access memory (RAM, Random Acces s Memory), a magnetic disk, or an optical disk, and the like, which can store program codes. medium.
Landscapes
- Engineering & Computer Science (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Small-Scale Networks (AREA)
- Data Exchanges In Wide-Area Networks (AREA)
Abstract
Disclosed are a method, device and system for dynamically allocating an IP address. The method comprises: a switch receiving a packet sent by a communication device which accesses the switch; when it is determined that the packet is a DHCP packet which is sent in a broadcasting manner, acquiring a routing address of a DHCP server corresponding to the communication device, and replacing a broadcasting address of a destination address field of the DHCP packet with the routing address of the DHCP server; and according to the routing address in the modified DHCP packet, routing the modified DHCP packet to the DHCP server. By means of the method, the DHCP packet can only be sent to the DHCP server rather than be broadcasted to all network devices within a broadcasting range, thereby solving the problem in the prior art that a large number of network resources are consumed due to the fact that the DHCP packet is sent to all the network devices within the broadcasting range in a broadcasting manner and the problem of high pressure placed on the performance of a server which need not receive the DHCP packet.
Description
一种动态分配 IP地址的方法、 装置和系统 技术领域 Method, device and system for dynamically allocating IP address
本发明实施例涉及网络技术领域, 并且更具体地, 涉及一种动态分配 IP 地址的方法、 装置和系统。 背景技术 Embodiments of the present invention relate to the field of network technologies, and, more particularly, to a method, apparatus, and system for dynamically allocating IP addresses. Background technique
网络中的通信设备在利用 TCP/ IP协议进行相互通信时,必须通过一个 IP 地址在网络上标识自己。 DHCP (Dynamic Hos t Conf igura t ion Protoco l , 动 态主机配置协议)是用于为通信设备分配 IP地址的一种协议。 Communication devices in the network must identify themselves on the network through an IP address when communicating with each other using the TCP/IP protocol. DHCP (Dynamic Hos t Conf s Protoco l) is a protocol for assigning IP addresses to communication devices.
在现有的利用 DHCP协议为通信设备分配 IP地址的技术中, 通信设备向 DHCP服务器发送的所有 DHCP报文都是采用广播方式发送的 ,如 DHCPDISCOVER ( DHCP发现)报文、 DHCPREQUEST ( DHCP请求)报文等。 因此, 在利用 DHCP 协议分配 IP地址的过程中会产生大量的广播报文, 从而大量消耗网络资源, 对网络环境造成一定的冲击; 另外, 这些广播报文会在二层内广播到广播范 围内的所有的网络设备, 而不仅仅是发送到需接收该报文的 DHCP服务器, 从 而对无需接收该报文的服务器的性能造成较大压力。 In the existing technology for allocating an IP address to a communication device by using a DHCP protocol, all DHCP messages sent by the communication device to the DHCP server are broadcasted, such as a DHCPDISCOVER message, and a DHCPREQUEST (DHCP request). Messages, etc. Therefore, in the process of allocating IP addresses by using the DHCP protocol, a large number of broadcast packets are generated, which consumes a large amount of network resources and has a certain impact on the network environment. In addition, these broadcast packets are broadcast to the broadcast range in the second layer. All of the network devices, not just the DHCP server that needs to receive the message, put a lot of pressure on the performance of the server that does not need to receive the message.
发明内容 本发明实施例提供一种动态分配 IP地址的方法、 装置和系统, 用于解决 现有技术中通过广播方式发送 DHCP报文所导致的大量消耗网络资源并对无需 接收该 DHCP报文的服务器的性能造成较大压力的问题。 SUMMARY OF THE INVENTION Embodiments of the present invention provide a method, an apparatus, and a system for dynamically allocating an IP address, which are used to solve the problem that a large amount of network resources are consumed by a DHCP message sent by a broadcast method in the prior art, and the DHCP message does not need to be received. The performance of the server creates a problem of greater stress.
第一方面, 提供了一种动态分配 IP地址的方法, 所述方法包括: 交换机接收接入所述交换机的通信设备发送的报文; The first aspect provides a method for dynamically allocating an IP address, where the method includes: receiving, by a switch, a packet sent by a communication device that accesses the switch;
所述交换机在确定所述报文为以广播方式发送的 DHCP报文时获取所述通 信设备对应的 DHCP服务器的路由地址, 并将所述 DHCP报文的目的地址字段 的广播地址替换为所述 DHCP服务器的路由地址; The switch obtains a routing address of the DHCP server corresponding to the communication device, and replaces the broadcast address of the destination address field of the DHCP message with the broadcast address, when the packet is determined to be a broadcast DHCP message. The routing address of the DHCP server;
所述交换机根据修改后的 DHCP报文中的路由地址将所述修改后的 DHCP
报文路由至所述 DHCP服务器。 The switch will modify the DHCP according to the routing address in the modified DHCP message. The message is routed to the DHCP server.
在第一方面的第一种可能的实现方式中, 所述 DHCP服务器的路由地址包 括所述 DHCP服务器的 IP地址和 MAC地址; 所述交换机将所述 DHCP ^艮文的目 的地址字段的广播地址替换为所述 DHCP服务器的路由地址, 具体包括: 所述 交换机将所述 DHCP报文的目的 IP地址字段的广播 IP地址替换为所述 DHCP 服务器的 IP地址, 并将所述 DHCP报文的目的 MAC地址字段的广播 MAC地址 替换为所述 DHCP服务器的 MAC地址。 In a first possible implementation manner of the first aspect, the routing address of the DHCP server includes an IP address and a MAC address of the DHCP server, and the switch sends a broadcast address of the destination address field of the DHCP message The routing address of the DHCP server is replaced by: the switch replaces the broadcast IP address of the destination IP address field of the DHCP packet with the IP address of the DHCP server, and uses the destination of the DHCP packet. The broadcast MAC address of the MAC address field is replaced with the MAC address of the DHCP server.
结合第一方面或第一方面的第一种可能的实现方式 ,在第二种可能的实 现方式中, 所述交换机获取所述 DHCP服务器的路由地址之前还包括, 所述交 换机接收与所述交换机通信的控制器发送的路由指示信息, 所述路由指示信 息包括所述 DHCP服务器的路由地址、 以及用于指示所述交换机将接收的以广 播方式发送的 DHCP报文路由至所述 DHCP服务器的路由指示; 所述获取所述 通信设备对应的 DHCP服务器的路由地址, 并将所述 DHCP报文的目的地址字 段的广播地址替换为所述 DHCP服务器的路由地址, 具体包括: 从所述路由指 示信息中获取所述 DHCP服务器的路由地址, 并根据所述路由指示信息中的路 由指示将所述 DHCP报文的目的地址字段的广播地址替换为所述 DHCP服务器 的路由地址。 With reference to the first aspect, or the first possible implementation manner of the first aspect, in a second possible implementation manner, before the acquiring the routing address of the DHCP server, the switch further includes: the switch receiving the switch Route indication information sent by the controller of the communication, the route indication information includes a routing address of the DHCP server, and a route for instructing the switch to route the received DHCP message sent by the switch to the DHCP server. And the step of: obtaining the routing address of the DHCP server corresponding to the communication device, and replacing the broadcast address of the destination address field of the DHCP packet with the routing address of the DHCP server, specifically: The routing address of the DHCP server is obtained, and the broadcast address of the destination address field of the DHCP packet is replaced with the routing address of the DHCP server according to the routing indication in the routing indication information.
结合第一方面的第二种可能的实现方式 ,在第三种可能的实现方式中, 所述交换机接收与所述交换机通信的控制器发送的路由指示信息之前还包 括: 所述交换机在所述通信设备接入所述交换机后向所述控制器发送所述通 信设备的标识; 所述路由指示信息还包括所述通信设备的标识与所述 DHCP服 务器的路由地址的映射关系; 所述路由指示具体用于指示所述交换机将接收 自所述通信设备的以广播方式发送的 DHCP报文路由至所述 DHCP服务器; 所 述获取所述通信设备对应的 DHCP服务器的路由地址具体包括, 从所述 DHCP 报文中获取所述通信设备的标识, 并根据所述路由指示信息中的映射关系获 取所述通信设备的标识对应的所述 DHCP服务器的路由地址。 With reference to the second possible implementation of the first aspect, in a third possible implementation, before the switch receives the routing indication information sent by the controller that communicates with the switch, the method further includes: After the communication device accesses the switch, the identifier of the communication device is sent to the controller; the routing indication information further includes a mapping relationship between the identifier of the communication device and a routing address of the DHCP server; Specifically, the switch is configured to: route, by the switch, a DHCP message sent by the communication device to the DHCP server, where the routing address of the DHCP server corresponding to the communication device is specifically included, Acquiring the identifier of the communication device in the DHCP message, and acquiring the routing address of the DHCP server corresponding to the identifier of the communication device according to the mapping relationship in the routing indication information.
结合第一方面、 第一方面的第一种至第三种任一可能的实现方式 ,在第
四种可能的实现方式中, 所述 DHCP报文具体为 DHCP发现报文或 DHCP请求报 文。 In combination with the first aspect, the first to the third possible implementation of the first aspect, In the four possible implementation manners, the DHCP packet is specifically a DHCP discovery packet or a DHCP request packet.
第二方面, 提供了一种动态分配 IP地址的方法, 所述方法包括: 控制器生成路由指示信息, 所述路由指示信息包括 DHCP服务器的路由地 址、 以及用于指示交换机将接收的以广播方式发送的 DHCP 报文路由至所述The second aspect provides a method for dynamically allocating an IP address, where the method includes: the controller generates routing indication information, where the routing indication information includes a routing address of the DHCP server, and is used to indicate that the switch will receive the broadcast mode. The sent DHCP message is routed to the
DHCP服务器的路由指示; Routing indication of the DHCP server;
所述控制器向与所述控制器通信的交换机发送所述路由指示信息, 以使 得所述交换机在接收到以广播方式发送的 DHCP报文时, 根据所述路由指示信 息中的所述 DHCP服务器的路由地址将所述 DHCP报文路由至所述 DHCP服务器。 在第二方面的第一种可能的实现方式中, 所述控制器生成路由指示信息 之前还包括: 所述控制器接收所述交换机在所述通信设备接入所述交换机时 发送的所述通信设备的标识, 并确定所述通信设备所对应的 DHCP服务器; 所 述路由指示信息还包括通信设备的标识与所述 DHCP服务器的路由地址的映射 关系, 所述路由指示具体用于指示所述交换机将接收自所述通信设备的以广 播方式发送的 DHCP报文路由至所述 DHCP服务器, 以使得: 所述交换机在接 收到所述通信设备发送的包含所述通信设备的标识的所述 DHCP报文时, 根据 所述映射关系获取所述 DHCP服务器的路由地址并根据所述 DHCP服务器的路 由地址将所述 DHCP报文路由至所述 DHCP服务器。 The controller sends the routing indication information to a switch that communicates with the controller, so that when the switch receives the DHCP message sent by the broadcast, according to the DHCP server in the routing indication information The routing address routes the DHCP message to the DHCP server. In a first possible implementation manner of the second aspect, before the generating the routing indication information by the controller, the method further includes: the controller receiving the communication that is sent by the switch when the communications device accesses the switch An identifier of the device, and determining a DHCP server corresponding to the communication device; the routing indication information further includes a mapping relationship between the identifier of the communication device and a routing address of the DHCP server, where the routing indication is specifically used to indicate the switch Routing the DHCP message sent from the communication device to the DHCP server, so that: the switch receives the DHCP message that is sent by the communication device and includes the identifier of the communication device. And obtaining the routing address of the DHCP server according to the mapping relationship, and routing the DHCP packet to the DHCP server according to the routing address of the DHCP server.
结合第二方面或第二方面的第一种可能的实现方式 ,在第二种可能的实 现方式中,所述 DHCP服务器的路由地址包括所述 DHCP服务器的 IP地址和 MAC 地址。 第三方面, 提供了一种动态分配 IP地址的方法, 所述方法包括: 交换机接收接入所述交换机的通信设备发送的报文; In conjunction with the second aspect or the first possible implementation of the second aspect, in a second possible implementation manner, the routing address of the DHCP server includes an IP address and a MAC address of the DHCP server. A third aspect provides a method for dynamically allocating an IP address, where the method includes: receiving, by a switch, a packet sent by a communication device that accesses the switch;
所述交换机在确定所述报文为 DHCP报文时将所述 DHCP报文转发至与所 述交换机通信的控制器, 以使得所述控制器根据所述 DHCP报文为所述通信设
备提供 DHCP服务。 When the switch determines that the packet is a DHCP message, the switch forwards the DHCP message to a controller that communicates with the switch, so that the controller sets the communication message according to the DHCP message. A DHCP service is available.
在第三方面的第一种可能的实现方式中, 所述交换机将所述 DHCP报文转 发至所述控制器之前还包括, 所述交换机接收所述控制器发送的指示信息, 所述指示信息用于指示所述交换机将接收的 DHCP报文转发至所述控制器; 所 述交换机根据所述指示信息执行在确定所述报文为 DHCP报文时将所述 DHCP 报文转发至所述控制器的操作。 In a first possible implementation manner of the third aspect, before the switch forwarding the DHCP packet to the controller, the switch further includes: the switch receiving the indication information sent by the controller, where the indication information is And the switch is configured to forward the received DHCP message to the controller according to the indication information, and the switch performs, according to the indication information, forwarding the DHCP message to the control when determining that the packet is a DHCP message. Operation of the device.
结合第三方面或第三方面的第一种可能的实现方式 ,在第二种可能的实 现方式中, 所述方法还包括: 在所述通信设备通过所述交换机上的端口接入 所述交换机时, 所述交换机向所述控制器发送所述端口的端口号; 所述交换 机接收到所述控制器发送的携带 DHCP报文和所述端口号的数据报文时, 通过 所述数据报文中的端口号所标识的端口将所述数据报文携带的 DHCP报文发送 给所述通信设备。 第四方面, 提供了一种动态分配 IP地址的方法, 所述方法包括: 控制器向与所述控制器通信的交换机发送指示信息, 所述指示信息用于 指示所述交换机将接收的 DHCP报文转发至所述控制器; With reference to the third aspect, or the first possible implementation manner of the third aspect, in a second possible implementation manner, the method further includes: accessing, by the communication device, the switch by using a port on the switch The switch sends the port number of the port to the controller; when the switch receives the data packet that is sent by the controller and carries the DHCP packet and the port number, the switch passes the data packet. The port identified by the port number sends the DHCP packet carried in the data packet to the communication device. A fourth aspect provides a method for dynamically allocating an IP address, where the method includes: the controller sends indication information to a switch that communicates with the controller, where the indication information is used to indicate that the switch will receive the DHCP report. Forwarding to the controller;
所述控制器接收所述交换机根据所述指示信息在确定接收自接入所述交 换机的通信设备的报文为 DHCP报文时向所述控制器转发的所述 DHCP报文; 所述控制器根据所述 DHCP报文为所述通信设备提供 DHCP服务。 The controller receives the DHCP message forwarded by the switch to the controller when determining that the packet received by the communication device accessing the switch is a DHCP message according to the indication information; And providing a DHCP service to the communication device according to the DHCP message.
在第四方面的第一种可能的实现方式中, 所述方法还包括: 所述控制器 接收所述交换机在所述通信设备通过所述交换机上的端口接入所述交换机时 发送的所述端口的端口号; 所述控制器根据所述 DHCP报文为所述通信设备提 供 DHCP服务具体包括,所述控制器构造包括所述 DHCP服务对应的数据的 DHCP 报文, 并将构造的 DHCP报文和所述端口号封装到数据报文中发送给所述交换 机, 以使得所述交换机通过所述数据报文中的端口号所标识的端口将所述数 据报文携带的 DHCP报文发送给所述通信设备。
第五方面, 提供了一种交换机, 所述交换机包括: 接收单元、 处理单元 和路由单元; In a first possible implementation manner of the fourth aspect, the method further includes: the controller receiving, by the switch, when the communications device accesses the switch through a port on the switch The port number of the port; the controller providing the DHCP service to the communication device according to the DHCP message, specifically, the controller constructs a DHCP message including data corresponding to the DHCP service, and constructs a DHCP message. And the port number is encapsulated into a data packet and sent to the switch, so that the switch sends the DHCP packet carried by the data packet to the port identified by the port number in the data packet. The communication device. A fifth aspect provides a switch, where the switch includes: a receiving unit, a processing unit, and a routing unit;
所述接收单元, 用于接收接入所述交换机的通信设备发送的报文, 还用 于将接收的所述报文发送给所述处理单元; The receiving unit is configured to receive a packet sent by the communication device that accesses the switch, and is further configured to send the received packet to the processing unit;
所述处理单元, 用于从所述接收单元接收所述报文, 在确定所述报文为 以广播方式发送的 DHCP报文时获取所述通信设备对应的 DHCP服务器的路由 地址, 将所述 DHCP报文的目的地址字段的广播地址替换为所述 DHCP服务器 的路由地址, 并将修改后的 DHCP报文发送给所述路由单元; The processing unit is configured to receive the packet from the receiving unit, and obtain a routing address of a DHCP server corresponding to the communication device when the packet is determined to be a DHCP message sent by the broadcast device, where the The broadcast address of the destination address field of the DHCP packet is replaced with the routing address of the DHCP server, and the modified DHCP packet is sent to the routing unit.
所述路由单元, 用于从所述处理单元接收所述修改后的 DHCP报文, 根据 所述修改后的 DHCP ^艮文中的路由地址将所述修改后的 DHCP ^艮文路由至所述 DHCP服务器。 The routing unit is configured to receive the modified DHCP message from the processing unit, and route the modified DHCP message to the DHCP according to the routing address in the modified DHCP message server.
在第五方面的第一种可能的实现方式中, 所述 DHCP服务器的路由地址包 括所述 DHCP服务器的 IP地址和 MAC地址; 所述处理单元用于将所述 DHCP ¾ 文的目的地址字段的广播地址替换为所述 DHCP服务器的路由地址具体包括, 所述处理单元用于将所述 DHCP报文的目的 IP地址字段的广播 IP地址替换为 所述 DHCP服务器的 IP地址, 并将所述 DHCP报文的目的 MAC地址字段的广播 MAC地址替换为所述 DHCP 务器的 MAC地址。 In a first possible implementation manner of the fifth aspect, the routing address of the DHCP server includes an IP address and a MAC address of the DHCP server, and the processing unit is configured to: use the destination address field of the DHCP message The replacing the broadcast address with the routing address of the DHCP server includes: the processing unit is configured to replace the broadcast IP address of the destination IP address field of the DHCP packet with the IP address of the DHCP server, and the DHCP The broadcast MAC address of the destination MAC address field of the message is replaced with the MAC address of the DHCP server.
结合第五方面或第五方面的第一种可能的实现方式 ,在第二种可能的实 现方式中, 所述接收单元还用于接收与所述交换机通信的控制器发送的路由 指示信息, 所述路由指示信息包括所述 DHCP服务器的路由地址、 以及用于指 示所述交换机将接收的以广播方式发送的 DHCP报文路由至所述 DHCP服务器 的路由指示; 所述处理单元用于在确定所述报文为以广播方式发送的 DHCP报 文时获取所述通信设备对应的 DHCP服务器的路由地址, 将所述 DHCP报文的 目的地址字段的广播地址替换为所述 DHCP服务器的路由地址, 具体包括: 所 述处理单元用于从所述路由指示信息中获取所述 DHCP服务器的路由地址, 并 根据所述路由指示信息中的路由指示将所述 DHCP报文的目的地址字段的广播 地址替换为所述 DHCP服务器的路由地址。
结合第五方面的第二种可能的实现方式 ,在第三种可能的实现方式中, 所述交换机还包括接入单元; 所述接入单元, 用于在所述通信设备接入所述 交换机后向所述控制器发送所述通信设备的标识; 所述路由指示信息还包括 所述通信设备的标识与所述 DHCP服务器的路由地址的映射关系, 所述路由指 示具体用于指示所述交换机将接收自所述通信设备的以广播方式发送的 DHCP 报文路由至所述 DHCP 服务器; 所述处理单元用于获取所述通信设备对应的 DHCP服务器的路由地址, 具体包括: 所述处理单元用于从所述 DHCP报文中获 取所述通信设备的标识, 并根据所述路由指示信息中的映射关系获取所述通 信设备的标识对应的所述 DHCP服务器的路由地址。 第六方面, 提供了一种控制器, 所述控制器包括生成单元和发送单元; 所述生成单元, 用于生成路由指示信息, 所述路由指示信息包括 DHCP服 务器的路由地址、 以及用于指示交换机将接收的以广播方式发送的 DHCP报文 路由至所述 DHCP服务器的路由指示, 并用于将所述路由指示信息发送给所述 发送单元; With reference to the fifth aspect, or the first possible implementation manner of the fifth aspect, in a second possible implementation, the receiving unit is further configured to receive routing indication information sent by a controller that communicates with the switch, where The routing indication information includes a routing address of the DHCP server, and a routing indication for instructing the switch to route the received DHCP message to the DHCP server; the processing unit is configured to determine When the packet is a DHCP message, the routing address of the DHCP server corresponding to the communication device is obtained, and the broadcast address of the destination address field of the DHCP packet is replaced with the routing address of the DHCP server. The processing unit is configured to: obtain the routing address of the DHCP server from the routing indication information, and replace the broadcast address of the destination address field of the DHCP packet with the routing indication in the routing indication information. The routing address of the DHCP server. With reference to the second possible implementation manner of the fifth aspect, in a third possible implementation, the switch further includes an access unit, where the access unit is configured to access the switch in the communications device And sending the identifier of the communication device to the controller; the routing indication information further includes a mapping relationship between the identifier of the communication device and a routing address of the DHCP server, where the routing indication is specifically used to indicate the switch And transmitting, by the processing unit, the routing address of the DHCP server that is sent by the communication device to the DHCP server. The processing unit is configured to acquire a routing address of the DHCP server corresponding to the communication device, where the processing unit includes: Acquiring the identifier of the communication device from the DHCP message, and acquiring a routing address of the DHCP server corresponding to the identifier of the communication device according to the mapping relationship in the routing indication information. According to a sixth aspect, a controller is provided, where the controller includes a generating unit and a sending unit, and the generating unit is configured to generate routing indication information, where the routing indication information includes a routing address of the DHCP server, and is used for indicating The switch routes the received DHCP message sent by the broadcast to the routing instruction of the DHCP server, and sends the route indication information to the sending unit.
所述发送单元, 用于从所述生成单元接收所述路由指示信息, 还用于向 与所述控制器通信的交换机发送所述路由指示信息, 以使得所述交换机在接 收到以广播方式发送的 DHCP报文时, 根据所述路由指示信息中的所述 DHCP 服务器的路由地址将所述 DHCP报文路由至所述 DHCP服务器。 The sending unit is configured to receive the routing indication information from the generating unit, and is further configured to send the routing indication information to a switch that communicates with the controller, so that the switch receives the broadcast manner The DHCP message is routed to the DHCP server according to the routing address of the DHCP server in the routing indication information.
在第六方面的第一种可能的实现方式中, 所述控制器还包括接收单元; 所述接收单元, 用于接收所述交换机在所述通信设备接入所述交换机时发送 的所述通信设备的标识, 并用于将所述通信设备的标识发送给所述确定单元; 所述生成单元, 还用于从所述接收单元接收所述通信设备的标识, 并确定所 述通信设备所对应的 DHCP服务器; 所述生成单元生成的所述路由指示信息还 包括通信设备的标识与所述 DHCP服务器的路由地址的映射关系, 所述路由指 示具体用于指示所述交换机将接收自所述通信设备的以广播方式发送的 DHCP 报文路由至所述 DHCP服务器, 以使得: 所述交换机在接收到所述通信设备发
送的包含所述通信设备的标识的所述 DHCP报文时, 根据所述映射关系获取所 述 DHCP服务器的路由地址并根据所述 DHCP服务器的路由地址将所述 DHCP报 文路由至所述 DHCP服务器。 In a first possible implementation manner of the sixth aspect, the controller further includes a receiving unit, where the receiving unit is configured to receive the communication that is sent by the switch when the communications device accesses the switch An identifier of the device, and configured to send the identifier of the communication device to the determining unit, where the generating unit is further configured to receive an identifier of the communications device from the receiving unit, and determine, corresponding to the communications device The routing information generated by the generating unit further includes a mapping relationship between the identifier of the communications device and the routing address of the DHCP server, where the routing indication is specifically used to indicate that the switch is to be received from the communications device. The broadcasted DHCP message is routed to the DHCP server, so that: the switch receives the communication device When the DHCP message containing the identifier of the communication device is sent, the routing address of the DHCP server is obtained according to the mapping relationship, and the DHCP message is routed to the DHCP according to the routing address of the DHCP server. server.
结合第六方面或第六方面的第一种可能的实现方式 ,在第二种可能的实 现方式中,所述 DHCP服务器的路由地址包括所述 DHCP服务器的 IP地址和 MAC 地址。 第七方面, 提供了一种交换机, 所述交换机包括接收单元和转发单元; 所述接收单元, 用于接收接入所述交换机的通信设备发送的报文, 并将 所述报文发送给所述转发单元; In conjunction with the sixth aspect or the first possible implementation manner of the sixth aspect, in a second possible implementation manner, the routing address of the DHCP server includes an IP address and a MAC address of the DHCP server. According to a seventh aspect, a switch is provided, where the switch includes a receiving unit and a forwarding unit, and the receiving unit is configured to receive a packet sent by a communication device that accesses the switch, and send the packet to the Forwarding unit
所述转发单元, 用于从所述接收单元接收所述报文, 并在确定所述报文 为 DHCP报文时将所述 DHCP报文转发至与所述交换机通信的控制器, 以使得 所述控制器根据所述 DHCP报文为所述通信设备提供 DHCP服务。 The forwarding unit is configured to receive the packet from the receiving unit, and forward the DHCP packet to a controller that communicates with the switch when determining that the packet is a DHCP message, so that the The controller provides a DHCP service for the communication device according to the DHCP message.
在第七方面的第一种可能的实现方式中, 所述接收单元还用于接收所述 控制器发送的指示信息, 所述指示信息用于指示所述交换机将接收的 DHCP报 文转发至所述控制器; 所述转发单元具体用于根据所述指示信息执行在确定 所述报文为 DHCP报文时将所述 DHCP报文转发至所述控制器的操作。 In a first possible implementation manner of the seventh aspect, the receiving unit is further configured to receive the indication information sent by the controller, where the indication information is used to instruct the switch to forward the received DHCP message to the The forwarding unit is configured to perform, according to the indication information, an operation of forwarding the DHCP message to the controller when determining that the message is a DHCP message.
结合第七方面或第七方面的第一种可能的实现方式 ,在第二种可能的实 现方式中, 所述交换机还包括接入单元; 所述接入单元, 用于在所述通信设 备通过所述交换机上的端口接入所述交换机时, 向所述控制器发送所述端口 的端口号; 所述接收单元, 还用于接收所述控制器发送的携带 DHCP报文和所 述端口号的数据报文, 并将所述数据报文发送给所述转发单元; 所述转发单 元, 还用于从所述接收单元接收所述数据报文, 并通过所述数据报文中的端 口号所标识的端口将所述数据报文携带的 DHCP报文发送给所述通信设备。 第八方面, 提供了一种控制器, 所述控制器包括发送单元、 接收单元和 服务单元;
所述发送单元, 用于向与所述控制器通信的交换机发送指示信息, 所述 指示信息用于指示所述交换机将接收的 DHCP报文转发至所述控制器; With reference to the seventh aspect, or the first possible implementation manner of the seventh aspect, in a second possible implementation, the switch further includes an access unit, where the access unit is configured to pass the communication device When the port on the switch accesses the switch, the port number of the port is sent to the controller; the receiving unit is further configured to receive the DHCP packet sent by the controller and the port number Data packet, and the data packet is sent to the forwarding unit; the forwarding unit is further configured to receive the data packet from the receiving unit, and pass the port number in the data packet The identified port sends the DHCP packet carried by the data packet to the communication device. In an eighth aspect, a controller is provided, where the controller includes a sending unit, a receiving unit, and a service unit; The sending unit is configured to send, to the switch that communicates with the controller, the indication information, where the indication information is used to instruct the switch to forward the received DHCP message to the controller;
所述接收单元, 用于接收所述交换机根据所述指示信息在确定接收自接 入所述交换机的通信设备的报文为 DHCP报文时向所述控制器转发的所述 DHCP 报文, 并用于向所述服务单元发送所述 DHCP报文; The receiving unit is configured to receive, by the switch, the DHCP message that is forwarded to the controller when the packet received by the communication device that accesses the switch is a DHCP message according to the indication information, and is used by the switch. Sending the DHCP message to the service unit;
所述服务单元, 用于从所述接收单元接收所述 DHCP报文, 并用于根据所 述 DHCP报文为所述通信设备提供 DHCP服务。 The service unit is configured to receive the DHCP message from the receiving unit, and configured to provide a DHCP service for the communication device according to the DHCP message.
在第八方面的第一种可能的实现方式中, 所述接收单元, 还用于接收所 述交换机在所述通信设备通过所述交换机上的端口接入所述交换机时发送的 所述端口的端口号, 并用于将所述端口号发送给所述服务单元; 所述服务单 元还用于从所述接收单元接收所述端口号; 所述服务单元用于根据所述 DHCP 报文为所述通信设备提供 DHCP服务具体包括: 所述服务单元用于构造包括所 述 DHCP服务对应的数据的 DHCP报文, 将构造的 DHCP报文和所述端口号封装 到数据报文中, 并用于将所述数据报文发送给所述发送单元; 所述发送单元, 还用于从所述服务单元接收所述数据报文, 并用于将所述数据报文发送给所 述交换机, 以使得所述交换机通过所述数据报文中的端口号所标识的端口将 所述数据报文携带的 DHCP报文发送给所述通信设备。 第九方面, 提供了一种通信系统, 所述通信系统包括交换机和控制器, 所述交换机和所述控制器通过网络通信; In a first possible implementation manner of the eighth aspect, the receiving unit is further configured to receive, by the switch, the port that is sent when the communications device accesses the switch through a port on the switch a port number, and configured to send the port number to the service unit; the service unit is further configured to receive the port number from the receiving unit; the service unit is configured to use the DHCP message as the The providing the DHCP service by the communication device includes: the service unit is configured to construct a DHCP message including the data corresponding to the DHCP service, and the configured DHCP message and the port number are encapsulated into the data message, and are used for Sending the data packet to the sending unit; the sending unit is further configured to receive the data packet from the serving unit, and send the data packet to the switch, so that the switch Sending, by the port identified by the port number in the data packet, the DHCP packet carried by the data packet to the communication device. According to a ninth aspect, a communication system is provided, where the communication system includes a switch and a controller, and the switch and the controller communicate through a network;
所述控制器, 用于生成路由指示信息, 所述路由指示信息包括 DHCP服务 器的路由地址、 以及用于指示交换机将接收的以广播方式发送的 DHCP报文路 由至所述 DHCP服务器的路由指示, 还用于向所述交换机发送所述路由指示信 息; The controller is configured to generate routing indication information, where the routing indication information includes a routing address of the DHCP server, and a routing indication for instructing the switch to route the received DHCP message sent by the switch to the DHCP server. And is further configured to send the routing indication information to the switch;
所述交换机, 用于接收接入所述交换机的通信设备发送的报文, 在确定 所述报文为以广播方式发送的 DHCP报文时, 从所述路由指示信息中获取所述 DHCP服务器的路由地址, 并根据所述路由指示信息中的路由指示将所述 DHCP
报文的目的地址字段的广播地址替换为所述 DHCP服务器的路由地址, 还用于 根据修改后的 DHCP报文中的路由地址将所述修改后的 DHCP报文路由至所述 DHCP服务器。 The switch is configured to receive a packet sent by a communication device that accesses the switch, and obtain the DHCP server from the routing indication information when determining that the packet is a DHCP message sent by the broadcast mode. Routing the address, and according to the routing indication in the routing indication information, the DHCP The broadcast address of the destination address field of the packet is replaced with the routing address of the DHCP server, and is also used to route the modified DHCP packet to the DHCP server according to the routing address in the modified DHCP packet.
在第九方面的第一种可能的实现方式中, 所述 DHCP服务器的路由地址包 括所述 DHCP服务器的 IP地址和 MAC地址; 所述交换机用于将所述 DHCP ^艮文 的目的地址字段的广播地址替换为所述 DHCP服务器的路由地址, 具体包括: 所述交换机用于将所述 DHCP报文的目的 IP地址字段的广播 IP地址替换为所 述 DHCP 务器的 IP地址,并将所述 DHCP ^艮文的目的 MAC地址字段的广播 MAC 地址替换为所述 DHCP服务器的 MAC地址。 In a first possible implementation manner of the ninth aspect, the routing address of the DHCP server includes an IP address and a MAC address of the DHCP server, and the switch is configured to use the destination address field of the DHCP message The replacement of the broadcast address with the routing address of the DHCP server includes: the switch is configured to replace the broadcast IP address of the destination IP address field of the DHCP packet with the IP address of the DHCP server, and the The broadcast MAC address of the destination MAC address field of the DHCP message is replaced with the MAC address of the DHCP server.
结合第九方面或第九方面的第一种可能的实现方式 ,在第二种可能的实 现方式中, 所述交换机, 还用于在所述通信设备接入所述交换机后向所述控 制器发送所述通信设备的标识; 所述控制器, 还用于确定所述通信设备所对 应的 DHCP服务器, 所述控制器生成的所述路由指示信息还包括通信设备的标 识与所述 DHCP服务器的路由地址的映射关系, 所述路由指示具体用于指示所 述交换机将接收自所述通信设备的以广播方式发送的 DHCP 报文路由至所述 DHCP服务器;所述交换机用于获取所述通信设备对应的 DHCP服务器的路由地 址具体包括, 所述交换机用于从所述 DHCP报文中获取所述通信设备的标识, 并根据所述路由指示信息中的映射关系获取所述通信设备的标识对应的所述 DHCP服务器的路由地址。 第十方面, 提供了一种通信系统, 所述通信系统包括交换机和控制器, 所述交换机和所述控制器通过网络通信; With reference to the ninth aspect, or the first possible implementation manner of the ninth aspect, in a second possible implementation, the switch is further configured to: after the communications device accesses the switch Sending the identifier of the communication device; the controller is further configured to determine a DHCP server corresponding to the communication device, where the routing indication information generated by the controller further includes an identifier of the communication device and the DHCP server a routing address mapping relationship, where the routing indication is specifically used to instruct the switch to route a DHCP message sent by the communication device to the DHCP server; the switch is configured to acquire the communication device. The routing address of the corresponding DHCP server includes: the switch is configured to obtain the identifier of the communication device from the DHCP packet, and obtain the identifier corresponding to the identifier of the communication device according to the mapping relationship in the routing indication information. The routing address of the DHCP server. According to a tenth aspect, a communication system is provided, where the communication system includes a switch and a controller, and the switch and the controller communicate through a network;
所述控制器, 用于向所述交换机发送指示信息, 所述指示信息用于指示 所述交换机将接收的 DHCP报文转发至所述控制器; The controller is configured to send indication information to the switch, where the indication information is used to instruct the switch to forward the received DHCP message to the controller;
所述交换机, 用于根据所述指示信息在确定所述报文为 DHCP报文时将所 述 DHCP报文转发至所述控制器; The switch is configured to forward the DHCP message to the controller when determining that the packet is a DHCP message according to the indication information;
所述控制器, 还用于根据所述 DHCP报文为所述通信设备提供 DHCP服务。
在第十方面的第一种可能的实现方式中, 所述交换机, 还用于在所述通 信设备通过所述交换机上的端口接入所述交换机时, 向所述控制器发送所述 端口的端口号; 所述控制器根据所述 DHCP报文为所述通信设备提供 DHCP服 务具体包括, 所述控制器构造包括所述 DHCP服务对应的数据的 DHCP报文, 并将构造的 DHCP报文和所述端口号封装到数据报文中发送给所述交换机; 所 述交换机, 还用于通过所述数据报文中的端口号所标识的端口将所述数据报 文携带的 DHCP报文发送给所述通信设备。 The controller is further configured to provide a DHCP service for the communication device according to the DHCP message. In a first possible implementation manner of the tenth aspect, the switch is further configured to: when the communications device accesses the switch through a port on the switch, send the port to the controller The port number is provided by the controller to provide the DHCP service to the communication device according to the DHCP message, the controller includes: constructing a DHCP message including data corresponding to the DHCP service, and configuring the DHCP message and The port number is encapsulated into a data packet and sent to the switch; the switch is further configured to send the DHCP packet carried by the data packet to the port identified by the port number in the data packet. The communication device.
根据本发明实施例, 当所述交换机接收到所述通信设备以广播方式发送 的 DHCP报文时, 将所述 DHCP报文中的广播地址替换为所述通信设备对应的 According to the embodiment of the present invention, when the switch receives the DHCP message sent by the communication device in a broadcast manner, the broadcast address in the DHCP message is replaced with the corresponding address of the communication device.
DHCP服务器的路由地址, 因此仅向所述 DHCP服务器发送该 DHCP报文, 而不 是向广播范围内的所有网络设备广播该报文, 从而解决了现有技术中通过广 播方式向广播范围内的所有网络设备发送 DHCP报文所导致的大量消耗网络资 源的问题、以及对无需接收该 DHCP报文的服务器的性能造成较大压力的问题。 附图说明 为了更清楚地说明本发明实施例的技术方案, 下面将对实施例或现有技 术描述中所需要使用的附图作筒单地介绍, 显而易见地, 下面描述中的附图 仅仅是本发明的一些实施例, 对于本领域普通技术人员来讲, 在不付出创造 性劳动的前提下, 还可以根据这些附图获得其他的附图。 The routing address of the DHCP server is only sent to the DHCP server, instead of broadcasting the message to all network devices in the broadcast range, thereby solving all the broadcasts in the prior art. The problem that the network device sends a large amount of network resources caused by sending DHCP messages, and the performance of the server that does not need to receive the DHCP message is greatly stressed. BRIEF DESCRIPTION OF THE DRAWINGS In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings used in the embodiments or the prior art description will be briefly described below. Obviously, the drawings in the following description are merely Some embodiments of the present invention may also be used to obtain other drawings based on these drawings without departing from the prior art.
图 1是本发明实施例提供的一种通信系统的组网结构示意图; 1 is a schematic structural diagram of a networking of a communication system according to an embodiment of the present invention;
图 2是本发明实施例提供的一种基于 SDN的通信系统的组网结构示意图 图 3-4是本发明实施例 1提供的方法流程示意图; 2 is a schematic diagram of a networking structure of an SDN-based communication system according to an embodiment of the present invention; FIG. 3 is a schematic flowchart of a method provided by Embodiment 1 of the present invention;
图 5-6是本发明实施例 2提供的方法流程示意图; 5-6 is a schematic flowchart of a method provided by Embodiment 2 of the present invention;
图 7是本发明实施例 3提供的交换机的结构示意图; 7 is a schematic structural diagram of a switch according to Embodiment 3 of the present invention;
图 8是本发明实施例 4提供的控制器的结构示意图; 8 is a schematic structural diagram of a controller according to Embodiment 4 of the present invention;
图 9是本发明实施例 5提供的交换机的结构示意图; 9 is a schematic structural diagram of a switch according to Embodiment 5 of the present invention;
图 10是本发明实施例 6提供的控制器的结构示意图; FIG. 10 is a schematic structural diagram of a controller according to Embodiment 6 of the present invention; FIG.
图 11是本发明实施例 7提供的交换机的结构示意图;
图 12是本发明实施例 8提供的控制器的结构示意图; 11 is a schematic structural diagram of a switch according to Embodiment 7 of the present invention; FIG. 12 is a schematic structural diagram of a controller according to Embodiment 8 of the present invention; FIG.
图 1 3是本发明实施例 9提供的交换机的结构示意图; FIG. 13 is a schematic structural diagram of a switch according to Embodiment 9 of the present invention;
图 14是本发明实施例 10提供的控制器的结构示意图; 14 is a schematic structural diagram of a controller according to Embodiment 10 of the present invention;
图 15是本发明实施例 11提供的通信系统的结构示意图; 15 is a schematic structural diagram of a communication system according to Embodiment 11 of the present invention;
图 16是本发明实施例 12提供的通信系统的结构示意图。 具体实施方式 Figure 16 is a block diagram showing the structure of a communication system according to Embodiment 12 of the present invention. detailed description
下面将结合本发明实施例中的附图, 对本发明实施例中的技术方案进行 清楚、 完整地描述, 显然, 所描述的实施例是本发明一部分实施例, 而不是 全部的实施例。 基于本发明中的实施例, 本领域普通技术人员在没有作出创 造性劳动前提下所获得的所有其他实施例, 都属于本发明保护的范围。 The technical solutions in the embodiments of the present invention are clearly and completely described in the following with reference to the accompanying drawings in the embodiments of the present invention. It is obvious that the described embodiments are a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments obtained by a person of ordinary skill in the art based on the embodiments of the present invention without making creative labor are within the scope of the present invention.
图 1为本发明实施例提供的一种通信系统的组网结构示意图。 FIG. 1 is a schematic structural diagram of a networking of a communication system according to an embodiment of the present invention.
该通信系统包括交换机 110和通信设备 120 , 其中, 通信设备 120接入交 换机 110 , 通过交换机 110与其他网络设备通信, 如, 与通信设备 120对应的 DHCP服务器 150通信。 The communication system includes a switch 110 and a communication device 120, wherein the communication device 120 is coupled to the switch 110 and communicates with other network devices via the switch 110, such as a DHCP server 150 corresponding to the communication device 120.
基于所述通信系统, 在本发明实施例 1 中, 通信设备 120以广播方式向 DHCP服务器 150发送 DHCP报文, 交换机 110接收到该 DHCP报文后, 获取通 信设备 120对应的 DHCP服务器, 并将该 DHCP报文中的目的地址字段的广播 地址替换为 DHCP服务器 150的路由地址,并将修改后的 DHCP报文路由至 DHCP 服务器 150。 Based on the communication system, in the first embodiment of the present invention, the communication device 120 sends a DHCP message to the DHCP server 150 in a broadcast manner, and after receiving the DHCP message, the switch 110 acquires a DHCP server corresponding to the communication device 120, and The broadcast address of the destination address field in the DHCP message is replaced with the routing address of the DHCP server 150, and the modified DHCP message is routed to the DHCP server 150.
该通信系统还可以包括控制器(Cont ro l ler ) 1 30 , 其中, 控制器 1 30与 交换机 110通过网络通信。 The communication system can also include a controller (Cont roler) 1 30, wherein the controller 130 communicates with the switch 110 over a network.
基于所述通信系统, 在本发明实施例 1 中, 控制器 1 30用于生成路由指 示信息并向交换机 1 10发送所述路由指示信息, 所述路由指示信息包括 DHCP 服务器 150的路由地址、 以及用于指示交换机 110将接收的以广播方式发送 的 DHCP报文路由至 DHCP服务器 150的路由指示。 交换机 110接收到所述路
由指示信息后, 在接收到通信设备 120以广播方式发送的 DHCP报文时, 根据 DHCP服务器 150的路由地址将所述 DHCP报文路由至 DHCP服务器 150。 Based on the communication system, in the first embodiment of the present invention, the controller 1 30 is configured to generate routing indication information, and send the routing indication information to the switch 110, where the routing indication information includes a routing address of the DHCP server 150, and A routing indication for instructing the switch 110 to route the received broadcasted DHCP message to the DHCP server 150. The switch 110 receives the road After receiving the DHCP message sent by the communication device 120 in the broadcast mode, the DHCP message is routed to the DHCP server 150 according to the routing address of the DHCP server 150.
基于所述通信系统, 在本发明实施例 1 中, 控制器 130用于生成指示信 息并向交换机 110发送所述指示信息, 所述指示信息用于指示交换机 110将 接收的 DHCP报文转发至控制器 130。 交换机 110接收到所述指示信息后, 在 接收到通信设备 120发送的 DHCP报文时, 将接收的 DHCP报文转发至控制器 130, 控制器 130根据所述 DHCP报文为通信设备 120提供 DHCP服务。 Based on the communication system, in the first embodiment of the present invention, the controller 130 is configured to generate the indication information and send the indication information to the switch 110, where the indication information is used to instruct the switch 110 to forward the received DHCP message to the control. 130. After receiving the indication information, the switch 110 forwards the received DHCP message to the controller 130 when receiving the DHCP message sent by the communication device 120, and the controller 130 provides the communication device 120 with the DHCP according to the DHCP message. service.
如图 1 所示, 为本发明实施例提供的一种基于 SDN (软件定义网络, software defined network)的通信系统的组网结构示意图。 该通信系统具体 可以为数据中心系统。 交换机 110和控制器 130之间可以通过 openf 1 ow (开 放流)协议进行通信》 FIG. 1 is a schematic diagram of a networking structure of a communication system based on an SDN (software defined network) according to an embodiment of the present invention. The communication system can be specifically a data center system. The switch 110 and the controller 130 can communicate via the openf 1 ow protocol.
其中, 交换机 110 具体可以是虚拟交换机 ( virtual switch) , 如图 1 中的 V- switch 110-1, 也可以是物理交换机 ( physical switch ) , 如图 2中 的 P_switch 110-2和 P_switch 110-3。 通信设备 120具体可以是与虚拟交换 机连接的虚拟机, 如图 2中的 VM 120-1和 VM 120-2, 也可以是与物理交换机 连接的物理主机, 如图 2中的 Host 120-3、 Host 120- 4和 Host 120-5。 The switch 110 may be a virtual switch, such as the V-switch 110-1 in FIG. 1 or a physical switch, such as P_switch 110-2 and P_switch 110-3 in FIG. 2 . . The communication device 120 may be a virtual machine connected to the virtual switch, such as VM 120-1 and VM 120-2 in FIG. 2, or a physical host connected to the physical switch, such as Host 120-3 in FIG. Host 120-4 and Host 120-5.
在本发明实施例 1 的一个具体的实现示例中, 控制器 130 向 V-switch 110-1发送路由指示信息, 所述路由指示信息包括 DHCP服务器 150的路由地 址、 以及用于指示 V-switch 110-1将接收的以广播方式发送的 DHCP报文路 由至 DHCP服务器 150的路由指示。 V_switch 110-1在接收到 VM 120-1以广 播方式发送的 DHCP报文时, 根据所述路由指示信息中的 DHCP服务器 150的 路由地址将所述 DHCP报文路由至 DHCP服务器 150。 图 3是本发明实施例 1提供的方法流程示意图, 本发明实施例 1的方法 可以应用于图 1或图 2所示的通信系统。 In a specific implementation example of Embodiment 1 of the present invention, the controller 130 sends routing indication information to the V-switch 110-1, where the routing indication information includes a routing address of the DHCP server 150, and is used to indicate the V-switch 110. -1 routes the received DHCP message sent by the broadcast to the DHCP server 150. When receiving the DHCP message sent by the VM 120-1 in the broadcast mode, the V_switch 110-1 routes the DHCP message to the DHCP server 150 according to the routing address of the DHCP server 150 in the routing indication information. FIG. 3 is a schematic flowchart of a method according to Embodiment 1 of the present invention. The method of Embodiment 1 of the present invention can be applied to the communication system shown in FIG. 1 or FIG.
根据本发明实施例 1,交换机将接入该交换机的通信设备以广播方式发送
的 DHCP报文的目的地址均替换为该通信设备对应的 DHCP服务器的路由地址 并将修改后的 DHCP报文路由至该 DHCP服务器。 According to Embodiment 1 of the present invention, the switch transmits the communication device accessing the switch in a broadcast manner. The destination address of the DHCP message is replaced with the routing address of the DHCP server corresponding to the communication device, and the modified DHCP message is routed to the DHCP server.
如图 3所示, 本发明实施例 1提供的方法包括: 步骤 210: 交换机接收接入所述交换机的通信设备发送的报文。 As shown in FIG. 3, the method provided in Embodiment 1 of the present invention includes: Step 210: A switch receives a packet sent by a communication device that accesses the switch.
所述通信设备发送报文之前还包括, 所述通信设备通过所述交换机上的 端口接入所述交换机。 The communication device further includes: the communication device accessing the switch through a port on the switch before sending the message.
步骤 220: 所述交换机在确定所述报文为以广播方式发送的 DHCP报文时 获取所述通信设备对应的 DHCP服务器的路由地址, 并将所述 DHCP报文的目 的地址字段的广播地址替换为所述 DHCP服务器的路由地址; Step 220: The switch acquires a routing address of the DHCP server corresponding to the communication device when the packet is a DHCP message sent by the broadcast, and replaces the broadcast address of the destination address field of the DHCP packet. Is the routing address of the DHCP server;
以广播方式发送的 DHCP报文的目的地址字段的值为广播地址。 具体地, 所述目的地址字段包括目的 IP地址字段和 /或目的 MAC地址字段, 其中, 目 的 IP地址字段的值为广播 IP地址, 如 255. 255. 255. 255 , 目的 MAC地址字段 为广播 MAC地址, 如 ff: ff: ff : ff: ff : f f。 所述交换机可以根据 DHCP 4艮文中 的目的地址字段记录的是否为广播地址进行判断, 如果是广播地址, 则确定 该 DHCP 报文为广播报文。 所述以广播方式发送的 DHCP 报文, 具体可以是 DHCPDI SC0VER报文或 DHCPREQUEST报文。 The value of the destination address field of the DHCP message sent by broadcast is the broadcast address. Specifically, the destination address field includes a destination IP address field and/or a destination MAC address field, where the value of the destination IP address field is a broadcast IP address, such as 255. 255. 255. 255, and the destination MAC address field is a broadcast MAC address. Address, such as ff: ff: ff : ff: ff : ff. The switch can determine whether the DHCP message is a broadcast message according to whether the broadcast address is recorded in the destination address field in the DHCP message. The DHCP message sent by the broadcast may be a DHCPDI SC0VER packet or a DHCPREQUEST packet.
相应地, 所述交换机获取的所述 DHCP服务器的路由地址包括所述 DHCP 服务器的 IP地址和 /或 MAC地址, 获取所述 IP地址和 /或 MAC地址后, 所述 交换机将所述 DHCP报文的目的 IP地址字段的广播 IP地址替换为所述 DHCP 服务器的 IP地址, 和 /或将所述 DHCP报文的目的 MAC地址字段的广播 MAC地 址替换为所述 DHCP服务器的 MAC地址。 Correspondingly, the routing address of the DHCP server acquired by the switch includes an IP address and/or a MAC address of the DHCP server. After the IP address and/or the MAC address is obtained, the switch sends the DHCP packet. The broadcast IP address of the destination IP address field is replaced with the IP address of the DHCP server, and/or the broadcast MAC address of the destination MAC address field of the DHCP message is replaced with the MAC address of the DHCP server.
优选地, 所述 DHCP报文包括所述通信设备的标识, 所述交换机可以通过 存储的所述通信设备的标识与所述通信设备对应的 DHCP服务器的路由地址的 映射关系获取所述通信设备的标识对应的所述 DHCP服务器的路由地址。 所述 通信设备的标识具体可以为所述通信设备的 MAC地址, 也可以为所述端口的 端口号。 Preferably, the DHCP message includes an identifier of the communication device, and the switch may acquire the mapping relationship between the identifier of the communication device and the routing address of the DHCP server corresponding to the communication device. Identify the routing address of the corresponding DHCP server. The identifier of the communication device may be a MAC address of the communication device or a port number of the port.
步骤 230: 所述交换机根据修改后的 DHCP报文中的路由地址将所述修改
后的 DHCP报文路由至所述 DHCP服务器。 优选地, 步骤 220之前还可以包括, 所述控制器生成路由指示信息, 并 向所述交换机发送所述路由指示信息, 所述路由指示信息包括 DHCP服务器的 路由地址、 以及用于指示交换机将接收的以广播方式发送的 DHCP报文路由至 所述 DHCP服务器的路由指示。 相应地, 步骤 220具体包括, 所述交换机从所 述路由指示信息中获取所述 DHCP服务器的路由地址, 并根据所述路由指示信 息中的路由指示将所述 DHCP报文的目的地址字段的广播地址替换为所述 DHCP 服务器的路由地址。 Step 230: The switch performs the modification according to the routing address in the modified DHCP packet. The subsequent DHCP message is routed to the DHCP server. Preferably, before the step 220, the controller may further include: the controller generates routing indication information, and sends the routing indication information to the switch, where the routing indication information includes a routing address of the DHCP server, and is used to indicate that the switch will receive The DHCP message sent by the broadcast route is routed to the DHCP server. Correspondingly, the step 220 includes: the switch acquiring the routing address of the DHCP server from the routing indication information, and broadcasting the destination address field of the DHCP packet according to the routing indication in the routing indication information The address is replaced with the routing address of the DHCP server.
优选地, 所述交换机在所述通信设备接入所述交换机后向所述控制器发 送所述通信设备的标识。 所述控制器在生成所述路由指示信息之前还包括, 所述控制器确定所述通信设备所对应的 DHCP服务器, 相应地, 生成的所述路 由指示信息还包括所述通信设备的标识与所述 DHCP服务器的路由地址的映射 关系; 所述路由指示具体用于指示所述交换机将接收自所述通信设备的以广 播方式发送的 DHCP报文路由至所述 DHCP服务器。 相应地, 在步骤 220中, 所述交换机从所述 DHCP报文中获取所述通信设备的标识, 并根据所述路由指 示信息中的映射关系获取所述通信设备的标识对应的所述 DHCP服务器的路由 地址。 Preferably, the switch sends the identifier of the communication device to the controller after the communication device accesses the switch. Before the generating the routing indication information, the controller further includes: the controller determining a DHCP server corresponding to the communication device, and correspondingly, the generated routing indication information further includes an identifier and a location of the communication device The routing relationship of the routing address of the DHCP server is used to: the routing indication is specifically used to instruct the switch to route the DHCP message sent by the communication device to the DHCP server. Correspondingly, in step 220, the switch acquires the identifier of the communication device from the DHCP message, and obtains the DHCP server corresponding to the identifier of the communication device according to the mapping relationship in the route indication information. Routing address.
根据本发明实施例 1 ,当所述交换机接收到所述通信设备以广播方式发送 的 DHCP报文时, 将所述 DHCP报文中的广播地址替换为所述通信设备对应的 DHCP服务器的路由地址, 因此仅向所述 DHCP服务器发送该 DHCP报文, 而不 是向广播范围内的所有网络设备广播该报文, 从而解决了现有技术中通过广 播方式向广播范围内的所有网络设备发送 DHCP报文所导致的大量消耗网络资 源的问题、以及对无需接收该 DHCP报文的服务器的性能造成较大压力的问题。 下面结合图 4对本发明实施例 1详加阐述。 According to the first embodiment of the present invention, when the switch receives the DHCP message sent by the communication device in a broadcast manner, the broadcast address in the DHCP message is replaced with the routing address of the DHCP server corresponding to the communication device. Therefore, the DHCP message is sent only to the DHCP server, instead of broadcasting the message to all network devices in the broadcast range, thereby solving the problem in the prior art that the DHCP message is sent to all network devices in the broadcast range by the broadcast mode. The problem caused by a large amount of consumption of network resources and the pressure on the performance of a server that does not need to receive the DHCP message. Embodiment 1 of the present invention will be described in detail below with reference to FIG.
步骤 301 : 通信设备接入交换机时, 所述交换机向与所述交换机通信的控 制器发送所述通信设备的标识。
所述交换机和所述控制器之间可以通过 openf low协议进行通信。 Step 301: When the communication device accesses the switch, the switch sends the identifier of the communication device to a controller that communicates with the switch. The switch and the controller can communicate through the openf low protocol.
以图 2所示的通信系统为例, VM 120-1通过 V_swi tch 110-1的端口 1234 接入 V- swi tch 110-1 , V- swi tch 110-1向控制器 130发送端口号 1234。 Taking the communication system shown in FIG. 2 as an example, VM 120-1 accesses V-swi tch 110-1 through port 1234 of V_swi tch 110-1, and V-swi tch 110-1 sends port number 1234 to controller 130.
步骤 302:所述控制器生成路由指示信息并将所述路由指示信息发送给所 述交换机, 所述路由指示信息包括 DHCP服务器的 MAC地址和 IP地址、 以及 用于指示交换机将接收的以广播方式发送的 DHCP报文路由至所述 DHCP服务 器的路由指示。 Step 302: The controller generates routing indication information, and sends the routing indication information to the switch, where the routing indication information includes a MAC address and an IP address of the DHCP server, and is used to indicate that the switch will receive the broadcast mode. The DHCP message sent is routed to the routing indication of the DHCP server.
当所述控制器和所述交换机为支持 openf low协议的设备时, 所述路由指 示信息具体可以为 openf low流表, 具体如表 1所示: When the controller and the switch are devices that support the openf low protocol, the routing indication information may be an openf low flow table, as shown in Table 1:
openf low流表用于指示, 当接收的报文满足匹配域所设定的条件时, 执 行动作域所设定的动作。 其中, 所述匹配域 ( mat ch f ie ld )也可以称为包头 域 ( header f ie ld )。 The openf low flow table is used to indicate that when the received message satisfies the condition set by the matching field, the action set in the action field is executed. The matching field ( mat ch f ie ld ) may also be referred to as a header field (header f ie ld ).
如表 1 所示的 openf low 流表, 匹配域所设定的条件为广播方式发送的 DHCP报文所需要满足的条件; 动作域所设定的动作包括: 将满足条件的报文 的目的 MAC地址替换为指定的 DHCP服务器的 MAC地址, 将满足条件的报文的
目的 IP地址替换为指定的 DHCP服务器的 IP地址, 并且按照普通的二层 /三 层交换机行为转发报文。 相应地, 所述交换机在收到该流表后, 在判断接收 到的报文满足匹配域所设定的条件时, 即判断出接收的报文为广播方式发送 的 DHCP报文时, 将该报文的目的 MAC地址替换为指定的 DHCP服务器的 MAC 地址, 将该报文的目的 IP地址替换为指定的 DHCP服务器的 IP地址, 并且按 照普通的二层 /三层交换机行为转发修改后的 DHCP报文。 For the openf low flow table shown in Table 1, the conditions set by the matching field are the conditions that must be met for the DHCP message sent by the broadcast mode. The action set by the action field includes: The destination MAC of the message that meets the condition The address is replaced with the MAC address of the specified DHCP server, which will satisfy the condition of the packet. The destination IP address is replaced with the IP address of the specified DHCP server, and the packets are forwarded according to the behavior of the Layer 2 or Layer 3 switch. Correspondingly, after receiving the flow table, the switch determines that the received message meets the condition set by the matching domain, that is, when the received message is determined to be a DHCP message sent by the broadcast mode, Replace the destination MAC address of the packet with the MAC address of the specified DHCP server, replace the destination IP address of the packet with the IP address of the specified DHCP server, and forward the modified DHCP according to the normal Layer 2/Layer 3 switch behavior. Message.
以表 1为例, 匹配域的字段包括传输层源端口号( tp_ src )、 传输层目的 端口号 ( tp_ds t )、 数据链路层报文类型 ( dl _ type )、 网络层协议类型 ( nw.proto )、 目的 MAC地址( dl _ds t )和目的 IP地址(丽 _ds t) , 当接收到 的报文中的传输层源端口号为 68、 传输层目的端口号为 67、 数据链路层报文 类型为 0x0800、 网络层协议类型为 17 , 则可以确定该报文为 DHCP报文, 当 该 4艮文的 目 的 MAC 地址为 f f: ff: ff: ff: ff: f f 、 目 的 IP 地址为 255. 255. 255. 255 , 则可以进一步确定该报文为以广播方式发送的 DHCP报文。 表 1中动作域设定的 mod_dl _ds t=dhcp server mac用于指示将满足条件的报 文中的目的 MAC地址替换为 dhcp server mac ( DHCP服务器的 MAC地址 ), 设 定的 mod_nw_ds t=dhcp server ip用于指示将该艮文中的目的 IP地址替换为 dhcp server ip ( DHCP服务器的 IP地址), 设定的 Norma l用于指示将修改后 的报文按照普通的二层 /三层交换机行为转发出去。 Taking Table 1 as an example, the fields of the matching domain include the transport layer source port number (tp_ src ), the transport layer destination port number (tp_ds t ), the data link layer packet type ( dl _ type ), and the network layer protocol type ( nw .proto ), destination MAC address ( dl _ds t ) and destination IP address ( _ds t), when the transport layer source port number is 68 in the received message, the transport layer destination port number is 67, the data link If the packet type is 0x0800 and the network layer protocol type is 17, you can determine that the packet is a DHCP packet. When the destination MAC address of the packet is ff: ff: ff: ff: ff: ff, destination IP address 255. 255. 255. 255, the packet can be further determined to be a DHCP message sent by broadcast. The mod_dl _ds t=dhcp server mac set in the action field in Table 1 is used to indicate that the destination MAC address in the packet that meets the condition is replaced with dhcp server mac (the MAC address of the DHCP server), and the mod_nw_ds t=dhcp server is set. Ip is used to indicate that the destination IP address in the text is replaced with the dhcp server ip (the IP address of the DHCP server). The configured Norma is used to forward the modified packet to the normal Layer 2 or Layer 3 switch. Go out.
进一步地, 所述表 1 所示的流表的匹配域还可以包括所述通信设备的标 识, 用于表明, 当接收到该通信设备以广播方式发送的 DHCP报文时执行动作 域设定的动作。 Further, the matching field of the flow table shown in Table 1 may further include an identifier of the communication device, to indicate that the action domain setting is performed when receiving the DHCP message sent by the communication device in a broadcast manner. action.
需要说明的是, 如果步骤 302 中所述控制器生成路由指示信息需要用到 所述通信设备的标识, 则步骤 302在步骤 301之后执行, 如果不需要用到, 则步骤 302也可以在步骤 301之前执行。 It should be noted that, if the controller generates the route indication information in step 302, the identifier of the communication device is needed, step 302 is performed after step 301, and if it is not needed, step 302 may also be step 301. Executed before.
步骤 303: 所述通信设备以广播方式发送 DHCPDISCOVER报文。 Step 303: The communications device sends a DHCPDISCOVER packet in a broadcast manner.
需要说明的是, 所述通信设备发送的 DHCP报文均是通过安装在所述通信 设备上的 DHCP客户端发送的。 具体地, 在该 DHCP客户端启动时, 该 DHCP客
户端在该通信设备所在的子网中广播 DHCPDI SCOVER 4艮文。 It should be noted that the DHCP messages sent by the communication device are all sent by a DHCP client installed on the communication device. Specifically, when the DHCP client starts, the DHCP client The client broadcasts a DHCPDI SCOVER message in the subnet where the communication device is located.
所述 DHCPDI SCOVER 4艮文用于申请 IP地址。 The DHCPDI SCOVER 4 message is used to apply for an IP address.
步骤 304 : 所述交换机接收到该 DHCPDI SCOVER ^艮文, 利用接收的所述路 由指示信息确定所述 DHCPDI SCOVER报文为以广播方式发送的 DHCP报文, 则 将所述 DHCPDI SCOVER ^艮文的目的 MAC地址替换为所述路由指示信息中的 DHCP 月良务器的 MAC地址, 将所述 DHCPDI SCOVER ^艮文的目的 IP地址替换为所述路 由指示信息中的 DHCP服务器的 IP地址。 Step 304: The switch receives the DHCPDI SCOVER message, and uses the received routing indication information to determine that the DHCPDI SCOVER message is a DHCP message sent by broadcast, and then the DHCPDI SCOVER is The destination MAC address is replaced with the MAC address of the DHCP server in the routing indication information, and the destination IP address of the DHCPDI SCOVER message is replaced with the IP address of the DHCP server in the routing indication information.
以表 1为例, 所述交换机确定该 DHCPDI SCOVER报文满足表 1中的流表的 匹配域的条件, 则将该 DHCPDI SCOVER 4艮文中的目的 MAC 地址替换为 dhcp server mac ,将该 DHCPDI SCOVER报文中的目的 IP地址替换为 dhcp server i p。 Taking Table 1 as an example, if the switch determines that the DHCPDI SCOVER message satisfies the matching field of the flow table in Table 1, replace the destination MAC address in the DHCPDI SCOVER 4 with the dhcp server mac, and the DHCPDI SCOVER Replace the destination IP address in the packet with dhcp server ip.
步骤 305 : 该交换机转发修改后的 DHCPD I SC0VER 4艮文。 Step 305: The switch forwards the modified DHCPD I SC0VER 4 message.
由于修改后的 DHCPDI SCOVER ^艮文的目的 IP地址为该 DHCP服务器的 IP 地址、 目的 MAC地址为该 DHCP服务器的 MAC地址, 因此该 DHCPDI SCOVER报 文会被直接路由到该 DHCP服务器。 The DHCPID SCOVER message is directly routed to the DHCP server because the destination IP address of the modified DHCPDI SCOVER message is the IP address of the DHCP server and the destination MAC address is the MAC address of the DHCP server.
步骤 306 : 所述 DHCP服务器收到 DHCPDI SCOVER ^艮文后,从针对该通信设 备的 IP地址区间中为该通信设备分配一个尚未被分配出去的 IP地址, 并把 分配的 IP地址暂时标记为不可用。 Step 306: After receiving the DHCPDI SCOVER message, the DHCP server allocates an IP address that has not been allocated to the communication device from the IP address range of the communication device, and temporarily marks the assigned IP address as unavailable. use.
步骤 307 : 所述 DHCP 服务器通过所述交换机向所述通信设备返回 DHCPOFFER ( DHCP提供)报文, 所述 DHCPOFFER报文包括分配的 IP地址。 Step 307: The DHCP server returns a DHCPOFFER (DHCP Provisioning) message to the communication device by using the switch, where the DHCPOFFER message includes an assigned IP address.
步骤 308 : 所述通信设备收到 DHCPOFFER ^艮文后, 以广播方式发送包括所 述 IP地址的 DHCPREQUEST报文。 Step 308: After receiving the DHCPOFFER message, the communication device sends a DHCPREQUEST packet including the IP address in a broadcast manner.
步骤 309 : 所述交换机接收到该 DHCPREQUEST ^艮文, 利用接收的所述路由 指示信息确定所述 DHCPREQUEST报文为以广播方式发送的 DHCP报文, 则将所 述 DHCPREQUEST 4艮文的目的 MAC地址替换为所述路由指示信息中的 DHCP服务 器的 MAC地址, 将所述 DHCPREQUEST ^艮文的目的 IP地址替换为所述路由指示 信息中的 DHCP服务器的 IP地址; Step 309: The switch receives the DHCPREQUEST message, and uses the received routing indication information to determine that the DHCPREQUEST packet is a DHCP message sent by the broadcast, and then the destination MAC address of the DHCPREQUEST message is Replacing the MAC address of the DHCP server in the routing indication information, and replacing the destination IP address of the DHCP REQUEST message with the IP address of the DHCP server in the routing indication information;
步骤 310: , 该交换机转发修改后的 DHCPREQUEST报文。
图表 3 去广播 DHCP分配 IP过程 (实例一) Step 310: The switch forwards the modified DHCPREQUEST packet. Figure 3 to broadcast DHCP allocation IP process (example 1)
则该报文被直接路由到该 DHCP服务器。 The message is then routed directly to the DHCP server.
步骤 311 : 该 DHCP服务器通过所述交换机向所述通信设备返回 DHCPACK ( DHCP确认)报文, 所述 DHCPACK包括所述 IP地址、 及所述 IP地址的配置 参数。 Step 311: The DHCP server returns a DHCPACK (DHCP acknowledgment) message to the communication device by using the switch, where the DHCP ACK includes the IP address and configuration parameters of the IP address.
所述通信设备接收到包含了配置参数的 DHCPACK报文后, 利用 ARP报文 检测网络上的其它网络设备是否在使用该 IP地址。 如果确认网络上没有其它 网络设备在使用该 IP地址, 则所述通信设备接受该 IP地址及其配置参数, 如果发现有其它网络设备在使用该 IP地址, 则所述通信设备向该 DHCP服务 器发送 DHCPDECLINE报文, 并重新发送 DHCPDISC0VER报文申请 IP地址。 该 DHCP服务器收到该 DHCPDECLINE ^艮文后, 将该 IP地址标为不可用。 After receiving the DHCPACK packet containing the configuration parameter, the communication device uses the ARP packet to detect whether other network devices on the network are using the IP address. If it is confirmed that no other network device is using the IP address on the network, the communication device accepts the IP address and its configuration parameters, and if it is found that other network devices are using the IP address, the communication device sends the IP address to the DHCP server. DHCPDECLINE message, and resend the DHCPDISC0VER message to apply for an IP address. After receiving the DHCPDECLINE message, the DHCP server marks the IP address as unavailable.
步骤 312: 所述通信设备不再需要使用该 IP地址时, 可以主动向该 DHCP 服务器发出 DHCPRELEASE ( DHCP释放)报文, 以释放该 IP地址。 图 5是本发明实施例 2提供的方法流程示意图, 本发明实施例 2的方法 可以应用于图 1或图 2所示的通信系统。 Step 312: When the communication device no longer needs to use the IP address, the device may actively send a DHCPRELEASE message to the DHCP server to release the IP address. FIG. 5 is a schematic flowchart of a method according to Embodiment 2 of the present invention. The method of Embodiment 2 of the present invention can be applied to the communication system shown in FIG. 1 or FIG.
根据本发明实施例 2 ,交换机将接入该交换机的通信设备发送的所有 DHCP 报文均转发给控制器, 由控制器为该通信设备提供 DHCP服务(如为该通信设 备分配 IP地址、 未该通信设备提供分配的 IP地址的配置参数、 释放已分配 的 IP地址等) 。 According to Embodiment 2 of the present invention, the switch forwards all DHCP messages sent by the communication device accessing the switch to the controller, and the controller provides a DHCP service for the communication device (if the IP address is assigned to the communication device, the switch does not The communication device provides configuration parameters of the assigned IP address, releases the assigned IP address, etc.).
如图 5所示, 本发明实施例 2提供的方法包括: 步骤 410: 通信设备向所述通信设备接入的交换机发送报文; As shown in FIG. 5, the method provided in Embodiment 2 of the present invention includes: Step 410: A communications device sends a packet to a switch accessed by the communications device;
步骤 420:所述交换机在确定所述报文为 DHCP报文时将所述 DHCP报文转 发至与所述交换机通信的控制器; Step 420: The switch forwards the DHCP message to a controller that communicates with the switch when determining that the packet is a DHCP message.
所述 DHCP 4艮文具体可以为 DHCPDISC0VER 4艮文、 DHCPREQUEST 4艮文或 The DHCP message may be specifically DHCPDISC0VER 4, DHCPREQUEST 4 or
DHCPRELEASE报文。
步骤 430:所述控制器根据所述 DHCP报文为所述通信设备提供 DHCP服务。 具体地, 当所述 DHCP 艮文为 DHCPDISC0VER 艮文时, 所述控制器为所述 通信设备分配 IP地址; 当所述 DHCP ^艮文为 DHCPREQUEST ^艮文时, 所述控制 器向所述通信设备提供为所述通信设备分配的 IP 地址的配置参数; 当所述 0 ?^艮文为 0^?1^1^^£ 4艮文时, 所述控制器释放为所述通信设备分配的 IP 地址。 DHCPRELEASE message. Step 430: The controller provides a DHCP service for the communication device according to the DHCP message. Specifically, when the DHCP message is a DHCPDISC0VER message, the controller allocates an IP address to the communication device; when the DHCP message is a DHCPREQUEST message, the controller sends the message to the communication The device provides configuration parameters for the IP address assigned to the communication device; when the 0? When the message is 0^?1^1^^£4, the controller releases the IP address assigned to the communication device.
在步骤 420之前还可以包括, 所述交换机接收所述控制器发送的指示信 息,所述指示信息用于指示所述交换机将接收的 DHCP报文转发至所述控制器。 相应地, 步骤 420 具体包括, 所述交换机根据所述指示信息执行在确定所述 报文为 DHCP报文时将所述 DHCP报文转发至所述控制器的操作。 Before the step 420, the switch may further include: the switch receiving the indication information sent by the controller, where the indication information is used to instruct the switch to forward the received DHCP message to the controller. Correspondingly, the step 420 specifically includes: the switch performing, according to the indication information, an operation of forwarding the DHCP message to the controller when determining that the packet is a DHCP message.
进一步地, 在所述通信设备通过所述交换机上的端口接入所述交换机时, 所述交换机向所述控制器发送所述端口的端口号。 相应地, 步骤 430 具体可 以包括, 所述控制器构造包括所述 DHCP服务对应的数据的 DHCP报文, 并将 构造的 DHCP报文和所述端口号封装到数据报文中发送给所述交换机, 以使得 所述交换机通过所述数据报文中的端口号所标识的端口将所述数据报文携带 的 DHCP报文发送给所述通信设备。 具体地, 当所述控制器接收的 DHCP报文 为 DHCPDISCOVER ^艮文时, 所述控制器构造的 DHCP ^艮文为 DHCPOFFER ^艮文, 所述 DHCPOFFER报文包括的所述 DHCP服务对应的数据包括所述控制器为所述 通信设备分配的 IP地址; 当所述控制器接收的 DHCP ^艮文为 DHCPREQUEST ¾ 文时, 所述控制器构造的 DHCP ^艮文为 DHCPACK ^艮文, 所述 DHCPACK ^艮文包括 的所述 DHCP服务对应的数据包括所述控制器为所述通信设备分配的 IP地址 的配置参数。 Further, when the communication device accesses the switch through a port on the switch, the switch sends a port number of the port to the controller. Correspondingly, the step 430 may include: the controller constructs a DHCP message including data corresponding to the DHCP service, and encapsulates the constructed DHCP message and the port number into a data packet and sends the packet to the switch. And sending, by the switch, the DHCP message carried by the data packet to the communication device by using the port identified by the port number in the data packet. Specifically, when the DHCP message received by the controller is a DHCPDISCOVER message, the DHCP message configured by the controller is a DHCPOFFER message, and the DHCPOFFER message includes the data corresponding to the DHCP service. Including the IP address assigned by the controller to the communication device; when the DHCP message received by the controller is a DHCPREQUEST message, the DHCP message constructed by the controller is a DHCPACK message, The data corresponding to the DHCP service included in the DHCPACK message includes configuration parameters of an IP address allocated by the controller for the communication device.
根据本发明实施例 2 , 当所述交换机接收到所述通信设备发送的 DHCP报 文时, 将所述 DHCP报文转发至与所述交换机通信的控制器, 以使得所述控制 器根据所述 DHCP报文为所述通信设备提供 DHCP服务。 因此仅向所述控制器 发送该 DHCP报文, 由所述控制器为所述通信设备提供 DHCP服务, 而不是向 广播范围内的所有网络设备广播该报文, 从而解决了现有技术中通过广播方
式向广播范围内的所有网络设备发送 DHCP报文所导致的大量消耗网络资源的 问题、 以及对无需接收该 DHCP报文的服务器的性能造成较大压力的问题。 According to Embodiment 2 of the present invention, when the switch receives the DHCP message sent by the communication device, the DHCP message is forwarded to a controller that communicates with the switch, so that the controller is configured according to the The DHCP message provides a DHCP service for the communication device. Therefore, the DHCP message is sent only to the controller, and the controller provides the DHCP service to the communication device instead of broadcasting the message to all network devices in the broadcast range, thereby solving the problem in the prior art. Broadcaster The problem of a large amount of network resource consumption caused by sending DHCP messages to all network devices in the broadcast range, and the problem of the performance of the server that does not need to receive the DHCP message.
下面结合图 6对本发明实施例 2详加阐述。 Embodiment 2 of the present invention will be described in detail below with reference to FIG.
步骤 501 : 通信设备通过交换机上的端口接入所述交换机时, 所述交换机 向与所述交换机通信的控制器发送所述端口的端口号。 Step 501: When the communication device accesses the switch through a port on the switch, the switch sends the port number of the port to a controller that communicates with the switch.
所述交换机和所述控制器之间可以通过 openf low协议进行通信。 The switch and the controller can communicate through the openf low protocol.
步骤 502: 所述控制器向与所述控制器通信的各交换机发送指示信息, 所 述指示信息用于指示所述交换机将接收的 DHCP报文转发至所述控制器。 Step 502: The controller sends indication information to each switch that communicates with the controller, where the indication information is used to instruct the switch to forward the received DHCP message to the controller.
当所述控制器和所述交换机为支持 openf low协议的设备时, 所述指示信 息具体可以为 openf low流表, 具体如表 2所示:
When the controller and the switch are devices that support the openf low protocol, the indication information may be specifically an ope nf low flow table, as shown in Table 2:
表 2 Table 2
如表 2所示的 openf low流表, 匹配域所设定的条件为 DHCP报文所需要 满足的条件; 动作域所设定的动作包括: 将满足条件的报文转发给所述控制 器。 相应地, 所述交换机在收到该流表后, 在判断接收到的报文满足匹配域 所设定的条件时, 即判断出接收的报文为 DHCP报文时, 将该 HDCP报文转发 给所述控制器。 As shown in the openf low flow table shown in Table 2, the condition set by the matching field is a condition that the DHCP message needs to meet; the action set in the action field includes: forwarding the message satisfying the condition to the controller. Correspondingly, after receiving the flow table, the switch forwards the HDCP packet when it determines that the received packet meets the condition set by the matching domain, that is, when the received packet is a DHCP packet. Give the controller.
以表 2为例, 匹配域的字段包括传输层源端口号( tp_ src )、 传输层目的 端口号 ( tp_ds t )、 数据链路层报文类型 ( d l _ type ) 和网络层协议类型 Taking Table 2 as an example, the fields of the matching domain include the transport layer source port number (tp_src), the transport layer destination port number (tp_ds t ), the data link layer packet type (d l _ type ), and the network layer protocol type.
(丽 _proto ), 当接收到的报文中的传输层源端口号为 68、传输层目的端口号 为 67、 数据链路层报文类型为 0x0800、 网络层协议类型为 17 , 则可以确定该 报文为 DHCP报文。 表 2中动作域的 act ions字段的值 "cont rol ler" 用于指 示将满足条件的报文转发至所述控制器。 (丽_proto), when the transport layer source port number in the received message is 68, the transport layer destination port number is 67, the data link layer packet type is 0x0800, and the network layer protocol type is 17, then it can be determined. The packet is a DHCP packet. The value "cont rol ler" of the act ions field of the action field in Table 2 is used to indicate that the message satisfying the condition is forwarded to the controller.
步骤 503: 所述通信设备以广播方式发送 DHCPDISCOVER报文。 需要说明的是, 所述通信设备发送的 DHCP报文均是通过安装在所述通信 设备上的 DHCP客户端发送的。 具体地, 在该 DHCP客户端启动时, 该 DHCP客
户端在该通信设备所在的子网中广播 DHCPDI SC0VER 4艮文。 Step 503: The communication device sends a DHCPDISCOVER message in a broadcast manner. It should be noted that the DHCP messages sent by the communication device are all sent by a DHCP client installed on the communication device. Specifically, when the DHCP client starts, the DHCP client The client broadcasts DHCPDI SC0VER 4 in the subnet where the communication device is located.
所述 DHCPDI SC0VER 4艮文用于申请 IP地址。 The DHCPDI SC0VER 4 text is used to apply for an IP address.
所述 DHCPDI SC0VER 4艮文用于申请一个 IP地址。 The DHCPDI SC0VER 4 message is used to apply for an IP address.
步骤 504 : 所述交换机接收到该 DHCPDI SC0VER ^艮文, 根据所述指示信息 -在确定所述 DHCPDI SC Step 504: The switch receives the DHCPDI SC0VER, according to the indication information - determining the DHCPDI SC
转发至所述控制器的操作。 Forward to the operation of the controller.
以表 2为例, 所述交换机确定该 DHCPDI SC0VER报文满足表 2中的流表的 匹配域的条件, 则将该 DHCPDI SC0VER ·^艮文转发至所述控制器。 Taking Table 2 as an example, if the switch determines that the DHCPDI SC0VER message satisfies the condition of the matching field of the flow table in Table 2, the DHCPDI SC0VER is forwarded to the controller.
具体地, 所述交换机利用 openf low协议封装该 DHCPDI SC0VER 4艮文, 并 通过该交换机和该控制器之间的安全通道( secure channe l ) 将封装后的 DHCPDI SC0VER 4艮文发送给该控制器。 Specifically, the switch encapsulates the DHCPDI SC0VER 4 by using the openf low protocol, and sends the encapsulated DHCPDI SC0VER 4 message to the controller through a secure channel between the switch and the controller (secure channe l ). .
步骤 505 : 该控制器根据分配算法为该通信设备分配一个可用 IP , 构造 包括该 IP地址的 DHCPOFFER报文, 并将该 DHCPOFFER报文和在步骤 301接收 的端口号封装在数据报文中。 Step 505: The controller allocates an available IP to the communication device according to the allocation algorithm, constructs a DHCPOFFER message including the IP address, and encapsulates the DHCPOFFER message and the port number received in step 301 in the data packet.
所述数据 4艮文具体可以是 openf low协议的 send-packe t消息。 The data may specifically be a send-packe t message of the openf low protocol.
步骤 506 : 所述控制器将所述数据报文发送给所述交换机。 Step 506: The controller sends the data packet to the switch.
步骤 507 :所述交换机通过所述数据报文中的端口号所标识的所述端口将 所述数据报文携带的 DHCPOFFER报文发送给所述通信设备。 Step 507: The switch sends the DHCPOFFER message carried by the data packet to the communication device by using the port identified by the port number in the data packet.
步骤 508 : 所述通信设备收到 DHCPOFFER ^艮文后, 以广播方式发送包括所 述 IP地址的 DHCPREQUEST报文。 Step 508: After receiving the DHCPOFFER message, the communication device sends a DHCPREQUEST packet including the IP address in a broadcast manner.
步骤 509 : 所述交换机接收到该 DHCPREQUEST报文, 根据所述指示信息执 行在确定所述 DHCPREQUEST报文为 DHCP报文时将所述 DHCPREQUEST报文转发 至所述控制器的操作。 Step 509: The switch receives the DHCPREQUEST packet, and performs an operation of forwarding the DHCPREQUEST packet to the controller when determining that the DHCPREQUEST packet is a DHCP message according to the indication information.
以表 2为例, 所述交换机确定该 DHCPREQUEST ^艮文满足表 2中的流表的 匹配域的条件, 则将该 DHCPREQUEST报文转发至所述控制器。 Taking the table 2 as an example, the switch determines that the DHCPREQUEST message satisfies the condition of the matching field of the flow table in Table 2, and forwards the DHCPREQUEST message to the controller.
具体地, 所述交换机利用 openf low协议封装该 DHCPREQUEST 4艮文, 并通
过该交换机和该控制器之间的安全通道将封装后的 DHCPREQUEST报文发送给 该控制器。 Specifically, the switch encapsulates the DHCPREQUEST 4 by using the openf low protocol, and the A secure channel between the switch and the controller sends the encapsulated DHCPREQUEST message to the controller.
步骤 510: 所述控制器构造 DHCPACK报文, 将 DHCPACK报文和所述端口号 封装在数据报文中发送给所述交换机, 所述 DHCPACK报文包括所述 IP地址、 及所述 IP地址的配置参数; Step 510: The controller constructs a DHCPACK packet, and encapsulates the DHCPACK packet and the port number in a data packet and sends the packet to the switch, where the DHCPACK packet includes the IP address and the IP address. Configuration parameter
步骤 511 :所述控制器将在步骤 510生成的所述数据报文发送给所述交换 机。 Step 511: The controller sends the data packet generated in step 510 to the switch.
步骤 512: 所述交换机接收所述数据报文后, 通过所述数据报文中的端口 号所标识的所述端口将所述数据报文携带的 DHCPACK报文发送给所述通信设 备。 Step 512: After receiving the data packet, the switch sends the DHCPACK message carried by the data packet to the communication device by using the port identified by the port number in the data packet.
所述通信设备接收到包含了配置参数的 DHCPACK报文, 利用 ARP报文检 测网络上的其它网络设备是否在使用该 IP地址。 如果确认网络上没有其它网 络设备在使用该 IP地址, 则所述通信设备接受该 IP地址及其配置参数。 如 果发现有其它网络设备在使用该 IP地址, 则所述通信设备发送 DHCPDECLINE 艮文, 并重新发送 DHCPDI SC0VER 4艮文申请 IP 地址。 所述交换机接收到该 DHCPDECLINE报文后,利用接收的所述指示信息确定所述 DHCPDECLINE报文为 DHCP ·^艮文时, 将该 DHCPDECLINE ·^艮文转发给所述控制器, 所述控制器收到该 DHCPDECLINE报文后, 将该 IP地址标为不可用。 The communication device receives the DHCPACK packet containing the configuration parameter, and uses the ARP packet to detect whether the other network device on the network is using the IP address. If it is confirmed that no other network device is using the IP address on the network, the communication device accepts the IP address and its configuration parameters. If another network device is found to be using the IP address, the communication device sends a DHCPDECLINE message and resends the DHCPDI SC0VER 4 message requesting an IP address. After receiving the DHCPDECLINE message, the switch uses the received indication information to determine that the DHCPDECLINE message is a DHCP message, and forwards the DHCPDECLINE message to the controller, where the controller After receiving the DHCPDECLINE message, the IP address is marked as unavailable.
所述通信设备不再需要使用该 IP地址时, 可以主动发送 DHCPRELEASE报 文, 以释放该 IP地址。 所述交换机接收到该 DHCPRELEASE ^艮文后, 利用接收 的所述指示信息确定所述 DHCPRELEASE ^艮文为 DHCP ^艮文时,将该 DHCPRELEASE 报文转发给所述控制器, 所述控制器收到该 DHCPRELEASE报文后, 释放该 IP 地址。 根据本发明实施例 1 , 本发明实施例 3提出了一种交换机 500。 如图 7所 示, 交换机 500包括: 接收单元 501、 处理单元 502和路由单元 503。
接收单元 501 , 用于接收接入所述交换机的通信设备发送的报文,还用于 将接收的所述报文发送给处理单元 502 ; When the communication device no longer needs to use the IP address, it can actively send a DHCPRELEASE message to release the IP address. After receiving the DHCPRELEASE message, the switch uses the received indication information to determine that the DHCPRELEASE message is a DHCP message, and forwards the DHCPRELEASE message to the controller, where the controller receives After the DHCPRELEASE message is sent, the IP address is released. According to Embodiment 1 of the present invention, Embodiment 3 of the present invention proposes a switch 500. As shown in FIG. 7, the switch 500 includes: a receiving unit 501, a processing unit 502, and a routing unit 503. The receiving unit 501 is configured to receive the packet sent by the communication device that accesses the switch, and is further configured to send the received packet to the processing unit 502.
处理单元 502 , 用于从接收单元 501接收所述报文, 在确定所述报文为以 广播方式发送的 DHCP报文时获取所述通信设备对应的 DHCP服务器的路由地 址, 将所述 DHCP报文的目的地址字段的广播地址替换为所述 DHCP服务器的 路由地址, 并将修改后的 DHCP报文发送给路由单元 503; The processing unit 502 is configured to receive the packet from the receiving unit 501, and obtain a routing address of the DHCP server corresponding to the communication device when the packet is determined to be a DHCP message sent by the broadcast, and the DHCP message is sent. The broadcast address of the destination address field is replaced with the routing address of the DHCP server, and the modified DHCP message is sent to the routing unit 503;
路由单元 503 , 用于从处理单元 502接收所述修改后的 DHCP报文, 根据 所述修改后的 DHCP ^艮文中的路由地址将所述修改后的 DHCP ^艮文路由至所述 The routing unit 503 is configured to receive, by the processing unit 502, the modified DHCP message, and route the modified DHCP message according to the routing address in the modified DHCP message to the
DHCP服务器。 在一种具体的实施方式中, 所述 DHCP服务器的路由地址包括所述 DHCP 月良务器的 IP地址和 MAC地址; 处理单元 502用于将所述 DHCP ^艮文的目的地 址字段的广播地址替换为所述 DHCP服务器的路由地址具体包括,处理单元 502 用于将所述 DHCP报文的目的 IP地址字段的广播 IP地址替换为所述 DHCP服 务器的 IP地址, 并将所述 DHCP报文的目的 MAC地址字段的广播 MAC地址替 换为所述 DHCP服务器的 MAC地址。 DHCP server. In a specific implementation manner, the routing address of the DHCP server includes an IP address and a MAC address of the DHCP server; and the processing unit 502 is configured to: broadcast a destination address field of the DHCP message The replacement of the routing address of the DHCP server includes: the processing unit 502 is configured to replace the broadcast IP address of the destination IP address field of the DHCP message with the IP address of the DHCP server, and the DHCP message is The broadcast MAC address of the destination MAC address field is replaced with the MAC address of the DHCP server.
所述接收单元还可以用于接收与所述交换机通信的控制器发送的路由指 示信息, 所述路由指示信息包括所述 DHCP服务器的路由地址、 以及用于指示 所述交换机将接收的以广播方式发送的 DHCP报文路由至所述 DHCP服务器的 路由指示; 相应地, 处理单元 502 用于在确定所述报文为以广播方式发送的 DHCP报文时获取所述通信设备对应的 DHCP服务器的路由地址, 将所述 DHCP 报文的目的地址字段的广播地址替换为所述 DHCP服务器的路由地址, 具体包 括: 处理单元 502用于从所述路由指示信息中获取所述 DHCP服务器的路由地 址, 并根据所述路由指示信息中的路由指示将所述 DHCP报文的目的地址字段 的广播地址替换为所述 DHCP服务器的路由地址。 The receiving unit may be further configured to receive routing indication information sent by a controller that is in communication with the switch, where the routing indication information includes a routing address of the DHCP server, and is used to indicate that the switch will receive the broadcast mode. The routing information of the DHCP server is sent to the DHCP server. Correspondingly, the processing unit 502 is configured to acquire the route of the DHCP server corresponding to the communication device when the packet is determined to be a DHCP message sent by the broadcast mode. The address, the broadcast address of the destination address field of the DHCP message is replaced with the routing address of the DHCP server, and the processing unit 502 is configured to obtain the routing address of the DHCP server from the routing indication information, and And replacing the broadcast address of the destination address field of the DHCP message with the routing address of the DHCP server according to the routing indication in the routing indication information.
所述交换机还可以包括接入单元, 用于在所述通信设备接入所述交换机 后向所述控制器发送所述通信设备的标识; 所述路由指示信息还包括所述通 信设备的标识与所述 DHCP服务器的路由地址的映射关系, 所述路由指示具体
用于指示所述交换机将接收自所述通信设备的以广播方式发送的 DHCP报文路 由至所述 DHCP服务器; 相应地, 处理单元 502用于获取所述通信设备对应的 DHCP服务器的路由地址, 具体包括: 处理单元 502用于从所述 DHCP报文中获 取所述通信设备的标识, 并根据所述路由指示信息中的映射关系获取所述通 信设备的标识对应的所述 DHCP服务器的路由地址。 根据本发明实施例 1 , 本发明实施例 4提出了一种控制器 600。 如图 8所 示, 控制器 600包括: 生成单元 601和发送单元 602。 生成单元 601 , 用于生成路由指示信息, 所述路由指示信息包括 DHCP服 务器的路由地址、 以及用于指示交换机将接收的以广播方式发送的 DHCP报文 路由至所述 DHCP服务器的路由指示, 并用于将所述路由指示信息发送给发送 单元 602。 所述 DHCP服务器的路由地址具体可以包括所述 DHCP服务器的 IP 地址和 MAC地址。 The switch may further include an access unit, configured to send an identifier of the communication device to the controller after the communication device accesses the switch; the routing indication information further includes an identifier of the communication device Mapping relationship of a routing address of the DHCP server, where the routing instruction is specific For instructing the switch to route the DHCP message sent by the communication device to the DHCP server; correspondingly, the processing unit 502 is configured to obtain a routing address of the DHCP server corresponding to the communication device, Specifically, the processing unit 502 is configured to obtain the identifier of the communications device from the DHCP packet, and obtain a routing address of the DHCP server corresponding to the identifier of the communications device according to the mapping relationship in the routing indication information. . According to Embodiment 1 of the present invention, Embodiment 4 of the present invention proposes a controller 600. As shown in FIG. 8, the controller 600 includes: a generating unit 601 and a transmitting unit 602. The generating unit 601 is configured to generate routing indication information, where the routing indication information includes a routing address of the DHCP server, and a routing instruction for instructing the switch to route the received DHCP message sent by the switch to the DHCP server, and use the route indication The routing indication information is sent to the sending unit 602. The routing address of the DHCP server may specifically include an IP address and a MAC address of the DHCP server.
发送单元 602 , 用于从生成单元 601接收所述路由指示信息, 还用于向与 所述控制器通信的交换机发送所述路由指示信息, 以使得所述交换机在接收 到以广播方式发送的 DHCP报文时, 根据所述路由指示信息中的所述 DHCP服 务器的路由地址将所述 DHCP报文路由至所述 DHCP服务器。 所述控制器还可以包括接收单元, 用于接收所述交换机在所述通信设备 接入所述交换机时发送的所述通信设备的标识, 并用于将所述通信设备的标 识发送给所述确定单元; 生成单元 601 , 还用于从所述接收单元接收所述通信 设备的标识, 并确定所述通信设备所对应的 DHCP服务器; 相应地, 生成单元 601生成的所述路由指示信息还包括通信设备的标识与所述 DHCP服务器的路 由地址的映射关系, 所述路由指示具体用于指示所述交换机将接收自所述通 信设备的以广播方式发送的 DHCP报文路由至所述 DHCP服务器, 以使得: 所 述交换机在接收到所述通信设备发送的包含所述通信设备的标识的所述 DHCP 报文时,根据所述映射关系获取所述 DHCP服务器的路由地址并根据所述 DHCP 服务器的路由地址将所述 DHCP报文路由至所述 DHCP服务器。
根据本发明实施例 2 , 本发明实施例 5提出了一种交换机 700。 如图 9所 示, 交换机 700包括: 接收单元 701和转发单元 702。 接收单元 701 , 用于接收接入所述交换机的通信设备发送的报文, 并将所 述报文发送给转发单元 702 ; The sending unit 602 is configured to receive the routing indication information from the generating unit 601, and is further configured to send the routing indication information to a switch that communicates with the controller, so that the switch receives the DHCP sent by the broadcast mode. And sending, by the DHCP server, the DHCP message to the DHCP server according to the routing address of the DHCP server in the routing indication information. The controller may further include a receiving unit, configured to receive an identifier of the communications device that is sent by the switch when the communications device accesses the switch, and configured to send the identifier of the communications device to the determining a generating unit 601, configured to receive an identifier of the communications device from the receiving unit, and determine a DHCP server corresponding to the communications device; and correspondingly, the routing indication information generated by the generating unit 601 further includes communications The mapping between the identifier of the device and the routing address of the DHCP server, where the routing indication is specifically used to instruct the switch to route the DHCP message sent by the communication device to the DHCP server, When the switch receives the DHCP message including the identifier of the communication device, the switch obtains the routing address of the DHCP server according to the mapping relationship and according to the route of the DHCP server. The address routes the DHCP message to the DHCP server. According to Embodiment 2 of the present invention, Embodiment 5 of the present invention proposes a switch 700. As shown in FIG. 9, the switch 700 includes: a receiving unit 701 and a forwarding unit 702. The receiving unit 701 is configured to receive a packet sent by the communication device that accesses the switch, and send the packet to the forwarding unit 702.
转发单元 702 , 用于从接收单元 701接收所述报文, 并在确定所述报文为 The forwarding unit 702 is configured to receive the packet from the receiving unit 701, and determine that the packet is
DHCP报文时将所述 DHCP报文转发至与所述交换机通信的控制器,以使得所述 控制器根据所述 DHCP报文为所述通信设备提供 DHCP服务。 接收单元 701 还可以用于接收所述控制器发送的指示信息, 所述指示信 息用于指示所述交换机将接收的 DHCP报文转发至所述控制器; 相应地, 转发 单元 702具体用于根据所述指示信息执行在确定所述报文为 DHCP报文时将所 述 DHCP报文转发至所述控制器的操作。 The DHCP message is forwarded to the controller in communication with the switch, so that the controller provides a DHCP service for the communication device according to the DHCP message. The receiving unit 701 is further configured to receive the indication information that is sent by the controller, where the indication information is used to instruct the switch to forward the received DHCP message to the controller. Correspondingly, the forwarding unit 702 is specifically configured to The indication information performs an operation of forwarding the DHCP message to the controller when determining that the message is a DHCP message.
所述交换机还可以包括接入单元, 用于在所述通信设备通过所述交换机 上的端口接入所述交换机时, 向所述控制器发送所述端口的端口号; 接收单 元 701 , 还用于接收所述控制器发送的携带 DHCP报文和所述端口号的数据报 文, 并将所述数据报文发送给转发单元 702 ; 相应地, 转发单元 702 , 还用于 从接收单元 701 接收所述数据报文, 并通过所述数据报文中的端口号所标识 的端口将所述数据报文携带的 DHCP报文发送给所述通信设备。 根据本发明实施例 2 , 本发明实施例 6提出了一种控制器 800。 如图 10 所示, 控制器 800包括: 发送单元 801、 接收单元 802和服务单元 803。 发送单元 801 , 用于向与所述控制器通信的交换机发送指示信息, 所述指 示信息用于指示所述交换机将接收的 DHCP报文转发至所述控制器; The switch may further include an access unit, configured to send a port number of the port to the controller when the communication device accesses the switch through a port on the switch; and the receiving unit 701 further uses And receiving the data packet that is sent by the controller and carrying the DHCP packet and the port number, and sending the data packet to the forwarding unit 702. Correspondingly, the forwarding unit 702 is further configured to receive from the receiving unit 701. Sending, by the data packet, the DHCP message carried by the data packet to the communication device by using the port identified by the port number in the data packet. According to Embodiment 2 of the present invention, Embodiment 6 of the present invention proposes a controller 800. As shown in FIG. 10, the controller 800 includes: a transmitting unit 801, a receiving unit 802, and a service unit 803. The sending unit 801 is configured to send, to the switch that communicates with the controller, the indication information, where the indication information is used to instruct the switch to forward the received DHCP message to the controller;
接收单元 802 ,用于接收所述交换机根据所述指示信息在确定接收自接入 所述交换机的通信设备的报文为 DHCP报文时向所述控制器转发的所述 DHCP 报文, 并用于向服务单元 803发送所述 DHCP报文; The receiving unit 802 is configured to receive, by the switch, the DHCP message forwarded to the controller when the packet received by the communication device that accesses the switch is a DHCP message according to the indication information, and is used by the switch Sending the DHCP message to the service unit 803;
服务单元 803 , 用于从接收单元 802接收所述 DHCP报文, 并用于根据所
述 DHCP报文为所述通信设备提供 DHCP服务。 a service unit 803, configured to receive the DHCP message from the receiving unit 802, and used to The DHCP message provides a DHCP service for the communication device.
接收单元 802,还可以用于接收所述交换机在所述通信设备通过所述交换 机上的端口接入所述交换机时发送的所述端口的端口号, 并用于将所述端口 号发送给服务单元 803; 相应地, 服务单元 803还用于从接收单元 802接收所 述端口号。 服务单元 803用于根据所述 DHCP报文为所述通信设备提供 DHCP 服务具体包括:服务单元 803用于构造包括所述 DHCP服务对应的数据的 DHCP 报文, 将构造的 DHCP报文和所述端口号封装到数据报文中, 并用于将所述数 据报文发送给发送单元 801。 发送单元 801, 还用于从服务单元 803接收所述 数据报文, 并用于将所述数据报文发送给所述交换机, 以使得所述交换机通 过所述数据报文中的端口号所标识的端口将所述数据报文携带的 DHCP报文发 送给所述通信设备。 根据本发明实施例 1, 本发明实施例 7提供了一种交换机 1000。 如图 11 所示, 交换机 1000包括处理器(processor) 1010和存储器(memory) 1020, 其中, 处理器 1010和存储器 1020之间通过总线完成相互间的通信。 The receiving unit 802 is further configured to receive, by the switch, a port number of the port that is sent when the communications device accesses the switch through a port on the switch, and send the port number to the service unit. 803; Correspondingly, the service unit 803 is further configured to receive the port number from the receiving unit 802. The service unit 803 is configured to provide the DHCP service to the communication device according to the DHCP message, and the method includes: the service unit 803 is configured to construct a DHCP message including data corresponding to the DHCP service, and the configured DHCP message and the The port number is encapsulated into the data packet, and is used to send the data packet to the sending unit 801. The sending unit 801 is further configured to receive the data packet from the service unit 803, and send the data packet to the switch, so that the switch identifies by using a port number in the data packet. The port sends the DHCP packet carried by the data packet to the communication device. According to Embodiment 1 of the present invention, Embodiment 7 of the present invention provides a switch 1000. As shown in FIG. 11, the switch 1000 includes a processor 1010 and a memory 1020, wherein the communication between the processor 1010 and the memory 1020 is completed by a bus.
存储器 1020, 用于存放计算机操作指令。 存储器 1020可能包含高速 RAM 存储器, 也可能还包括非易失性存储器 (non-volatile memory), 例如至少 一个磁盘存储器。 The memory 1020 is configured to store computer operation instructions. The memory 1020 may include a high speed RAM memory and may also include a non-volatile memory such as at least one disk memory.
处理器 1010, 用于执行存储器 1020 中存放的计算机操作指令。 处理器 1010具体可以是中央处理器 (CPU, central processing unit ), 是计算机核 心单元。 The processor 1010 is configured to execute computer operation instructions stored in the memory 1020. The processor 1010 may specifically be a central processing unit (CPU) and is a computer core unit.
其中, 处理器 1010执行所述计算机操作指令使得交换机 1000执行如下 操作: 接收接入交换机 1000的通信设备发送的报文; The processor 1010 executes the computer operation instruction, so that the switch 1000 performs the following operations: receiving a message sent by the communication device of the access switch 1000;
在确定所述报文为以广播方式发送的 DHCP报文时获取所述通信设备对应 的 DHCP 务器的路由地址, 并将所述 DHCP ^艮文的目的地址字段的广播地址
替换为所述 DHCP服务器的路由地址, 所述 DHCP报文具体可以为 DHCP发现报 文或 DHCP请求 ^艮文; Obtaining a routing address of the DHCP server corresponding to the communication device when the packet is a DHCP message sent by the broadcast, and setting a broadcast address of the destination address field of the DHCP message And being replaced by the routing address of the DHCP server, where the DHCP packet may be a DHCP discovery packet or a DHCP request message;
根据修改后的 DHCP报文中的路由地址将所述修改后的 DHCP报文路由至 所述 DHCP服务器。 所述 DHCP服务器的路由地址具体可以包括所述 DHCP服务器的 IP地址和 MAC地址; 相应地, 所述将所述 DHCP ^艮文的目的地址字段的广播地址替换为 所述 DHCP服务器的路由地址, 具体可以包括: 将所述 DHCP报文的目的 IP地 址字段的广播 IP地址替换为所述 DHCP服务器的 IP地址, 并将所述 DHCP报 文的目的 MAC地址字段的广播 MAC地址替换为所述 DHCP服务器的 MAC地址。 The modified DHCP packet is routed to the DHCP server according to the routing address in the modified DHCP packet. The routing address of the DHCP server may include the IP address and the MAC address of the DHCP server. Correspondingly, the broadcast address of the destination address field of the DHCP message is replaced with the routing address of the DHCP server. The method may include: replacing the broadcast IP address of the destination IP address field of the DHCP message with the IP address of the DHCP server, and replacing the broadcast MAC address of the destination MAC address field of the DHCP message with the DHCP The MAC address of the server.
处理器 1010执行所述计算机操作指令还可以进一步使得交换机 1000执 行如下操作: 接收与交换机 1000通信的控制器发送的路由指示信息, 所述路 由指示信息包括所述 DHCP服务器的路由地址、 以及用于指示交换机 1000将 接收的以广播方式发送的 DHCP报文路由至所述 DHCP服务器的路由指示。 相 应的, 所述获取所述通信设备对应的 DHCP服务器的路由地址, 并将所述 DHCP 报文的目的地址字段的广播地址替换为所述 DHCP服务器的路由地址, 具体包 括: 从所述路由指示信息中获取所述 DHCP服务器的路由地址, 并根据所述路 由指示信息中的路由指示将所述 DHCP报文的目的地址字段的广播地址替换为 所述 DHCP服务器的路由地址。 The processor 1010 executing the computer operation instructions may further cause the switch 1000 to perform the following operations: receiving routing indication information sent by a controller in communication with the switch 1000, the routing indication information including a routing address of the DHCP server, and Instructing the switch 1000 to route the received broadcasted DHCP message to the routing indication of the DHCP server. Correspondingly, the obtaining the routing address of the DHCP server corresponding to the communication device, and replacing the broadcast address of the destination address field of the DHCP packet with the routing address of the DHCP server, specifically includes: Obtaining, by the information, the routing address of the DHCP server, and replacing the broadcast address of the destination address field of the DHCP packet with the routing address of the DHCP server according to the routing indication in the routing indication information.
处理器 1010执行所述计算机操作指令还可以进一步使得交换机 1000执 行如下操作: 在所述通信设备接入交换机 1000后向所述控制器发送所述通信 设备的标识。 相应地, 所述路由指示信息还包括所述通信设备的标识与所述 DHCP服务器的路由地址的映射关系; 所述路由指示具体用于指示交换机 1000 将接收自所述通信设备的以广播方式发送的 DHCP报文路由至所述 DHCP服务 器; 所述获取所述通信设备对应的 DHCP服务器的路由地址具体包括, 从所述 DHCP报文中获取所述通信设备的标识, 并根据所述路由指示信息中的映射关 系获取所述通信设备的标识对应的所述 DHCP服务器的路由地址。
根据本发明实施例 1 , 本发明实施例 8提供了一种控制器 2000。 如图 12 所示, 控制器 2000包括处理器(proces sor) 2010和存储器(memory) 2020 , 其中, 处理器 2010和存储器 2020之间通过总线完成相互间的通信。 Executing the computer operating instructions by the processor 1010 may further cause the switch 1000 to perform the following operations: transmitting an identification of the communication device to the controller after the communication device accesses the switch 1000. Correspondingly, the routing indication information further includes a mapping relationship between the identifier of the communication device and a routing address of the DHCP server; the routing indication is specifically used to indicate that the switch 1000 will receive the broadcast device from the communication device. The DHCP message is routed to the DHCP server. The obtaining the routing address of the DHCP server corresponding to the communication device includes: obtaining the identifier of the communication device from the DHCP packet, and according to the routing indication information The mapping relationship in the obtaining the routing address of the DHCP server corresponding to the identifier of the communication device. According to Embodiment 1 of the present invention, Embodiment 8 of the present invention provides a controller 2000. As shown in FIG. 12, the controller 2000 includes a processor (proces sor) 2010 and a memory 2020, wherein the communication between the processor 2010 and the memory 2020 is completed by a bus.
存储器 2020 , 用于存放计算机操作指令。 存储器 2020可能包含高速 RAM 存储器, 也可能还包括非易失性存储器 (non-vo l a t i le memory ), 例如至少 一个磁盘存储器。 The memory 2020 is configured to store computer operation instructions. Memory 2020 may include high speed RAM memory and may also include non-volatile memory, such as at least one disk memory.
处理器 2010 , 用于执行存储器 2020 中存放的计算机操作指令。 处理器 2010具体可以是中央处理器 (CPU , cent ra l proces s ing uni t ), 是计算机核 心单元。 其中, 处理器 2010执行所述计算机操作指令使得控制器 2000执行如下 操作: 生成路由指示信息, 所述路由指示信息包括 DHCP服务器的路由地址、 以及用于指示交换机将接收的以广播方式发送的 DHCP报文路由至所述 DHCP 服务器的路由指示, 所述 DHCP服务器的路由地址可以包括所述 DHCP服务器 的 IP地址和 MAC地址; 向与控制器 2000通信的交换机发送所述路由指示信 息, 以使得所述交换机在接收到以广播方式发送的 DHCP报文时, 根据所述路 由指示信息中的所述 DHCP 服务器的路由地址将所述 DHCP 报文路由至所述 DHCP服务器。 The processor 2010 is configured to execute computer operation instructions stored in the memory 2020. The processor 2010 may specifically be a central processing unit (CPU, cent ra l proces s ing uni t ) and is a computer core unit. The processor 2010 executes the computer operation instruction, so that the controller 2000 performs the following operations: generating routing indication information, where the routing indication information includes a routing address of the DHCP server, and a DHCP for indicating that the switch will receive the broadcast. And routing the message to the DHCP server, the routing address of the DHCP server may include an IP address and a MAC address of the DHCP server; and sending the routing indication information to a switch that communicates with the controller 2000, so that When receiving the DHCP message sent by the broadcast, the switch routes the DHCP message to the DHCP server according to the routing address of the DHCP server in the routing indication information.
处理器 2010执行所述计算机操作指令还可以进一步使得控制器 2000执 行如下操作: 接收所述交换机在所述通信设备接入所述交换机时发送的所述 通信设备的标识, 并确定所述通信设备所对应的 DHCP服务器。 相应地, 所述 路由指示信息还包括通信设备的标识与所述 DHCP服务器的路由地址的映射关 系, 所述路由指示具体用于指示所述交换机将接收自所述通信设备的以广播 方式发送的 DHCP报文路由至所述 DHCP服务器, 以使得: 所述交换机在接收 到所述通信设备发送的包含所述通信设备的标识的所述 DHCP报文时, 根据所 述映射关系获取所述 DHCP服务器的路由地址并根据所述 DHCP服务器的路由 地址将所述 DHCP报文路由至所述 DHCP服务器。
根据本发明实施例 2 , 本发明实施例 9提供了一种交换机 3000。 如图 13 所示, 交换机 3000包括处理器(proces sor) 3010和存储器(memory) 3020 , 其中, 处理器 3010和存储器 3020之间通过总线完成相互间的通信。 The processor 2010 executing the computer operation instructions may further cause the controller 2000 to perform the following operations: receiving an identifier of the communication device sent by the switch when the communication device accesses the switch, and determining the communication device The corresponding DHCP server. Correspondingly, the routing indication information further includes a mapping relationship between the identifier of the communication device and the routing address of the DHCP server, where the routing indication is specifically used to indicate that the switch will receive the broadcast mode from the communication device. The DHCP message is routed to the DHCP server, so that: the switch acquires the DHCP server according to the mapping relationship when receiving the DHCP message that is sent by the communication device and includes the identifier of the communication device. Routing address and routing the DHCP message to the DHCP server according to the routing address of the DHCP server. According to Embodiment 2 of the present invention, Embodiment 9 of the present invention provides a switch 3000. As shown in FIG. 13, the switch 3000 includes a processor (proces sor) 3010 and a memory 3020, wherein the communication between the processor 3010 and the memory 3020 is completed by a bus.
存储器 3020 , 用于存放计算机操作指令。 存储器 3020可能包含高速 RAM 存储器, 也可能还包括非易失性存储器 (non-volat i le memory ), 例如至少 一个磁盘存储器。 The memory 3020 is configured to store computer operation instructions. The memory 3020 may include a high speed RAM memory and may also include a non-volatile memory, such as at least one disk memory.
处理器 3010 , 用于执行存储器 3020 中存放的计算机操作指令。 处理器 3010具体可以是中央处理器 (CPU, cent ra l proces s ing uni t ), 是计算机核 心单元。 The processor 3010 is configured to execute computer operation instructions stored in the memory 3020. The processor 3010 may specifically be a central processing unit (CPU, cent ra l proces s ing uni t ) and is a computer core unit.
其中, 处理器 3010执行所述计算机操作指令使得交换机 3000执行如下 操作: 接收接入交换机 3000的通信设备发送的报文; 在确定所述报文为 DHCP 报文时将所述 DHCP报文转发至与交换机 3000通信的控制器, 以使得所述控 制器根据所述 DHCP报文为所述通信设备提供 DHCP服务。 处理器 3010执行所述计算机操作指令还可以进一步使得交换机 3000执 行如下操作: 接收所述控制器发送的指示信息, 所述指示信息用于指示交换 机 3000将接收的 DHCP报文转发至所述控制器。 相应地, 处理器 3010执行所 述计算机操作指令使得交换机 3000根据所述指示信息执行在确定所述报文为 DHCP报文时将所述 DHCP报文转发至所述控制器的操作。 The processor 3010 executes the computer operation instruction, so that the switch 3000 performs the following operations: receiving a message sent by the communication device of the access switch 3000; and forwarding the DHCP message to the DHCP message when determining that the message is a DHCP message A controller in communication with the switch 3000 to cause the controller to provide a DHCP service to the communication device according to the DHCP message. The executing the computer operation instruction by the processor 3010 may further enable the switch 3000 to perform the following operations: receiving the indication information sent by the controller, where the indication information is used to instruct the switch 3000 to forward the received DHCP message to the controller . Correspondingly, the processor 3010 executes the computer operation instruction to cause the switch 3000 to perform an operation of forwarding the DHCP message to the controller when determining that the message is a DHCP message according to the indication information.
处理器 3010执行所述计算机操作指令还可以进一步使得交换机 3000执 行如下操作: 在所述通信设备通过交换机 3000上的端口接入交换机 3000时, 向所述控制器发送所述端口的端口号; 接收到所述控制器发送的携带 DHCP报 文和所述端口号的数据报文时, 通过所述数据报文中的端口号所标识的端口 将所述数据报文携带的 DHCP报文发送给所述通信设备。 根据本发明实施例 2 , 本发明实施例 10提供了一种控制器 4000。 如图 14
所示, 控制器 4000包括处理器(proces sor) 4010和存储器(memory) 4020 , 其 中, 处理器 4010和存储器 4020之间通过总线完成相互间的通信。 The processor 3010 executing the computer operation instructions may further cause the switch 3000 to perform the following operations: when the communication device accesses the switch 3000 through a port on the switch 3000, send the port number of the port to the controller; And sending, by the controller, the DHCP packet carrying the DHCP packet and the port number to the DHCP message carried by the data packet by using the port identified by the port number in the data packet Said communication device. According to Embodiment 2 of the present invention, Embodiment 10 of the present invention provides a controller 4000. Figure 14 As shown, the controller 4000 includes a processor 4010 and a memory 4020, wherein communication between the processor 4010 and the memory 4020 is accomplished by a bus.
存储器 4020 , 用于存放计算机操作指令。 存储器 4020可能包含高速 RAM 存储器, 也可能还包括非易失性存储器 (non-volat i le memory ), 例如至少 一个磁盘存储器。 The memory 4020 is configured to store computer operation instructions. The memory 4020 may include a high speed RAM memory and may also include a non-volatile memory such as at least one disk memory.
处理器 4010 , 用于执行存储器 4020 中存放的计算机操作指令。 处理器 4010具体可以是中央处理器 (CPU, cent ra l proces s ing uni t ), 是计算机核 心单元。 其中, 处理器 4010执行所述计算机操作指令使得控制器 4000执行如下 操作: 向与控制器 4000通信的交换机发送指示信息, 所述指示信息用于指示 所述交换机将接收的 DHCP报文转发至控制器 4000;接收所述交换机根据所述 指示信息在确定接收自接入所述交换机的通信设备的报文为 DHCP报文时向控 制器 4000转发的所述 DHCP报文;根据所述 DHCP报文为所述通信设备提供 DHCP 服务。 The processor 4010 is configured to execute computer operation instructions stored in the memory 4020. The processor 4010 may specifically be a central processing unit (CPU, cent ra l proces s ing uni t ) and is a computer core unit. The processor 4010 executes the computer operation instruction, so that the controller 4000 performs the following operations: sending indication information to the switch that communicates with the controller 4000, the indication information is used to instruct the switch to forward the received DHCP message to the control. And receiving, by the switch, the DHCP message forwarded to the controller 4000 when the packet received by the communication device that accesses the switch is a DHCP message according to the indication information; and the DHCP message according to the DHCP message A DHCP service is provided for the communication device.
处理器 4010执行所述计算机操作指令还可以进一步使得控制器 4000执 行如下操作: 接收所述交换机在所述通信设备通过所述交换机上的端口接入 所述交换机时发送的所述端口的端口号; 所述根据所述 DHCP报文为所述通信 设备提供 DHCP服务具体包括, 构造包括所述 DHCP服务对应的数据的 DHCP报 文,并将构造的 DHCP报文和所述端口号封装到数据报文中发送给所述交换机, 以使得所述交换机通过所述数据报文中的端口号所标识的端口将所述数据报 文携带的 DHCP报文发送给所述通信设备。 根据本发明实施例 1 , 本发明实施例 11提出了一种通信系统 5000 , 如图 15所示, 通信系统 5000包括控制器 5010和交换机 5020 , 其中, 控制器 5010 与交换机 5020通过网络通信。 控制器 5010 , 用于生成路由指示信息, 所述路由指示信息包括 DHCP服务
器的路由地址、 以及用于指示交换机将接收的以广播方式发送的 DHCP报文路 由至所述 DHCP服务器的路由指示, 还用于向交换机 5020发送所述路由指示 信息; The processor 4010 executing the computer operation instructions may further cause the controller 4000 to perform the following operations: receiving a port number of the port sent by the switch when the communication device accesses the switch through a port on the switch The providing the DHCP service to the communication device according to the DHCP message specifically includes: constructing a DHCP message including data corresponding to the DHCP service, and encapsulating the constructed DHCP message and the port number into the datagram The message is sent to the switch, so that the switch sends the DHCP message carried by the data packet to the communication device by using the port identified by the port number in the data packet. According to Embodiment 1 of the present invention, Embodiment 11 of the present invention proposes a communication system 5000. As shown in FIG. 15, the communication system 5000 includes a controller 5010 and a switch 5020, wherein the controller 5010 communicates with the switch 5020 through a network. The controller 5010 is configured to generate routing indication information, where the routing indication information includes a DHCP service. And the route indication of the router, and the route indication that is sent to the DHCP server by the switch to be sent by the switch to the switch 5020;
交换机 5020 , 用于接收接入交换机 5020的通信设备发送的报文, 在确定 所述报文为以广播方式发送的 DHCP报文时, 从所述路由指示信息中获取所述 DHCP服务器的路由地址, 并根据所述路由指示信息中的路由指示将所述 DHCP 报文的目的地址字段的广播地址替换为所述 DHCP服务器的路由地址, 还用于 根据修改后的 DHCP报文中的路由地址将所述修改后的 DHCP报文路由至所述 DHCP服务器。 The switch 5020 is configured to receive the packet sent by the communication device of the access switch 5020, and obtain the routing address of the DHCP server from the routing indication information when determining that the packet is a DHCP message sent by the broadcast mode. And replacing, according to the routing indication in the routing indication information, the broadcast address of the destination address field of the DHCP packet with the routing address of the DHCP server, and also according to the routing address in the modified DHCP packet. The modified DHCP message is routed to the DHCP server.
所述 DHCP服务器的路由地址具体可以包括所述 DHCP服务器的 IP地址和 MAC地址; 相应地, 交换机 5020用于将所述 DHCP报文的目的地址字段的广播 地址替换为所述 DHCP服务器的路由地址, 具体包括: 交换机 5020用于将所 述 DHCP ^艮文的目的 IP地址字段的广播 IP地址替换为所述 DHCP服务器的 IP 地址,并将所述 DHCP ^艮文的目的 MAC地址字段的广播 MAC地址替换为所述 DHCP 服务器的 MAC地址。 The routing address of the DHCP server may include the IP address and the MAC address of the DHCP server. Correspondingly, the switch 5020 is configured to replace the broadcast address of the destination address field of the DHCP packet with the routing address of the DHCP server. Specifically, the switch 5020 is configured to replace the broadcast IP address of the destination IP address field of the DHCP message with the IP address of the DHCP server, and broadcast the MAC address of the destination MAC address field of the DHCP message. The address is replaced with the MAC address of the DHCP server.
交换机 5020 , 还可以用于在所述通信设备接入交换机 5020后向控制器 The switch 5020 can also be used to connect the controller to the switch 5020 after the communication device is connected.
5010发送所述通信设备的标识; 控制器 5010 , 还可以用于确定所述通信设备 所对应的 DHCP服务器, 控制器 5010生成的所述路由指示信息还包括通信设 备的标识与所述 DHCP服务器的路由地址的映射关系, 所述路由指示具体用于 指示交换机 5020将接收自所述通信设备的以广播方式发送的 DHCP报文路由 至所述 DHCP服务器;相应地,交换机 5020用于获取所述通信设备对应的 DHCP 服务器的路由地址具体包括, 交换机 5020用于从所述 DHCP报文中获取所述 通信设备的标识, 并根据所述路由指示信息中的映射关系获取所述通信设备 的标识对应的所述 DHCP服务器的路由地址。 The controller 5010 is further configured to determine a DHCP server corresponding to the communication device, where the routing indication information generated by the controller 5010 further includes an identifier of the communication device and the DHCP server. a route mapping relationship, where the route indication is specifically used to instruct the switch 5020 to route the DHCP message sent by the communication device to the DHCP server; correspondingly, the switch 5020 is configured to acquire the communication. The routing address of the DHCP server corresponding to the device specifically includes: the switch 5020 is configured to obtain the identifier of the communication device from the DHCP packet, and obtain the identifier corresponding to the communication device according to the mapping relationship in the routing indication information. The routing address of the DHCP server.
本发明实施例 11中描述的通信系统可以用来实施上述实施例 1所述的方 法。
根据本发明实施例 2 , 本发明实施例 12提出了一种通信系统 6000 , 如图 16所示, 通信系统 6000包括控制器 6010和交换机 6020 , 其中, 控制器 6010 与交换机 6020通过网络通信。 控制器 6010 , 用于向交换机 6020发送指示信息, 所述指示信息用于指示 交换机 6020将接收的 DHCP报文转发至控制器 6010; The communication system described in Embodiment 11 of the present invention can be used to implement the method described in Embodiment 1 above. According to Embodiment 2 of the present invention, Embodiment 12 of the present invention provides a communication system 6000. As shown in FIG. 16, the communication system 6000 includes a controller 6010 and a switch 6020, wherein the controller 6010 and the switch 6020 communicate through a network. The controller 6010 is configured to send the indication information to the switch 6020, where the indication information is used to instruct the switch 6020 to forward the received DHCP message to the controller 6010;
交换机 6020 ,用于根据所述指示信息在确定所述报文为 DHCP报文时将所 述 DHCP报文转发至控制器 6010; The switch 6020 is configured to forward the DHCP message to the controller 6010 when determining that the message is a DHCP message according to the indication information;
控制器 6010 ,还用于根据所述 DHCP报文为所述通信设备提供 DHCP服务。 进一步地, 交换机 6020 , 还可以用于在所述通信设备通过交换机 6020上 的端口接入交换机 6020时, 向控制器 6010发送所述端口的端口号; 控制器 6010根据所述 DHCP报文为所述通信设备提供 DHCP服务具体包括,控制器 6010 构造包括所述 DHCP服务对应的数据的 DHCP报文, 并将构造的 DHCP报文和所 述端口号封装到数据报文中发送给交换机 6020; 交换机 6020 , 还用于通过所 述数据报文中的端口号所标识的端口将所述数据报文携带的 DHCP报文发送给 所述通信设备。 The controller 6010 is further configured to provide a DHCP service for the communication device according to the DHCP message. Further, the switch 6020 may be further configured to: when the communication device accesses the switch 6020 through the port on the switch 6020, send the port number of the port to the controller 6010; the controller 6010 is configured according to the DHCP message. The communication device provides the DHCP service, and the controller 6010 constructs a DHCP message including the data corresponding to the DHCP service, and encapsulates the constructed DHCP message and the port number into the data packet and sends the message to the switch 6020. 6020. The method further sends the DHCP message carried by the data packet to the communication device by using a port identified by the port number in the data packet.
本发明实施例 12中描述的通信系统可以用来实施上述实施例 2所述的方 法。 The communication system described in Embodiment 12 of the present invention can be used to implement the method described in Embodiment 2 above.
本领域普通技术人员可以意识到, 结合本文中所公开的实施例描述的各 示例的单元及算法步骤, 能够以电子硬件、 或者计算机软件和电子硬件的结 合来实现。 这些功能究竟以硬件还是软件方式来执行, 取决于技术方案的特 定应用和设计约束条件。 专业技术人员可以对每个特定的应用来使用不同方 法来实现所描述的功能, 但是这种实现不应认为超出本发明的范围。 Those of ordinary skill in the art will appreciate that the elements and algorithm steps of the various examples described in connection with the embodiments disclosed herein can be implemented in a combination of electronic hardware or computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the solution. A person skilled in the art can use different methods for implementing the described functions for each particular application, but such implementation should not be considered to be beyond the scope of the present invention.
所属领域的技术人员可以清楚地了解到, 为描述的方便和筒洁, 上述描 述的系统、 装置和单元的具体工作过程, 可以参考前述方法实施例中的对应 过程, 在此不再赘述。 It will be apparent to those skilled in the art that, for the convenience of the description and the cleaning process, the specific operation of the system, the device and the unit described above may be referred to the corresponding processes in the foregoing method embodiments, and details are not described herein again.
在本申请所提供的几个实施例中, 应该理解到, 所揭露的系统、 装置和
方法, 可以通过其它的方式实现。 例如, 以上所描述的装置实施例仅仅是示 意性的, 例如, 所述单元的划分, 仅仅为一种逻辑功能划分, 实际实现时可 以有另外的划分方式, 例如多个单元或组件可以结合或者可以集成到另一个 系统, 或一些特征可以忽略, 或不执行。 另一点, 所显示或讨论的相互之间 的耦合或直接耦合或通信连接可以是通过一些接口, 装置或单元的间接耦合 或通信连接, 可以是电性, 机械或其它的形式。 为单元显示的部件可以是或者也可以不是物理单元, 即可以位于一个地方, 或者也可以分布到多个网络单元上。 可以根据实际的需要选择其中的部分或 者全部单元来实现本实施例方案的目的。 In the several embodiments provided herein, it should be understood that the disclosed systems, devices, and The method can be implemented in other ways. For example, the device embodiments described above are merely illustrative. For example, the division of the unit is only a logical function division. In actual implementation, there may be another division manner, for example, multiple units or components may be combined or Can be integrated into another system, or some features can be ignored, or not executed. In addition, the mutual coupling or direct coupling or communication connection shown or discussed may be an indirect coupling or communication connection through some interface, device or unit, and may be in an electrical, mechanical or other form. The components displayed for the unit may or may not be physical units, ie may be located in one place, or may be distributed over multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of the embodiment.
另外, 在本发明各个实施例中的各功能单元可以集成在一个处理单元中, 也可以是各个单元单独物理存在, 也可以两个或两个以上单元集成在一个单 元中。 In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.
所述功能如果以软件功能单元的形式实现并作为独立的产品销售或使用 时, 可以存储在一个计算机可读取存储介质中。 基于这样的理解, 本发明的 技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的部分可 以以软件产品的形式体现出来, 该计算机软件产品存储在一个存储介质中, 包括若干指令用以使得一台计算机设备(可以是个人计算机, 服务器, 或者 网络设备等)执行本发明各个实施例所述方法的全部或部分步骤。 而前述的 存储介质包括: U盘、 移动硬盘、 只读存储器(ROM, Read-Only Memory ) 、 随机存取存储器 ( RAM, Random Acces s Memory ) 、 磁碟或者光盘等各种可以 存储程序代码的介质。 The functions, if implemented in the form of software functional units and sold or used as separate products, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present invention, which is essential or contributes to the prior art, or a part of the technical solution, may be embodied in the form of a software product, which is stored in a storage medium, including The instructions are used to cause a computer device (which may be a personal computer, server, or network device, etc.) to perform all or part of the steps of the methods described in various embodiments of the present invention. The foregoing storage medium includes: a USB flash drive, a removable hard disk, a read-only memory (ROM), a random access memory (RAM, Random Acces s Memory), a magnetic disk, or an optical disk, and the like, which can store program codes. medium.
以上所述, 仅为本发明的具体实施方式, 但本发明的保护范围并不局限 于此, 任何熟悉本技术领域的技术人员在本发明揭露的技术范围内, 可轻易 想到变化或替换, 都应涵盖在本发明的保护范围之内。 因此, 本发明的保护 范围应所述以权利要求的保护范围为准。
The above is only the specific embodiment of the present invention, but the scope of the present invention is not limited thereto, and any person skilled in the art can easily think of changes or substitutions within the technical scope of the present invention. It should be covered by the scope of the present invention. Therefore, the scope of the invention should be determined by the scope of the claims.
Claims
1. 一种动态分配 IP地址的方法, 其特征在于, 所述方法包括: A method for dynamically allocating an IP address, the method comprising:
交换机接收接入所述交换机的通信设备发送的报文; Receiving, by the switch, a packet sent by a communication device that accesses the switch;
所述交换机在确定所述报文为以广播方式发送的 DHCP报文时获取所述通信 设备对应的 DHCP服务器的路由地址, 并将所述 DHCP报文的目的地址字段的广 播地址替换为所述 DHCP服务器的路由地址; The switch obtains a routing address of the DHCP server corresponding to the communication device, and replaces the broadcast address of the destination address field of the DHCP message with the broadcast address, when the packet is determined to be a broadcast DHCP message. The routing address of the DHCP server;
所述交换机根据修改后的 DHCP报文中的路由地址将所述修改后的 DHCP报 文路由至所述 DHCP服务器。 The switch routes the modified DHCP message to the DHCP server according to the routing address in the modified DHCP message.
2. 如权利要求 1所述的方法, 其特征在于: 2. The method of claim 1 wherein:
所述 DHCP服务器的路由地址包括所述 DHCP服务器的 IP地址和 MAC地址; 所述交换机将所述 DHCP报文的目的地址字段的广播地址替换为所述 DHCP 服务器的路由地址, 具体包括: 所述交换机将所述 DHCP报文的目的 IP地址字 段的广播 IP地址替换为所述 DHCP服务器的 IP地址, 并将所述 DHCP报文的目 的 MAC地址字段的广播 MAC地址替换为所述 DHCP服务器的 MAC地址。 The routing address of the DHCP server includes the IP address and the MAC address of the DHCP server. The switch replaces the broadcast address of the destination address field of the DHCP packet with the routing address of the DHCP server, and the specific information includes: The switch replaces the broadcast IP address of the destination IP address field of the DHCP message with the IP address of the DHCP server, and replaces the broadcast MAC address of the destination MAC address field of the DHCP message with the MAC address of the DHCP server. address.
3. 如权利要求 1或 2所述的方法, 其特征在于, 3. The method of claim 1 or 2, wherein
所述交换机获取所述 DHCP服务器的路由地址之前还包括, 所述交换机接收 与所述交换机通信的控制器发送的路由指示信息, 所述路由指示信息包括所述 DHCP服务器的路由地址、 以及用于指示所述交换机将接收的以广播方式发送的 DHCP报文路由至所述 DHCP服务器的路由指示; Before the switch obtains the routing address of the DHCP server, the switch further includes: the switch receives routing indication information sent by a controller that communicates with the switch, where the routing indication information includes a routing address of the DHCP server, and is used for Instructing the switch to route the received broadcast message sent by the broadcast to the DHCP server;
所述获取所述通信设备对应的 DHCP服务器的路由地址, 并将所述 DHCP报 文的目的地址字段的广播地址替换为所述 DHCP服务器的路由地址, 具体包括: 从所述路由指示信息中获取所述 DHCP服务器的路由地址, 并根据所述路由指示 信息中的路由指示将所述 DHCP报文的目的地址字段的广播地址替换为所述 DHCP 服务器的路由地址。 And the obtaining the routing address of the DHCP server corresponding to the communication device, and replacing the broadcast address of the destination address field of the DHCP packet with the routing address of the DHCP server, specifically: acquiring the routing indication information And the routing address of the DHCP server, and replacing the broadcast address of the destination address field of the DHCP packet with the routing address of the DHCP server according to the routing indication in the routing indication information.
4. 如权利要求 3所述的方法, 其特征在于, 所述交换机接收与所述交换机 通信的控制器发送的路由指示信息之前还包括: 所述交换机在所述通信设备接 入所述交换机后向所述控制器发送所述通信设备的标识;
所述路由指示信息还包括所述通信设备的标识与所述 DHCP服务器的路由地 址的映射关系; 所述路由指示具体用于指示所述交换机将接收自所述通信设备 的以广播方式发送的 DHCP报文路由至所述 DHCP服务器; The method according to claim 3, wherein before the switch receives the routing indication information sent by the controller in communication with the switch, the method further includes: after the switch accesses the switch, the switch Sending an identifier of the communication device to the controller; The routing indication information further includes a mapping relationship between the identifier of the communication device and a routing address of the DHCP server; the routing indication is specifically used to indicate that the switch receives the DHCP sent by the communication device in a broadcast manner. The message is routed to the DHCP server;
所述获取所述通信设备对应的 DHCP 服务器的路由地址具体包括, 从所述 DHCP报文中获取所述通信设备的标识, 并根据所述路由指示信息中的映射关系 获取所述通信设备的标识对应的所述 DHCP服务器的路由地址。 The obtaining the routing address of the DHCP server corresponding to the communication device includes: acquiring the identifier of the communication device from the DHCP packet, and acquiring the identifier of the communication device according to the mapping relationship in the routing indication information Corresponding routing address of the DHCP server.
5.如权利要求 1-4任一所述的方法,其特征在于:所述 DHCP ^艮文具体为 DHCP 发现报文或 DHCP请求报文。 The method according to any one of claims 1-4, wherein the DHCP message is specifically a DHCP discovery message or a DHCP request message.
6. 一种动态分配 IP地址的方法, 其特征在于, 所述方法包括: A method for dynamically allocating an IP address, the method comprising:
控制器生成路由指示信息,所述路由指示信息包括 DHCP服务器的路由地址、 以及用于指示交换机将接收的以广播方式发送的 DHCP报文路由至所述 DHCP服 务器的路由指示; The controller generates routing indication information, where the routing indication information includes a routing address of the DHCP server, and a routing indication for instructing the switch to route the received DHCP message sent by the switch to the DHCP server.
所述控制器向与所述控制器通信的交换机发送所述路由指示信息, 以使得 所述交换机在接收到以广播方式发送的 DHCP报文时, 根据所述路由指示信息中 The controller sends the routing indication information to a switch that communicates with the controller, so that when the switch receives the DHCP message sent by the broadcast, according to the routing indication information,
7. 如权利要求 6所述的方法, 其特征在于, 所述控制器生成路由指示信息 之前还包括: 所述控制器接收所述交换机在所述通信设备接入所述交换机时发 送的所述通信设备的标识, 并确定所述通信设备所对应的 DHCP服务器; The method of claim 6, wherein before the controller generates the routing indication information, the method further comprises: receiving, by the controller, the switch that is sent by the switch when the communication device accesses the switch An identifier of the communication device, and determining a DHCP server corresponding to the communication device;
所述路由指示信息还包括通信设备的标识与所述 DHCP服务器的路由地址的 映射关系, 所述路由指示具体用于指示所述交换机将接收自所述通信设备的以 广播方式发送的 DHCP报文路由至所述 DHCP服务器, 以使得: 所述交换机在接 收到所述通信设备发送的包含所述通信设备的标识的所述 DHCP报文时, 根据所 述映射关系获取所述 DHCP服务器的路由地址并根据所述 DHCP服务器的路由地 址将所述 DHCP报文路由至所述 DHCP服务器。 The route indication information further includes a mapping relationship between the identifier of the communication device and the routing address of the DHCP server, where the route indication is specifically used to indicate that the switch receives the DHCP message sent by the communication device in a broadcast manner. Routing to the DHCP server, so that: the switch acquires the routing address of the DHCP server according to the mapping relationship when receiving the DHCP message that is sent by the communications device and includes the identifier of the communications device And routing the DHCP packet to the DHCP server according to the routing address of the DHCP server.
8. 如权利要求 6或 7所述的方法, 其特征在于, 所述 DHCP服务器的路由 地址包括所述 DHCP服务器的 IP地址和 MAC地址。
The method according to claim 6 or 7, wherein the routing address of the DHCP server comprises an IP address and a MAC address of the DHCP server.
9. 一种动态分配 IP地址的方法, 其特征在于, 所述方法包括: 交换机接收接入所述交换机的通信设备发送的报文; A method for dynamically allocating an IP address, the method comprising: the switch receiving a packet sent by a communication device accessing the switch;
所述交换机在确定所述报文为 DHCP报文时将所述 DHCP报文转发至与所述 交换机通信的控制器, 以使得所述控制器根据所述 DHCP报文为所述通信设备提 供 DHCP服务。 When the switch determines that the packet is a DHCP message, the switch forwards the DHCP message to a controller that communicates with the switch, so that the controller provides DHCP for the communication device according to the DHCP message. service.
10. 如权利要求 9所述的方法, 其特征在于, 10. The method of claim 9 wherein:
所述交换机将所述 DHCP报文转发至所述控制器之前还包括, 所述交换机接 收所述控制器发送的指示信息, 所述指示信息用于指示所述交换机将接收的 DHCP报文转发至所述控制器; Before the switch forwards the DHCP message to the controller, the switch further includes: the switch receiving the indication information sent by the controller, where the indication information is used to instruct the switch to forward the received DHCP message to the The controller;
所述交换机根据所述指示信息执行在确定所述报文为 DHCP 报文时将所述 DHCP报文转发至所述控制器的操作。 The switch performs an operation of forwarding the DHCP message to the controller when determining that the packet is a DHCP message according to the indication information.
11. 如权利要求 9或 10所述的方法, 其特征在于, 所述方法还包括: 在所述通信设备通过所述交换机上的端口接入所述交换机时, 所述交换机 向所述控制器发送所述端口的端口号; The method according to claim 9 or 10, wherein the method further comprises: when the communication device accesses the switch through a port on the switch, the switch is to the controller Send the port number of the port;
所述交换机接收到所述控制器发送的携带 DHCP报文和所述端口号的数据报 文时, 通过所述数据报文中的端口号所标识的端口将所述数据报文携带的 DHCP 报文发送给所述通信设备。 When the switch receives the data packet carrying the DHCP packet and the port number, the switch sends the DHCP packet carried by the data packet through the port identified by the port number in the data packet. The text is sent to the communication device.
12. 一种动态分配 IP地址的方法, 其特征在于, 所述方法包括: A method for dynamically allocating an IP address, the method comprising:
控制器向与所述控制器通信的交换机发送指示信息, 所述指示信息用于指 示所述交换机将接收的 DHCP报文转发至所述控制器; The controller sends the indication information to the switch that communicates with the controller, where the indication information is used to indicate that the switch forwards the received DHCP message to the controller;
所述控制器接收所述交换机根据所述指示信息在确定接收自接入所述交换 机的通信设备的报文为 DHCP报文时向所述控制器转发的所述 DHCP报文; The controller receives the DHCP message forwarded by the switch to the controller when determining that the packet received by the communication device accessing the switch is a DHCP message according to the indication information;
所述控制器根据所述 DHCP报文为所述通信设备提供 DHCP服务。 The controller provides a DHCP service for the communication device according to the DHCP message.
13. 如权利要求 12所述的方法, 其特征在于, 所述方法还包括:
所述控制器接收所述交换机在所述通信设备通过所述交换机上的端口接入 所述交换机时发送的所述端口的端口号; The method according to claim 12, wherein the method further comprises: The controller receives a port number of the port that is sent by the switch when the communication device accesses the switch through a port on the switch;
所述控制器根据所述 DHCP报文为所述通信设备提供 DHCP服务具体包括, 所述控制器构造包括所述 DHCP服务对应的数据的 DHCP报文, 并将构造的 DHCP 报文和所述端口号封装到数据报文中发送给所述交换机, 以使得所述交换机通 过所述数据报文中的端口号所标识的端口将所述数据报文携带的 DHCP报文发送 给所述通信设备。 The controller provides the DHCP service to the communication device according to the DHCP message, and the controller includes: constructing a DHCP message including data corresponding to the DHCP service, and configuring the configured DHCP message and the port The number is encapsulated into the data packet and sent to the switch, so that the switch sends the DHCP packet carried by the data packet to the communication device by using the port identified by the port number in the data packet.
14. 一种交换机, 其特征在于, 所述交换机包括: 接收单元、 处理单元和 路由单元; A switch, comprising: a receiving unit, a processing unit, and a routing unit;
所述接收单元, 用于接收接入所述交换机的通信设备发送的报文, 还用于 将接收的所述报文发送给所述处理单元; The receiving unit is configured to receive a packet sent by the communication device that accesses the switch, and is further configured to send the received packet to the processing unit;
所述处理单元, 用于从所述接收单元接收所述报文, 在确定所述报文为以 广播方式发送的 DHCP报文时获取所述通信设备对应的 DHCP服务器的路由地址, 将所述 DHCP报文的目的地址字段的广播地址替换为所述 DHCP服务器的路由地 址, 并将修改后的 DHCP报文发送给所述路由单元; The processing unit is configured to receive the packet from the receiving unit, and obtain a routing address of a DHCP server corresponding to the communication device when the packet is determined to be a DHCP message sent by the broadcast device, where the The broadcast address of the destination address field of the DHCP packet is replaced with the routing address of the DHCP server, and the modified DHCP packet is sent to the routing unit.
所述路由单元, 用于从所述处理单元接收所述修改后的 DHCP报文, 根据所 述修改后的 DHCP ^艮文中的路由地址将所述修改后的 DHCP ^艮文路由至所述 DHCP 服务器。 The routing unit is configured to receive the modified DHCP message from the processing unit, and route the modified DHCP message to the DHCP according to the routing address in the modified DHCP message server.
15. 如权利要求 14所述的交换机, 其特征在于: 15. The switch of claim 14 wherein:
所述 DHCP服务器的路由地址包括所述 DHCP服务器的 IP地址和 MAC地址; The routing address of the DHCP server includes an IP address and a MAC address of the DHCP server;
DHCP服务器的路由地址具体包括, 所述处理单元用于将所述 DHCP报文的目的 IP地址字段的广播 IP地址替换为所述 DHCP 务器的 IP地址, 并将所述 DHCP 艮文的目的 MAC地址字段的广播 MAC地址替换为所述 DHCP服务器的 MAC地址。 The routing address of the DHCP server specifically includes: the processing unit is configured to replace the broadcast IP address of the destination IP address field of the DHCP message with the IP address of the DHCP server, and set the destination MAC address of the DHCP message The broadcast MAC address of the address field is replaced with the MAC address of the DHCP server.
16. 如权利要求 14或 15所述的交换机, 其特征在于, 16. The switch of claim 14 or 15, wherein
所述接收单元还用于接收与所述交换机通信的控制器发送的路由指示信
息, 所述路由指示信息包括所述 DHCP服务器的路由地址、 以及用于指示所述交 换机将接收的以广播方式发送的 DHCP报文路由至所述 DHCP服务器的路由指示; 所述处理单元用于在确定所述报文为以广播方式发送的 DHCP报文时获取所 述通信设备对应的 DHCP服务器的路由地址, 将所述 DHCP报文的目的地址字段 的广播地址替换为所述 DHCP服务器的路由地址, 具体包括: 所述处理单元用于 从所述路由指示信息中获取所述 DHCP服务器的路由地址, 并根据所述路由指示 信息中的路由指示将所述 DHCP报文的目的地址字段的广播地址替换为所述 DHCP 服务器的路由地址。 The receiving unit is further configured to receive a routing indication message sent by a controller that communicates with the switch The routing indication information includes a routing address of the DHCP server, and a routing indication for instructing the switch to route the received DHCP message to the DHCP server; the processing unit is configured to: And obtaining a routing address of the DHCP server corresponding to the communication device, and replacing the broadcast address of the destination address field of the DHCP packet with the route of the DHCP server, when determining that the packet is a DHCP message sent by the broadcast mode. And the processing unit is configured to: obtain the routing address of the DHCP server from the routing indication information, and broadcast the destination address field of the DHCP packet according to the routing indication in the routing indication information. The address is replaced with the routing address of the DHCP server.
17. 如权利要求 16所述的交换机, 其特征在于, 所述交换机还包括接入单 元; The switch according to claim 16, wherein the switch further comprises an access unit;
所述接入单元, 用于在所述通信设备接入所述交换机后向所述控制器发送 所述通信设备的标识; The access unit is configured to send, after the communication device accesses the switch, an identifier of the communication device to the controller;
所述路由指示信息还包括所述通信设备的标识与所述 DHCP服务器的路由地 址的映射关系, 所述路由指示具体用于指示所述交换机将接收自所述通信设备 的以广播方式发送的 DHCP报文路由至所述 DHCP服务器; The routing indication information further includes a mapping relationship between the identifier of the communication device and a routing address of the DHCP server, where the routing indication is specifically used to indicate that the switch receives the DHCP sent by the communication device in a broadcast manner. The message is routed to the DHCP server;
所述处理单元用于获取所述通信设备对应的 DHCP服务器的路由地址, 具体 包括: 所述处理单元用于从所述 DHCP报文中获取所述通信设备的标识, 并根据 所述路由指示信息中的映射关系获取所述通信设备的标识对应的所述 DHCP服务 器的路由地址。 The processing unit is configured to obtain a routing address of the DHCP server corresponding to the communication device, and the method includes: the processing unit is configured to acquire an identifier of the communication device from the DHCP packet, and according to the routing indication information The mapping relationship in the obtaining the routing address of the DHCP server corresponding to the identifier of the communication device.
18. —种控制器, 其特征在于, 所述控制器包括生成单元和发送单元; 所述生成单元, 用于生成路由指示信息, 所述路由指示信息包括 DHCP服务 器的路由地址、 以及用于指示交换机将接收的以广播方式发送的 DHCP报文路由 至所述 DHCP服务器的路由指示, 并用于将所述路由指示信息发送给所述发送单 元; A controller, comprising: a generating unit and a sending unit; the generating unit, configured to generate routing indication information, where the routing indication information includes a routing address of a DHCP server, and is used for indicating The switch routes the received DHCP message sent by the broadcast to the routing instruction of the DHCP server, and sends the route indication information to the sending unit.
所述发送单元, 用于从所述生成单元接收所述路由指示信息, 还用于向与 所述控制器通信的交换机发送所述路由指示信息, 以使得所述交换机在接收到
以广播方式发送的 DHCP报文时, 根据所述路由指示信息中的所述 DHCP服务器 的路由地址将所述 DHCP报文路由至所述 DHCP服务器。 The sending unit is configured to receive the routing indication information from the generating unit, and is further configured to send the routing indication information to a switch that communicates with the controller, so that the switch receives the When the DHCP message is sent in the broadcast mode, the DHCP message is routed to the DHCP server according to the routing address of the DHCP server in the routing indication information.
19. 如权利要求 18所述的控制器, 其特征在于, 所述控制器还包括接收单 元; 19. The controller of claim 18, wherein the controller further comprises a receiving unit;
所述接收单元, 用于接收所述交换机在所述通信设备接入所述交换机时发 送的所述通信设备的标识, 并用于将所述通信设备的标识发送给所述确定单元; 所述生成单元, 还用于从所述接收单元接收所述通信设备的标识, 并确定 所述通信设备所对应的 DHCP服务器; The receiving unit is configured to receive an identifier of the communications device that is sent by the switch when the communications device accesses the switch, and is configured to send the identifier of the communications device to the determining unit; The unit is further configured to receive an identifier of the communication device from the receiving unit, and determine a DHCP server corresponding to the communication device;
所述生成单元生成的所述路由指示信息还包括通信设备的标识与所述 DHCP 服务器的路由地址的映射关系, 所述路由指示具体用于指示所述交换机将接收 自所述通信设备的以广播方式发送的 DHCP报文路由至所述 DHCP服务器, 以使 得: 所述交换机在接收到所述通信设备发送的包含所述通信设备的标识的所述 DHCP报文时, 根据所述映射关系获取所述 DHCP服务器的路由地址并根据所述 DHCP服务器的路由地址将所述 DHCP报文路由至所述 DHCP服务器。 The routing indication information generated by the generating unit further includes a mapping relationship between the identifier of the communication device and the routing address of the DHCP server, where the routing indication is specifically used to indicate that the switch will receive the broadcast from the communication device. The DHCP message sent by the method is routed to the DHCP server, so that: the switch acquires the DHCP message according to the mapping relationship when receiving the DHCP message that is sent by the communication device and includes the identifier of the communication device. Decoding the routing address of the DHCP server and routing the DHCP packet to the DHCP server according to the routing address of the DHCP server.
20. 如权利要求 18或 19所述的控制器, 其特征在于, 所述 DHCP服务器的 路由地址包括所述 DHCP服务器的 IP地址和 MAC地址。 The controller according to claim 18 or 19, wherein the routing address of the DHCP server comprises an IP address and a MAC address of the DHCP server.
21. 一种交换机, 其特征在于, 所述交换机包括接收单元和转发单元; 所述接收单元, 用于接收接入所述交换机的通信设备发送的报文, 并将所 述报文发送给所述转发单元; A switch, comprising: a receiving unit and a forwarding unit; the receiving unit, configured to receive a packet sent by a communication device that accesses the switch, and send the packet to the switch Forwarding unit
所述转发单元, 用于从所述接收单元接收所述报文, 并在确定所述报文为 DHCP报文时将所述 DHCP报文转发至与所述交换机通信的控制器,以使得所述控 制器根据所述 DHCP报文为所述通信设备提供 DHCP服务。 The forwarding unit is configured to receive the packet from the receiving unit, and forward the DHCP packet to a controller that communicates with the switch when determining that the packet is a DHCP message, so that the The controller provides a DHCP service for the communication device according to the DHCP message.
22. 如权利要求 21所述的交换机, 其特征在于, 22. The switch of claim 21, wherein
所述接收单元还用于接收所述控制器发送的指示信息, 所述指示信息用于 指示所述交换机将接收的 DHCP报文转发至所述控制器; The receiving unit is further configured to receive the indication information sent by the controller, where the indication information is used to instruct the switch to forward the received DHCP message to the controller;
所述转发单元具体用于根据所述指示信息执行在确定所述报文为 DHCP报文
时将所述 DHCP报文转发至所述控制器的操作。 The forwarding unit is specifically configured to perform, according to the indication information, that the packet is a DHCP packet. The DHCP message is forwarded to the operation of the controller.
23. 如权利要求 21或 11所述的交换机, 其特征在于, 所述交换机还包括 接入单元; The switch according to claim 21 or 11, wherein the switch further comprises an access unit;
所述接入单元, 用于在所述通信设备通过所述交换机上的端口接入所述交 换机时, 向所述控制器发送所述端口的端口号; The access unit is configured to send, when the communication device accesses the switch through a port on the switch, a port number of the port to the controller;
所述接收单元, 还用于接收所述控制器发送的携带 DHCP报文和所述端口号 的数据报文, 并将所述数据报文发送给所述转发单元; The receiving unit is further configured to receive a data packet that is sent by the controller and that carries the DHCP packet and the port number, and send the data packet to the forwarding unit.
所述转发单元, 还用于从所述接收单元接收所述数据报文, 并通过所述数 据报文中的端口号所标识的端口将所述数据报文携带的 DHCP报文发送给所述通 信设备。 The forwarding unit is further configured to: receive, by the receiving unit, the data packet, and send, by the port identified by the port number in the data packet, the DHCP packet carried by the data packet to the communication device.
24. 一种控制器, 其特征在于, 所述控制器包括发送单元、 接收单元和服 务单元; A controller, comprising: a transmitting unit, a receiving unit, and a service unit;
所述发送单元, 用于向与所述控制器通信的交换机发送指示信息, 所述指 示信息用于指示所述交换机将接收的 DHCP报文转发至所述控制器; The sending unit is configured to send indication information to a switch that is in communication with the controller, where the indication information is used to instruct the switch to forward the received DHCP message to the controller;
所述接收单元, 用于接收所述交换机根据所述指示信息在确定接收自接入 所述交换机的通信设备的报文为 DHCP报文时向所述控制器转发的所述 DHCP报 文, 并用于向所述服务单元发送所述 DHCP报文; The receiving unit is configured to receive, by the switch, the DHCP message that is forwarded to the controller when the packet received by the communication device that accesses the switch is a DHCP message according to the indication information, and is used by the switch. Sending the DHCP message to the service unit;
所述服务单元, 用于从所述接收单元接收所述 DHCP报文, 并用于根据所述 DHCP报文为所述通信设备提供 DHCP服务。 The service unit is configured to receive the DHCP message from the receiving unit, and configured to provide a DHCP service for the communication device according to the DHCP message.
25. 如权利要求 24所述的控制器, 其特征在于, 25. The controller of claim 24, wherein
所述接收单元, 还用于接收所述交换机在所述通信设备通过所述交换机上 的端口接入所述交换机时发送的所述端口的端口号, 并用于将所述端口号发送 给所述服务单元; The receiving unit is further configured to receive a port number of the port that is sent by the switch when the communication device accesses the switch through a port on the switch, and send the port number to the Service unit
所述服务单元还用于从所述接收单元接收所述端口号; The service unit is further configured to receive the port number from the receiving unit;
所述服务单元用于根据所述 DHCP报文为所述通信设备提供 DHCP服务具体 包括: 所述服务单元用于构造包括所述 DHCP服务对应的数据的 DHCP报文, 将
构造的 DHCP报文和所述端口号封装到数据报文中, 并用于将所述数据报文发送 给所述发送单元; The service unit is configured to provide the DHCP service to the communication device according to the DHCP message, the method further includes: the service unit is configured to construct a DHCP message including data corresponding to the DHCP service, where The configured DHCP packet and the port number are encapsulated into the data packet, and are used to send the data packet to the sending unit.
所述发送单元, 还用于从所述服务单元接收所述数据报文, 并用于将所述 数据报文发送给所述交换机, 以使得所述交换机通过所述数据报文中的端口号 所标识的端口将所述数据报文携带的 DHCP报文发送给所述通信设备。 The sending unit is further configured to receive the data packet from the service unit, and send the data packet to the switch, so that the switch passes the port number in the data packet. The identified port sends the DHCP message carried in the data packet to the communication device.
26. 一种通信系统, 其特征在于, 所述通信系统包括交换机和控制器, 所 述交换机和所述控制器通过网络通信; 26. A communication system, the communication system comprising a switch and a controller, the switch and the controller communicating over a network;
所述控制器, 用于生成路由指示信息, 所述路由指示信息包括 DHCP服务器 的路由地址、 以及用于指示交换机将接收的以广播方式发送的 DHCP报文路由至 所述 DHCP服务器的路由指示, 还用于向所述交换机发送所述路由指示信息; 所述交换机, 用于接收接入所述交换机的通信设备发送的报文, 在确定所 述报文为以广播方式发送的 DHCP报文时,从所述路由指示信息中获取所述 DHCP 服务器的路由地址, 并根据所述路由指示信息中的路由指示将所述 DHCP报文的 目的地址字段的广播地址替换为所述 DHCP服务器的路由地址, 还用于根据修改 后的 DHCP报文中的路由地址将所述修改后的 DHCP报文路由至所述 DHCP服务器。 The controller is configured to generate routing indication information, where the routing indication information includes a routing address of the DHCP server, and a routing indication for instructing the switch to route the received DHCP message sent by the switch to the DHCP server. The method is further configured to send the routing indication information to the switch, where the switch is configured to receive a packet sent by a communication device that accesses the switch, and when determining that the packet is a DHCP message sent by using a broadcast mode, And obtaining the routing address of the DHCP server from the routing indication information, and replacing the broadcast address of the destination address field of the DHCP packet with the routing address of the DHCP server according to the routing indication in the routing indication information And the method is further configured to route the modified DHCP message to the DHCP server according to the routing address in the modified DHCP message.
27. 如权利要求 26所述的通信系统, 其特征在于, 所述 DHCP服务器的路 由地址包括所述 DHCP服务器的 IP地址和 MAC地址; The communication system according to claim 26, wherein the routing address of the DHCP server includes an IP address and a MAC address of the DHCP server;
所述交换机用于将所述 DHCP 报文的目的地址字段的广播地址替换为所述 DHCP服务器的路由地址, 具体包括: 所述交换机用于将所述 DHCP报文的目的 IP地址字段的广播 IP地址替换为所述 DHCP 务器的 IP地址, 并将所述 DHCP 艮文的目的 MAC地址字段的广播 MAC地址替换为所述 DHCP服务器的 MAC地址。 The switch is configured to replace the broadcast address of the destination address field of the DHCP packet with the routing address of the DHCP server, and specifically includes: the switch is configured to broadcast the IP address of the destination IP address field of the DHCP packet. The address is replaced with the IP address of the DHCP server, and the broadcast MAC address of the destination MAC address field of the DHCP message is replaced with the MAC address of the DHCP server.
28. 如权利要求 26或 27所述的通信系统, 其特征在于, 28. The communication system of claim 26 or 27, wherein
所述交换机, 还用于在所述通信设备接入所述交换机后向所述控制器发送 所述通信设备的标识; The switch is further configured to send an identifier of the communication device to the controller after the communication device accesses the switch;
所述控制器, 还用于确定所述通信设备所对应的 DHCP服务器, 所述控制器 生成的所述路由指示信息还包括通信设备的标识与所述 DHCP服务器的路由地址
的映射关系, 所述路由指示具体用于指示所述交换机将接收自所述通信设备的 以广播方式发送的 DHCP报文路由至所述 DHCP服务器; The controller is further configured to determine a DHCP server corresponding to the communication device, where the routing indication information generated by the controller further includes an identifier of the communication device and a routing address of the DHCP server. The mapping relationship is specifically used to instruct the switch to route the DHCP message sent by the communication device to the DHCP server;
所述交换机用于获取所述通信设备对应的 DHCP 服务器的路由地址具体包 括, 所述交换机用于从所述 DHCP报文中获取所述通信设备的标识, 并根据所述 路由指示信息中的映射关系获取所述通信设备的标识对应的所述 DHCP服务器的 路由地址。 The obtaining, by the switch, the routing address of the DHCP server corresponding to the communication device, the switch is configured to obtain the identifier of the communication device from the DHCP packet, and according to the mapping in the routing indication information The relationship acquires a routing address of the DHCP server corresponding to the identifier of the communication device.
29. 一种通信系统, 其特征在于, 所述通信系统包括交换机和控制器, 所 述交换机和所述控制器通过网络通信; 29. A communication system, the communication system comprising a switch and a controller, the switch and the controller communicating over a network;
所述控制器, 用于向所述交换机发送指示信息, 所述指示信息用于指示所 述交换机将接收的 DHCP报文转发至所述控制器; The controller is configured to send indication information to the switch, where the indication information is used to instruct the switch to forward the received DHCP message to the controller;
所述交换机, 用于根据所述指示信息在确定所述报文为 DHCP报文时将所述 DHCP报文转发至所述控制器; The switch is configured to forward the DHCP message to the controller when determining that the packet is a DHCP message according to the indication information;
所述控制器, 还用于根据所述 DHCP报文为所述通信设备提供 DHCP服务。 The controller is further configured to provide a DHCP service for the communication device according to the DHCP message.
30. 如权利要求 29所述的通信系统, 其特征在于, 30. The communication system of claim 29, wherein
所述交换机, 还用于在所述通信设备通过所述交换机上的端口接入所述交 换机时, 向所述控制器发送所述端口的端口号; The switch is further configured to: when the communication device accesses the switch through a port on the switch, send a port number of the port to the controller;
所述控制器根据所述 DHCP报文为所述通信设备提供 DHCP服务具体包括, 所述控制器构造包括所述 DHCP服务对应的数据的 DHCP报文, 并将构造的 DHCP 报文和所述端口号封装到数据报文中发送给所述交换机; The controller provides the DHCP service to the communication device according to the DHCP message, and the controller includes: constructing a DHCP message including data corresponding to the DHCP service, and configuring the configured DHCP message and the port The number is encapsulated into a data packet and sent to the switch;
所述交换机, 还用于通过所述数据报文中的端口号所标识的端口将所述数 据报文携带的 DHCP报文发送给所述通信设备。
The switch is further configured to send, by the port identified by the port number in the data packet, the DHCP message carried by the data packet to the communication device.
Priority Applications (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
PCT/CN2013/089291 WO2015085558A1 (en) | 2013-12-12 | 2013-12-12 | Method, device and system for dynamically allocating ip address |
CN201380081164.5A CN105917634A (en) | 2013-12-12 | 2013-12-12 | Method, device and system for dynamically allocating IP address |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
PCT/CN2013/089291 WO2015085558A1 (en) | 2013-12-12 | 2013-12-12 | Method, device and system for dynamically allocating ip address |
Publications (1)
Publication Number | Publication Date |
---|---|
WO2015085558A1 true WO2015085558A1 (en) | 2015-06-18 |
Family
ID=53370512
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
PCT/CN2013/089291 WO2015085558A1 (en) | 2013-12-12 | 2013-12-12 | Method, device and system for dynamically allocating ip address |
Country Status (2)
Country | Link |
---|---|
CN (1) | CN105917634A (en) |
WO (1) | WO2015085558A1 (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN113014516A (en) * | 2019-12-20 | 2021-06-22 | 华为技术有限公司 | Method and device for transmitting data stream |
Families Citing this family (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN107613044B (en) * | 2017-10-26 | 2021-10-01 | 郑州云海信息技术有限公司 | Method and device for updating IP address of virtual machine in SDN network |
CN112019653B (en) * | 2020-09-09 | 2022-08-12 | 迈普通信技术股份有限公司 | Access switch, IP address deployment method, device and readable storage medium |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20050027778A1 (en) * | 2003-07-29 | 2005-02-03 | Arthur Dimitrelis | Automatic configuration of an address allocation mechanism in a computer network |
CN101212420A (en) * | 2006-12-27 | 2008-07-02 | 华为技术有限公司 | Redirector, relay and route information configuration system and update method |
CN101515950A (en) * | 2009-04-09 | 2009-08-26 | 杭州华三通信技术有限公司 | Realization method and device for WLAN subnet terminal and wireless access client |
CN102055642A (en) * | 2009-11-02 | 2011-05-11 | 中兴通讯股份有限公司 | Data message conversion method |
Family Cites Families (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101499932B (en) * | 2009-03-09 | 2011-01-26 | 建汉科技股份有限公司 | Firmware upgrading method for multiple network devices |
-
2013
- 2013-12-12 CN CN201380081164.5A patent/CN105917634A/en active Pending
- 2013-12-12 WO PCT/CN2013/089291 patent/WO2015085558A1/en active Application Filing
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20050027778A1 (en) * | 2003-07-29 | 2005-02-03 | Arthur Dimitrelis | Automatic configuration of an address allocation mechanism in a computer network |
CN101212420A (en) * | 2006-12-27 | 2008-07-02 | 华为技术有限公司 | Redirector, relay and route information configuration system and update method |
CN101515950A (en) * | 2009-04-09 | 2009-08-26 | 杭州华三通信技术有限公司 | Realization method and device for WLAN subnet terminal and wireless access client |
CN102055642A (en) * | 2009-11-02 | 2011-05-11 | 中兴通讯股份有限公司 | Data message conversion method |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN113014516A (en) * | 2019-12-20 | 2021-06-22 | 华为技术有限公司 | Method and device for transmitting data stream |
Also Published As
Publication number | Publication date |
---|---|
CN105917634A (en) | 2016-08-31 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN103814554B (en) | A kind of communication means of virtual easily extensible local area network (LAN), device and system | |
CN108307002B (en) | DHCP message processing method and device | |
CN104283983B (en) | Virtual machine IP address distribution method and device in a kind of software defined network | |
US9210124B2 (en) | Method, apparatus, and system for allocating public IP address | |
US20080028071A1 (en) | Communication load reducing method and computer system | |
EP3059929B1 (en) | Method for acquiring physical address of virtual machine | |
CN104378455B (en) | IP address distribution method and device | |
US9641417B2 (en) | Proactive detection of host status in a communications network | |
WO2015085788A1 (en) | Method and apparatus for processing dynamic host configuration protocol message | |
CN101534329A (en) | IP address assignment method and system | |
WO2015066840A1 (en) | Device and method for network address conversion | |
EP2704403A1 (en) | Method and device for controlling address configuration manner | |
WO2016191906A1 (en) | Internet protocol address allocation method and router | |
WO2015184853A1 (en) | Authentication method and apparatus for ipv6 stateless auto-configuration | |
CN103516599A (en) | Host finding method, network device, and host | |
WO2012100685A1 (en) | Ip address configuration method, device and system | |
CN108667957B (en) | IP address allocation method, first electronic device and first server | |
WO2019113728A1 (en) | Network and network management method | |
WO2015085558A1 (en) | Method, device and system for dynamically allocating ip address | |
JP2013183243A (en) | Program, method, and physical server for allocating address to virtual machine | |
WO2017202034A1 (en) | Data packet sending and receiving method and device, and electronic apparatus | |
US20130086259A1 (en) | Method for acquiring an ip address and network access device | |
WO2020048177A1 (en) | Set top box management method and apparatus, and device and storage medium | |
WO2012155571A1 (en) | Base station self-configuration method and device | |
CN102299860B (en) | Acquisition method and equipment for path maximum transmission unit (Pathmtu) |
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: 13898951 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: 13898951 Country of ref document: EP Kind code of ref document: A1 |