WO2014173235A1 - Forwarding path generating method, controller, and system - Google Patents

Forwarding path generating method, controller, and system Download PDF

Info

Publication number
WO2014173235A1
WO2014173235A1 PCT/CN2014/075149 CN2014075149W WO2014173235A1 WO 2014173235 A1 WO2014173235 A1 WO 2014173235A1 CN 2014075149 W CN2014075149 W CN 2014075149W WO 2014173235 A1 WO2014173235 A1 WO 2014173235A1
Authority
WO
WIPO (PCT)
Prior art keywords
host
address
controller
switch
gateway
Prior art date
Application number
PCT/CN2014/075149
Other languages
French (fr)
Chinese (zh)
Inventor
李泉材
田应军
王文健
Original Assignee
华为技术有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 华为技术有限公司 filed Critical 华为技术有限公司
Publication of WO2014173235A1 publication Critical patent/WO2014173235A1/en

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L61/00Network arrangements, protocols or services for addressing or naming
    • H04L61/09Mapping addresses
    • H04L61/10Mapping addresses of different types
    • H04L61/103Mapping addresses of different types across network layers, e.g. resolution of network layer into physical layer addresses or address resolution protocol [ARP]

Definitions

  • the present invention relates to the field of network technologies, and in particular, to a method, a controller, and a system for generating a forwarding path.
  • OpenFlow is a new type of network switching model, including OpenFlow switch (OpenFlow Switch) and controller (Crontroller); Among them, OpenFlow switch forwards the data layer; controller controls the network centrally to realize the function of the control layer.
  • OpenFlow switches fall into two categories: dedicated OpenFlow switches and switches that support OpenFlow.
  • a dedicated OpenFlow switch does not have control logic. It is only a simple path component for forwarding data packets between ports. The received data packets are forwarded according to OpenFlow mode.
  • the switches supporting OpenFlow can forward data according to OpenFlow mode. Packets can also be forwarded according to the forwarding mode of the existing switch.
  • FIG. 1 illustrates an implementation environment of an existing openflow network, where the implementation environment includes a controller 120, a first host 140 and a second host 142, a first switch 160, a second switch 162, and a third switch 164.
  • the fourth switch 166 and the fifth switch 168 wherein the first host 140 and the second host 142 belong to different subnets, respectively connected to ports of the first switch 160 and the second switch 162, and the fourth switch 166 and the fifth switch 168, respectively, implements the configuration gateway function of the first host 140 and the second host 142, that is, the first host 140 configures the first gateway, the second host 142 configures the second gateway, and the functions of the first gateway and the second gateway are respectively performed by the fourth switch 166 and fifth switch 168 are implemented.
  • the first host 140 first obtains the MAC of the first gateway through an ARP (Address Resolution Protocol) learning process between the first host 140 and the fourth switch 166 (Medium/ Media Access Control, medium access control layer) address, after obtaining the MAC address of the first gateway, the first host sends a data packet of the destination host to the second host 142 to the fourth switch 166, and after receiving the data packet, the fourth switch receives the data packet.
  • ARP Address Resolution Protocol
  • the fourth switch 166 Medium/ Media Access Control, medium access control layer
  • the data packet is reported to the controller, and the controller sends the forwarding flow table according to the subnet information and the destination IP address of the data packet, and the fourth The switch 166 forwards the data packet to the fifth switch 168.
  • the fifth switch 168 and the second host 142 obtain the MAC address of the second host 142 through the ARP learning process, and obtain the MAC address of the second host 142.
  • the data packet is forwarded to the second host 142.
  • Some OpenFlow switches need to undertake gateway/routing functions, such as the fourth switch 166 and the fifth switch 168 in FIG. 1, but in the OpenFlow network. This function cannot be implemented by a dedicated OpenFlow switch, that is, if the fourth switch 166 and the fifth switch 168 acting as gateways are dedicated Openflow switches, this function cannot be implemented.
  • the embodiment of the present invention provides a method, a controller, and a system for generating a forwarding path.
  • the technical solution is as follows:
  • an embodiment of the present invention provides a method for generating a forwarding path, where the method includes:
  • the controller obtains the network information of the first host by using the received first ARP request, where the first ARP request is sent by the first host, and the switch connected to the first host cannot find the forwarding flow table. An ARP request forwarded to the controller;
  • the controller acquires network information of the second host by constructing a second ARP request
  • the controller generates a forwarding path between the first host and the second host according to the network information of the first host and the network information of the second host; Transmitting, by the controller, a forwarding flow table to each switch on the forwarding path, so that each switch on the forwarding path is between the first host and the second host according to the forwarding flow table Forward the packet.
  • the controller further includes: the controller feeding back a first ARP response to the first host by using a switch connected to the first host, where The source MAC address and the source IP address in the first ARP response are respectively the MAC address and the IP address of the first gateway.
  • the controller acquires network information of the second host by constructing the second ARP request, including:
  • a destination MAC address of the data packet is a MAC address of the first gateway, and a destination IP address is an IP address of the second host; Constructing a second ARP request according to the IP address of the second host, where the source MAC address and the source IP address of the second ARP request are respectively a MAC address and an IP address of the second gateway, and the destination IP address is the second host IP address, the second gateway is a configuration gateway of the second host;
  • the controller sends the second ARP request to all hosts in the subnet where the second host is located by using a switch in a subnet where the second host is located;
  • the controller before the acquiring, by the controller, the network information of the first host by using the received first ARP request, the controller further includes:
  • the controller pre-stores a gateway, a network number, and a subnet mask of a subnet where the first host and the second host are located, and a MAC address and an IP address of the first gateway and the second gateway;
  • the controller sends the second ARP request by using a switch of a subnet where the second host is located All hosts in the subnet where the second host is located, including;
  • the controller sends the second ARP request to all hosts in the subnet where the second host is located according to the gateway, the network number, and the subnet mask of the subnet where the second host is located.
  • the acquiring the first ARP request by using the received After a host's network information it also includes:
  • the controller feeds back a first ARP response to the first host by using a switch connected to the first host, where a source MAC address in the first ARP response is a MAC address of the first proxy device, and a source IP address is The IP address of the second host, so that the first host uses the MAC address of the first proxy device as the MAC address of the second host, where the first proxy device is located corresponding to the first host A proxy device within a subnet.
  • the controller by configuring the second ARP request, to obtain the network information of the second host, includes:
  • the device generates a second ARP request according to the IP address of the second host, where the source MAC address of the second ARP request is the MAC address of the second proxy device, and the source IP address is the IP address of the first host, and the destination IP address.
  • the address is the IP address of the second host, so that the second host uses the MAC address of the second proxy device as the MAC address of the first host, and the second proxy device corresponds to the second The proxy device in the subnet where the host is located;
  • the controller sends the second ARP request to all hosts in the subnet where the second host is located by using a switch in a subnet where the second host is located;
  • the controller before the acquiring, by the first ARP request, the network information of the first host, the controller further includes: The controller pre-stores a gateway, a network number, and a subnet mask of a subnet where the first host and the second host are located, and a MAC address of the first proxy device and the second proxy device; The controller sends the second ARP request to all hosts in the subnet where the second host is located by using a switch of the subnet where the second host is located, including:
  • the controller sends the second ARP request to all hosts in the subnet where the second host is located according to the gateway, the network number, and the subnet mask of the subnet where the second host is located.
  • the The network information of the first host and the network information of the second host determine a forwarding path between the first host and the second host, including:
  • a controller for use in an OpenFlow network including at least one switch, where the controller includes:
  • a first information acquiring module configured to acquire network information of the first host by using the received first ARP request, where the first ARP request is a switch sent by the first host and connected to the first host The ARP request forwarded to the controller after forwarding the flow table cannot be found;
  • a second information acquiring module configured to acquire network information of the second host by constructing a second ARP request
  • a path generating module configured to generate the first host and the network according to the network information of the first host acquired by the first information acquiring module and the network information of the second host acquired by the second information acquiring module a forwarding path between the second hosts;
  • a flow table issuing module configured to perform each exchange on a forwarding path generated by the path generation module
  • the forwarding flow table is sent by the machine, so that each switch on the forwarding path forwards the data packet between the first host and the second host according to the forwarding flow table.
  • the first gateway is a configuration gateway of the first host, where The controller also includes:
  • a first feedback module configured to feed back, by the switch connected to the first host, the first ARP response to the first host, where the source MAC address and the source IP address in the first ARP response are respectively the first The MAC address and IP address of the gateway.
  • the second information acquiring module includes:
  • a first receiving unit configured to receive a data packet sent by the first host, where a destination MAC address of the data packet is a MAC address of the first gateway, and a destination IP address is an IP address of the second host;
  • a first constructing unit configured to construct a second ARP request according to the IP address of the second host in the data packet received by the first receiving unit, where the source MAC address and the source IP address of the second ARP request are respectively The MAC address and the IP address of the second gateway, the destination IP address is the IP address of the second host, and the second gateway is the configuration gateway of the second host;
  • a first sending unit configured to send, by using a switch in a subnet where the second host is located, a second ARP request configured by the first configuration unit to all hosts in a subnet where the second host is located; a unit, configured to receive, by using a switch that is connected to the second host, a second ARP response that is sent by the second host, where the source MAC address and the source IP address of the second ARP response are respectively the MAC address of the second host Address and IP address.
  • the controller further includes:
  • a first pre-storage module configured to pre-store a gateway, a network number, and a subnet mask of a subnet where the first host and the second host are located, and a MAC address of the first gateway and the second gateway IP address;
  • the first sending unit is specifically configured to be pre-stored according to the first pre-storage module
  • the gateway, the network number, and the subnet mask of the subnet where the second host is located sends the second ARP request to all hosts in the subnet where the second host is located.
  • the controller further includes:
  • a second feedback module configured to feed back, by the switch connected to the first host, a first ARP response to the first host, where a source MAC address in the first ARP response is a MAC address of the first proxy device, and a source
  • the IP address is the IP address of the second host, so that the first host uses the MAC address of the first proxy device as the MAC address of the second host, and the first proxy device corresponds to the first A proxy device in a subnet where the host resides.
  • the second information acquiring module includes:
  • a third receiving unit configured to receive a data packet sent by the first host, where a destination MAC address of the data packet is a MAC address of the first proxy device, and a destination IP address is an IP address of the second host;
  • a second constructing unit configured to construct a second ARP request according to the IP address of the second host in the data packet received by the third receiving unit, where the source MAC address of the second ARP request is the MAC address of the second proxy device An address, a source IP address is an IP address of the first host, and a destination IP address is an IP address of the second host, so that the second host uses the MAC address of the second proxy device as the first host MAC address, the second proxy device is a proxy device corresponding to a subnet in which the second host is located;
  • a second sending unit configured to send, by using a switch in a subnet where the second host is located, a second ARP request configured by the second configuration unit to all hosts in a subnet where the second host is located; a unit, configured to receive, by using a switch that is connected to the second host, a second ARP response that is sent by the second host, where the source MAC address and the source IP address of the second ARP response are respectively the MAC address of the second host Address IP address.
  • the controller further includes:
  • a second pre-storage module configured to pre-store the first host and the second host a gateway, a network number, and a subnet mask of the network, and a MAC address of the first proxy device and the second proxy device;
  • the second sending unit is configured to send the second ARP request to the second host according to a gateway, a network number, and a subnet mask of a subnet where the second host is pre-stored by the second pre-storage module. All hosts in the subnet.
  • the path Generate modules including:
  • a shortest generating unit configured to calculate, according to the network information of the first host acquired by the first information acquiring module and the network information of the second host acquired by the second information acquiring module, the first host and the first a shortest forwarding path between the two hosts; using the shortest forwarding path as a forwarding path between the first host and the second host;
  • An optimal generating unit configured to calculate the first host and the network according to the network information of the first host acquired by the first information acquiring module and the network information of the second host acquired by the second information acquiring module An optimal forwarding path between the second host; the optimal forwarding path is used as a forwarding path between the first host and the second host.
  • a forwarding path generation system comprising the controller, the first host and the second host of any of the second aspect and the various possible implementations of the second aspect.
  • the controller replaces part of the OpenFlow switch that implements the gateway/routing function in the OpenFlow network, thereby solving the problem that the dedicated OpenFlow switch in the OpenFlow network cannot implement the function, and the OpenFlow network does not need to be separately set to function as a gateway/ The effect of the routing function of the switch.
  • FIG. 1 is a schematic diagram of an implementation environment of an embodiment of the present invention.
  • FIG. 2 is a flowchart of a method for generating a forwarding path according to Embodiment 1 of the present invention
  • FIG. 3 is a flowchart of a method for generating a forwarding path according to Embodiment 2 of the present invention
  • FIG. 4 is a flowchart of Embodiment 2 of the present invention
  • FIG. 5 is a flowchart of a method for generating a forwarding path according to Embodiment 3 of the present invention
  • FIG. 6 is a schematic diagram of an implementation environment of Embodiment 3 of the present invention.
  • FIG. 7 is a schematic structural diagram of a controller according to Embodiment 4 of the present invention.
  • Embodiment 8 is a schematic structural diagram of a controller according to Embodiment 5 of the present invention.
  • FIG. 9 is a schematic structural diagram of a controller according to Embodiment 6 of the present invention.
  • Figure 10 is a block diagram showing the structure of a system for generating a forwarding path according to a seventh embodiment of the present invention
  • Figure 11 is a block diagram showing the structure of a controller according to Embodiment 8 of the present invention
  • Figure 12 is a block diagram showing the structure of a controller provided in Embodiments 9 and 10 of the present invention.
  • FIG. 2 a flowchart of a method for generating a forwarding path according to Embodiment 1 of the present invention is shown.
  • the method for generating the forwarding path is applied to the controller as an example for illustration.
  • the method for generating the forwarding path includes:
  • Step 201 The controller acquires network information of the first host by using the received first ARP request.
  • the controller acquires network information of the first host by using the received first ARP request, where the first
  • the ARP request is sent by the first host, and the switch connected to the first host cannot find the ARP request forwarded to the controller after forwarding the flow table.
  • Step 202 The controller acquires network information of the second host by constructing a second ARP request. To generate a forwarding path between the first host and the second host, the controller constructs the second
  • Step 203 The controller generates a forwarding path between the first host and the second host according to the network information of the first host and the network information of the second host.
  • the controller generates a forwarding path according to the network information of the first host and the network information of the second host, so that the first host and the second host communicate according to the forwarding path.
  • Step 204 The controller sends a forwarding flow table to each switch on the forwarding path.
  • the controller generates a corresponding forwarding flow table for the switch on the forwarding path according to the generated forwarding path, and sends the generated forwarding flow table to the corresponding switch, so that the corresponding switch updates the local forwarding flow table according to the forwarding flow table, and according to The updated forwarding flow table forwards the communication data packet between the first host and the second host.
  • the controller obtains the network information of the first host and the second host, and generates a forwarding path according to the obtained network information of the first host and the second host.
  • the problem that the dedicated OpenFlow switch in the OpenFlow network cannot implement the function is solved, and the effect that the switch functioning as the gateway/routing function is not required in the OpenFlow network is achieved.
  • the specific implementation environment may be divided into two situations.
  • the controller implements the functions of the first gateway and the second gateway.
  • the controller implements the functions of the first proxy device and the second proxy device.
  • FIG. 3 is a flowchart of a method for generating a forwarding path according to Embodiment 2 of the present invention. This embodiment is mainly illustrated by applying the forwarding path generation method to the implementation environment shown in FIG. 4. Referring to FIG. 3,
  • the implementation environment includes a controller 420, a first host 440, a second host 442, a third host 444, and a fourth host 446, a first switch 460, a second switch 462, a third switch 464, and a fourth The switch 466 and the fifth switch 468, wherein the first host 440 belongs to the first subnet, the second host 442, the third host 444, and the fourth host 446 belong to the second subnet, and the first host 440 and the third host 444 are connected to On the port of the first switch 460, the first The second host 442 is connected to the port of the second switch 462, and the fourth host 446 is connected to the port of the fifth switch 468.
  • the gateway the first host 440 belongs to the first subnet, the second host 442, the third host 444, and the fourth host 446 belong to the second subnet, and the first gateway and the second gateway are implemented by the controller 420.
  • the method includes:
  • Step 301 Pre-store a gateway, a network number, and a subnet mask of a subnet where the first host and the second host are located, and a MAC address and an IP address of the first gateway and the second gateway.
  • the controller pre-stores the gateway, the network number and the subnet mask of the subnet where the first host 440 and the second host 442 are located, and the MAC address and IP address of the first gateway and the second gateway, so that the controller 420 is in the subsequent process.
  • a first gateway corresponding to the first host 440 and a second gateway corresponding to the second host 442 to obtain MAC address, IP address, and port information of the first host 440 and the second host 442; and simultaneously according to the gateway of the subnet , network number and subnet mask decision forwarding path.
  • Step 302 The first host sends a first ARP request to the first switch.
  • the first host 440 needs to communicate with the outside world. First, the MAC address of the first gateway is queried according to the configured gateway, that is, the IP address of the first gateway. Therefore, the first host 440 constructs a first ARP request, and the source MAC address of the first ARP request. The address is the MAC address of the first host 440, the source IP address is the IP address of the first host 440, the destination MAC address is 0, and the destination IP address is the IP address of the first gateway. The first host 440 sends the first ARP request to the first switch 460.
  • the first switch 460 receives the first ARP request.
  • Step 303 The first switch queries the local forwarding flow table. If the forwarding flow table information corresponding to the received first ARP request is not found, the first switch sends the information to the controller in the form of a packet input message (Packet-ln).
  • Packet-ln a packet input message
  • the first switch 460 queries the local forwarding flow table according to the destination IP address in the received first ARP request, and if the forwarding flow table information corresponding to the destination IP address is queried, the forwarding is performed according to the forwarding flow table information; To the forwarding flow table information corresponding to the destination IP address, the received first ARP request is sent to the controller 420 in the form of a packet input message.
  • the controller 420 receives the first ARP request.
  • Step 304 The controller acquires network information of the first host by using the received first ARP request.
  • the controller 420 obtains the MAC address and the IP address of the first host 440 according to the received first ARP request, and uses the MAC address and the IP address of the first host 440 as the network information of the first host 440; due to the first ARP request
  • the controller 420 can also obtain the port information of the first host 440 according to the need, and the MAC address, the IP address, and the port information of the first host 440 are used as the first host 440.
  • Network information may include the MAC address and IP address of the first host 440, and may also include the MAC address, IP address, and port information of the first host 440.
  • Step 305 The controller constructs a first ARP response, and feeds back the first ARP response to the first host by using a switch connected to the first host.
  • the controller 420 implements the function of the first gateway, when the first ARP request is received and the destination IP address is found to be the IP address of the first gateway, the controller 420 actively constructs a first ARP response, the first ARP response.
  • the source MAC address is the MAC address of the first gateway
  • the source IP address is the IP address of the first gateway
  • the destination MAC address is the MAC address of the first host 440
  • the destination IP address is the IP address of the first host 440
  • the packet is The output message (Packet-Out) is sent in the form of a first ARP response from the first switch 460 to the port of the first host 440.
  • the first host 440 receives the first ARP response.
  • Step 306 The first host saves a MAC address of the first gateway.
  • the first host 440 After receiving the first ARP response, the first host 440 saves the MAC address of the first gateway in the first ARP response.
  • the first host 440 completes the ARP learning process between the first gateway implemented by the controller 420.
  • Step 307 The first host sends a data packet whose destination host is the second host to the first switch.
  • the first host 440 has obtained the MAC address of the first gateway by using the step 302 to the step 305, so the first host 440 goes to the second host.
  • the host 442 sends a data packet
  • the destination MAC address in the data packet is the MAC address of the first gateway
  • the destination IP address is the IP address of the second host 442
  • the first host 440 sends the data packet to the first switch 460.
  • the first switch 460 receives the data packet.
  • Step 308 the first switch queries the local forwarding flow table, and if the query does not correspond to the data packet, The forwarding flow table information is sent to the controller in the form of a packet input message;
  • the first switch 460 receives the data packet sent by the first host 440, and queries the local forwarding flow table according to the IP address in the data packet. If the forwarding flow table information corresponding to the destination IP address is queried, the information is forwarded according to the forwarding flow table information. Forwarding; if the forwarding flow table information corresponding to the destination IP address is not found, the data packet is sent to the controller 420 in the form of a packet input message.
  • the controller 420 receives the data packet.
  • Step 309 The controller constructs a second ARP request according to the IP address of the second host, and sends the second ARP request to all hosts in the subnet where the second host is located through the switch in the subnet where the second host is located.
  • the controller 420 When the controller 420 receives the data packet, it does not know the MAC address of the second host 442. Since the controller 420 implements the role of the second gateway, the data of the IP address of the second host 442 is received at the destination IP address.
  • the second ARP request When the packet is configured, the second ARP request is actively constructed.
  • the source MAC address and the source IP address of the second ARP request are respectively the MAC address and the IP address of the second gateway, the destination MAC address is all zero, and the destination IP address is the IP address of the second host.
  • all hosts in the subnet where the second host 442 is located receive the second ARP request, such as the second host 442, the third host 444, and the fourth host 446, where the third host 444 and the fourth host 446 are not in the Marked in Figure 3.
  • Step 310 The second host responds to the second ARP request.
  • the second host 442 receives the second ARP request sent by the second switch 462, and finds that the destination IP address in the second ARP request is the same as its own IP address, and then constructs a second ARP response, the source MAC address of the second ARP response.
  • the address and the source IP address are respectively the MAC address and the IP address of the second host 442, and the destination MAC address and the destination IP address are respectively the MAC address IP address of the second gateway, and the second switch 462 sends the second to the controller 420.
  • ARP response is respectively the MAC address and the IP address of the second host 442
  • the destination MAC address and the destination IP address are respectively the MAC address IP address of the second gateway
  • the controller 420 receives the second ARP response fed back by the second host 442 through the switch 462 connected to the second host.
  • Step 31 The controller acquires network information of the second host.
  • the controller 420 obtains the MAC address and the IP address of the second host 442 according to the received second ARP response, and uses the MAC address and the IP address of the second host 442 as the network information of the second host 442; due to the first ARP request
  • the controller 420 can also obtain the port information of the second host 442 as needed, and use the MAC address, the IP address, and the port information of the second host 442 as the second host 442.
  • Network information may include the MAC address and IP address of the second host 442, and may also include the MAC address, IP address, and port information of the second host 442.
  • step 307 to step 31 1 the controller completes the ARP learning process between the implemented second gateway and the second host 442;
  • Step 312 The controller calculates a shortest forwarding path between the first host and the second host according to the network information of the first host and the network information of the second host.
  • the shortest forwarding path is used as forwarding between the first host and the second host. Path
  • the controller 420 analyzes the destination IP address of the data packet sent by the first switch 460, and finds that the destination host of the data packet, that is, the second host 442 and the first host 440 are in different subnets, and determines that it is a three-layer forwarding, and The network information of the first host 440 and the second host 442 is obtained through the ARP learning process, and the forwarding path is generated according to the routing algorithm. If the forwarding path is generated according to the shortest path policy, the generated forwarding path may be: ⁇ -> Third switch 464 ⁇ -> Second switch 462.
  • the controller 420 can determine that the IP address of the first host 440 and the second host 442 is three-layer forwarding.
  • the forwarding path is generated according to the routing algorithm decision. If the forwarding path is generated according to the shortest path policy, the forwarding path generated according to the port information of the first host 440 and the second host 442 may be: the first switch 460 ⁇ ->the third switch 464 ⁇ -> second switch 462.
  • controller 420 may further calculate an optimal forwarding path between the first host 440 and the second host 442 according to the network information of the first host 440 and the network information of the second host 442.
  • the optimal forwarding path is a chain.
  • the optimal path of the path is used as the forwarding path between the first host 440 and the second host 442.
  • the shortest path policy is used as an example for description.
  • Step 313 The controller generates a corresponding switch for the switch on the forwarding path according to the generated forwarding path. Forwarding the flow table, and sending the generated forwarding flow table to the corresponding switch;
  • the controller 420 generates a corresponding forwarding flow table for the switch on the forwarding path according to the generated forwarding path, and sends the generated forwarding flow table to the corresponding switch.
  • the controller 420 is the first switch 460 on the shortest path.
  • the third switch 464 and the second switch 462 generate a corresponding forwarding flow table, and send the forwarding flow table corresponding to the first switch 460 to the first switch 460, and send the forwarding flow table corresponding to the third switch 464 to the third switch. 464.
  • the third switch 464 is not labeled in Figure 3.
  • Step 314 The corresponding switch updates the local forwarding flow table according to the forwarding flow table.
  • the first switch 460, the third switch 464, and the second switch 462 on the corresponding shortest path update the local forwarding flow table.
  • Step 315 The corresponding switch forwards the communication data packet between the first host and the second host according to the updated forwarding flow table.
  • the first switch 460, the third switch 464, and the second switch 462 on the corresponding shortest path forward the communication data packet between the first host 440 and the second host 442 according to the updated forwarding flow table.
  • the method for generating a forwarding path replaces a part of an OpenFlow switch that implements a gateway/routing function in an OpenFlow network by using a controller, and the ARP function of the first gateway and the second gateway is implemented by the controller. Therefore, all the switches in the Open Flow network can implement the simple forwarding function, thereby solving the problem that the dedicated OpenFlow switch in the OpenFlow network cannot implement the gateway/routing function, and the OpenFlow network does not need to be separately set up. The effect of the gateway/route function switch.
  • the second case will be described in detail below;
  • FIG. 5 is a flowchart of a method for generating a forwarding path according to Embodiment 3 of the present invention.
  • This embodiment is mainly illustrated by applying the method for generating the forwarding path to the implementation environment shown in FIG. 6.
  • the implementation environment includes a controller 620, a first host 640, The second host 642, the third host 644 and the fourth host 646, the first switch 660, the second switch 662, the third switch 664, the fourth switch 666, and the fifth switch 668, wherein the first host 640 belongs to the first subnet
  • the second host 642, the third host 644, and the fourth host 646 belong to the second subnet.
  • the first host 640 and the third host 644 are connected to the port of the first switch 660, and the second host 642 is connected to the second switch 662. On the port, the fourth host 646 is connected to the port of the fifth switch 668. It is assumed that the first host 640 and the second host 642 are not configured with a default gateway.
  • the first host 640 belongs to the first subnet, and the second host 642 and the third host.
  • the host 644 and the fourth host 646 belong to the second subnet, and the information about the subnet where the first host 640 and the second host 642 are located (including the gateway, the network number, and the subnet mask) are pre-stored on the controller 620 and respectively correspond to The first proxy device and the second proxy device of the two subnets.
  • the method includes:
  • Step 501 The memory pre-stores a gateway, a network number, and a subnet mask of the subnet where the first host and the second host are located, and a MAC address of the first proxy device and the second proxy device.
  • the controller 620 pre-stores the gateway, the network number and the subnet mask of the subnet where the first host 640 and the second host 642 are located, and the MAC addresses of the first proxy device and the second proxy device; so that the controller 620 is in the subsequent process.
  • the first proxy device corresponding to the subnet where the first host 640 is located and the second proxy device corresponding to the subnet where the second host 642 is located are configured to obtain network information of the first host 640 and the second host 642, where the network information includes the MAC address. Address, IP address, and port information; and decide the forwarding path based on the information of the subnet.
  • Step 502 The first host sends a first ARP request to the first switch.
  • the first host 640 is to communicate with the second host 642. First, the MAC address of the second host 642 is queried according to the IP address of the second host 642. Therefore, the first host 640 constructs a first ARP request, and the first ARP request source MAC For the MAC of the first host 640, the source IP address is the IP address of the first host 640, the destination MAC address is 0, and the destination IP address is the IP address of the second host 642. The first host 640 sends the first ARP request to the first switch 660.
  • the first switch 660 receives the first ARP request.
  • Step 503 The first switch queries the local forwarding flow table. If the forwarding flow table information corresponding to the received first ARP request is not found, the first switch sends the information to the controller in the form of a packet input message.
  • the destination IP address in the first ARP request is queried locally.
  • the forwarding flow table if the forwarding flow table information corresponding to the destination IP address is queried, is forwarded according to the forwarding flow table information; if the forwarding flow table information corresponding to the destination IP address is not queried, the received An ARP request is sent to the controller 620 in the form of a packet input message.
  • the controller 620 receives the first ARP request.
  • Step 504 The controller acquires the network information of the first host by using the received first ARP request.
  • the controller 620 acquires the MAC address and the IP address of the first host 640 according to the received first ARP request, and the first host 640 is obtained.
  • the MAC address and the IP address are used as the network information of the first host 640. Since the first ARP request is sent to the controller 620 in the form of a packet input message, the controller 620 can also obtain the port of the first host 640 as needed.
  • the information, the MAC address, the IP address, and the port information of the first host 640 are used as the network information of the first host 640.
  • the network information of the first host 640 may include the MAC address and IP address of the first host 640, and may also include the MAC address, IP address, and port information of the first host 640.
  • Step 505 The controller constructs a first ARP response, and feeds back the first ARP response to the first host by using a switch connected to the first host.
  • the controller 620 Since the controller 620 implements the role of the first proxy device, the controller 620 actively constructs a first ARP response, when the first ARP request is received and the destination IP address is the IP address of the second host 142.
  • the ARP response source MAC address is the MAC address of the first proxy device, the source IP address is the IP address of the second host 642, the destination MAC address is the MAC address of the first host 640, and the destination IP address is the IP address of the first host 640.
  • the first ARP response is sent from the port of the first switch 660 to the first host 640 in the form of a packet output message.
  • the first host 640 receives the first ARP response.
  • Step 506 The first host saves a MAC address of the first proxy device.
  • the first host 640 After receiving the first ARP response, the first host 640 saves the MAC address of the first proxy device in the first ARP response as the MAC address of the second host 642.
  • the first host 640 completes the ARP learning process between the first proxy device implemented by the controller 620.
  • Step 507 The first host sends a data packet whose destination host is the second host to the first switch.
  • the first host 640 has obtained the MAC address of the first proxy device, and And the MAC address of the first proxy device is saved as the MAC address of the second host 642, so the first host 640 sends the destination MAC address of the data packet to the second host 642 as the MAC address of the first proxy device.
  • the IP address is the IP address of the second host 642, and the first host 640 sends the data packet to the first switch 660.
  • the first switch 660 receives the data packet.
  • Step 508 The first switch queries the local forwarding flow table. If the forwarding flow table information corresponding to the data packet is not found, the first switch sends the information to the controller in the form of a packet input message.
  • the first switch 660 receives the data packet sent by the first host 640, and queries the local forwarding flow table according to the IP address in the data packet. If the forwarding flow table information corresponding to the destination IP address is queried, the information is forwarded according to the forwarding flow table information. Forwarding; if the forwarding flow table information corresponding to the destination IP address is not found, the data packet is sent to the controller 620 in the form of a packet input message.
  • the controller 620 receives the data packet.
  • Step 509 The controller constructs a second ARP request according to the IP address of the second host, and sends the second ARP request to all hosts in the subnet where the second host is located through the switch in the subnet where the second host is located.
  • the controller 620 When the controller 620 receives the data packet, it does not know the MAC address of the second host 642. Since the controller 620 implements the role of the second proxy device, the destination IP address is received as the IP address of the second host 642. In the case of the data packet, the second ARP request is actively constructed.
  • the second ARP request source MAC address is the MAC address of the second proxy device, the source IP address is the IP address of the first host 640, the destination MAC address is all zero, and the destination IP address is The IP address of the second host 642 is sent to all the subnets of the second host 642 in the form of a packet output message according to the gateway, the network number, and the subnet mask of the subnet where the second host 642 is located. Host.
  • all the hosts in the subnet where the second host 642 is located receive the second ARP request, such as the second host 642, the third host 644 and the fourth host 646, wherein the three hosts 644 and the fourth host 646 are not in the Marked in Figure 5.
  • Step 510 The second host responds to the second ARP request.
  • the second host 642 receives the second ARP request sent by the second switch 662, and finds that the destination IP address in the second ARP request is the same as its own IP address, and then constructs a second ARP response.
  • the second ARP response source MAC address is the MAC address of the second host 642
  • the source IP address is the IP address of the second host 642
  • the destination MAC address is the MAC address of the second proxy device
  • the destination IP is the IP address of the first host 640.
  • the address is sent by the second switch 662 to the controller 620 for the second ARP response.
  • the controller 620 receives the second ARP response.
  • Step 51 The controller acquires network information of the second host.
  • the controller 620 obtains the MAC address and the IP address of the second host 642 according to the received second ARP response, and uses the MAC address and the IP address of the second host 642 as the network information of the second host 642;
  • the controller 620 can also obtain the port information of the second host 642 as needed, and use the MAC address, IP address, and port information of the second host 642 as the second host 642.
  • Network information may include the MAC address and IP address of the second host 642, and may also include the MAC address, IP address, and port information of the second host 642.
  • the controller completes the ARP learning process between the implemented second proxy device and the second host 642;
  • Step 512 The controller calculates a shortest forwarding path between the first host and the second host according to the network information of the first host and the network information of the second host.
  • the shortest forwarding path is used as the forwarding between the first host and the second host.
  • the controller 620 analyzes the destination IP address of the data packet sent by the first switch 660, and finds that the destination host of the data packet, that is, the second host 642 and the first host 640 are in different subnets, and determines that it is a three-layer forwarding, and The MAC address, IP address, and port information of the first host 640 and the second host 642 are obtained through the ARP learning process, and the forwarding path is generated according to the routing algorithm decision. If the forwarding path is generated according to the shortest path policy, the generated forwarding path may be generated.
  • the first switch 660 ⁇ -> the third switch 664 ⁇ -> the second switch 662.
  • the controller 620 can determine that the IP address of the first host 640 and the second host 642 is three-layer forwarding. Generating a forwarding path according to the routing algorithm decision, and assuming that the forwarding path is generated according to the shortest path policy, the forwarding path generated according to the port information of the first host 640 and the second host 642 It may be: a first switch 660 ⁇ -> a third switch 664 ⁇ -> a second switch 662.
  • controller 620 may further calculate an optimal forwarding path between the first host 640 and the second host 642 according to the network information of the first host 640 and the network information of the second host 642.
  • the optimal forwarding path is a chain.
  • the optimal path of the path is used as the forwarding path between the first host 640 and the second host 642.
  • the shortest path policy is used as an example for description.
  • Step 513 The controller generates a corresponding forwarding flow table for the switch on the forwarding path according to the generated forwarding path, and sends the generated forwarding flow table to the corresponding switch.
  • the controller 620 generates a corresponding forwarding flow table for the switch on the forwarding path according to the generated forwarding path, and sends the generated forwarding flow table to the corresponding switch.
  • the controller 620 is the first switch 660 on the shortest path.
  • the third switch 664 and the second switch 662 generate a corresponding forwarding flow table, and send the forwarding flow table corresponding to the first switch 660 to the first switch 660, and send the forwarding flow table corresponding to the third switch 664 to the third switch. 664. Send the forwarding flow table corresponding to the second switch 662 to the second switch 662.
  • the third switch 664 is not labeled in Figure 5.
  • Step 514 The corresponding switch updates the local forwarding flow table according to the forwarding flow table.
  • the first switch 660, the third switch 664, and the second switch 662 on the corresponding shortest path update the local forwarding flow table information.
  • Step 515 The corresponding switch forwards the communication data packet between the first host and the second host according to the updated forwarding flow table.
  • the first switch 660, the third switch 664, and the second switch 662 on the corresponding shortest path forward the communication data packet between the first host 640 and the second host 642 according to the updated forwarding flow table.
  • the implementation method of the three-layer forwarding replaces the partial OpenFlow switch that implements the gateway/routing function in the OpenFlow network by using the controller, and the controller implements the first two subnets corresponding to the communication.
  • the proxy ARP function of the proxy device and the second proxy device enables all switches in the OpenFlow network to implement a simple forwarding function, thereby solving the problem that the dedicated OpenFlow switch in the OpenFlow network cannot implement the gateway/routing function. There is no need to separately set up a switch functioning as a gateway/router in the OpenFlow network. Effect.
  • control message can be transmitted between the controller and the switch through a dedicated network, and the communication path for forwarding data between the switch and the switch is isolated on the physical link; or the communication path for forwarding data with the switch is the same path.
  • Different rules are used to distinguish between control messages between the controller and the switch and forwarding data between the switches. The following is an embodiment of the device of the present invention, and the content that is not described in detail may be referred to the corresponding method embodiment.
  • FIG. 7 is a schematic structural diagram of a controller according to Embodiment 4 of the present invention.
  • the controller includes: a first information acquiring module 710, a second information acquiring module 720, a path generating module 730, and a flow table.
  • Send module 740 is a schematic structural diagram of a controller according to Embodiment 4 of the present invention.
  • the first information obtaining module 710 is configured to acquire network information of the first host by using the received first ARP request, where the first ARP request is sent by the first host, and is related to the first host The connected switch cannot find the ARP request that is forwarded to the controller after forwarding the flow table.
  • the second information obtaining module 720 is configured to acquire the network information of the second host by constructing the second ARP request.
  • the path generation module 730 is configured to generate, according to the network information of the first host acquired by the first information acquiring module 710 and the network information of the second host acquired by the second information acquiring module 720. a forwarding path between a host and the second host;
  • the flow table issuing module 740 is configured to send a forwarding flow table to each switch on the forwarding path generated by the path generation module 730, so that each switch on the forwarding path is in accordance with the forwarding flow table. Transmitting a data packet between the first host and the second host.
  • the controller provided in this embodiment generates a forwarding path according to the obtained network information of the first host and the second host by acquiring the network information of the first host and the second host, so that the first host and the first host and The second host communicates, which solves the problem that the dedicated OpenFlow switch in the OpenFlow network cannot implement the function, and achieves the effect that the switch that does not need to be separately set to the gateway/route function is required in the OpenFlow network.
  • Embodiment 5 Embodiment 5
  • FIG. 8 is a schematic structural diagram of a controller provided in Embodiment 5 of the present invention.
  • the implementation environment includes a controller 420, a first host 440, a second host 442, a third host 444, and a fourth host 446, a first switch 460, a second switch 462, a third switch 464, and a fourth The switch 466 and the fifth switch 468, wherein the first host 440 belongs to the first subnet, the second host 442, the third host 444, and the fourth host 446 belong to the second subnet, and the first host 440 and the third host 444 are connected to On the port of the first switch 460, the second host 442 is connected to the port of the second switch 462, and the fourth host 446 is connected to the port of the fifth switch 468.
  • the second host 442 is configured as a second gateway, the first host 440 belongs to the first subnet, and the second host 442, the third host 444, and the fourth host 446 belong to the second subnet, and the first gateway and the second gateway are controlled.
  • the 420 is implemented on the controller 420, and the information about the subnet where the first host 440 and the second host 442 are located (including the gateway, the network number, and the subnet mask) and corresponding Gateway information (including IP address and MAC address of the gateway).
  • the controller includes: a first pre-storage module 810, a first information acquisition module 820, a first feedback module 830, a second information acquisition module 840, a path generation module 850, and a flow table delivery module 860.
  • the first pre-storage module 810 is configured to pre-store a gateway, a network number, and a subnet mask of a subnet where the first host 440 and the second host 442 are located, and the first gateway and the second The MAC address and IP address of the gateway.
  • the first information obtaining module 820 is configured to acquire network information of the first host 440 by using the received first ARP request, where the first ARP request is sent by the first host 440, and the first A switch connected to a host 440 cannot find an ARP request forwarded to the controller 420 after forwarding the flow table.
  • the first information acquiring module 820 includes: a fourth receiving unit 821 and a first acquiring unit 822.
  • the fourth receiving unit 821 is configured to receive the first ARP request sent by the first host 440.
  • the first obtaining unit 822 is configured to acquire network information of the first host 440 by using the first ARP request received by the fourth receiving unit 821.
  • the first feedback module 830 is configured to feed back a first ARP response to the first host 440 by using a switch connected to the first host 440, where a source MAC address and a source IP address in the first ARP response are respectively Is the MAC address and IP address of the first gateway.
  • the second information acquiring module 840 is configured to acquire network information of the second host 442 by constructing a second ARP request.
  • the second information acquiring module 840 includes: a first receiving unit 841, a first constructing unit 842, a first sending unit 843, a second receiving unit 844, and a second acquiring unit 845.
  • the first receiving unit 841 is configured to receive a data packet sent by the first host 440, where a destination MAC address of the data packet is a MAC address of the first gateway, and a destination IP address is the second host 442. IP address.
  • the first constructing unit 842 is configured to construct a second ARP request according to an IP address of the second host 442 in the data packet received by the first receiving unit 841, a source MAC address and a source of the second ARP request.
  • the IP address is the MAC address and the IP address of the second gateway
  • the destination IP address is the IP address of the second host 442
  • the second gateway is the configuration gateway of the second host 442.
  • the first sending unit 843 is configured to use, according to the gateway, the network number, and the subnet mask of the subnet where the second host 442 is pre-stored by the first pre-storage module 810, by using the second host 442 in the subnet
  • the switch sends the second ARP request constructed by the first construction unit 842 to all hosts in the subnet where the second host 442 is located.
  • the second receiving unit 844 is configured to receive, by using a switch connected to the second host 442, a second ARP response that is sent by the second host 442, where the source MAC address and the source IP address of the second ARP response are respectively It is the MAC address and IP address of the second host 442.
  • the second obtaining unit 845 is configured to acquire network information of the second host 442 according to the second ARP response received by the second receiving unit 844.
  • the path generation module 850 is configured to: according to the network information of the first host 440 acquired by the first information acquiring module 820 and the second host acquired by the second information acquiring module 840 The network information decision of 442 generates a forwarding path between the first host 440 and the second host 442.
  • the path generation module 850 specifically includes: a shortest generation unit 851, or an optimal generation unit 852.
  • the shortest generation unit 851 is configured to calculate, according to the network information of the first host 440 acquired by the first information acquiring module 820 and the network information of the second host 442 acquired by the second information acquiring module 840.
  • the shortest forwarding path between the first host 440 and the second host 442; the shortest forwarding path is used as a forwarding path between the first host 440 and the second host 442.
  • the optimal generation unit 852 is configured to calculate, according to the network information of the first host 440 acquired by the first information acquiring module 820 and the network information of the second host 442 acquired by the second information acquiring module 840. An optimal forwarding path between the first host 440 and the second host 442; the optimal forwarding path is used as a forwarding path between the first host 440 and the second host 442.
  • the flow table issuing module 860 is configured to deliver a forwarding flow table to each switch on the forwarding path generated by the path generation module 850, so that each switch on the forwarding path is in accordance with the forwarding flow table.
  • the data packet is forwarded between the first host 440 and the second host 442.
  • the controller provided in this embodiment obtains network information of the first host and the second host by implementing the ARP function of the first gateway and the second gateway, according to the first host and the pre-stored
  • the information about the subnet where the second host is located and the corresponding gateway information and the obtained network information of the first host and the second host determine a forwarding path, so that all switches in the OpenFlow network can implement a simple forwarding function, thereby solving
  • the dedicated OpenFlow switch in the OpenFlow network cannot implement the gateway/routing function, and the effect of the switch that does not need to be separately set to the gateway/routing function in the OpenFlow network is achieved.
  • FIG. 9 is a schematic structural diagram of a controller provided in Embodiment 6 of the present invention.
  • This embodiment is mainly illustrated by the application of the controller to the implementation environment shown in FIG. 6.
  • the implementation environment includes a controller 620, a first host 640, a second host 642, a third host 644, and a fourth host 646, a first switch 660, a second switch 662, a third switch 664, a fourth switch 666, and The fifth switch 668, wherein the first host 640 belongs to the first subnet, the second host 642, the third host 644, and the fourth host 646 belong to the second subnet, and the first host 640 and the third host 644 are connected to the first switch.
  • the second host 642 is connected to the port of the second switch 662, and the fourth host 646 is connected to the port of the fifth switch 668. It is assumed that the first host 640 and the second host 642 are not configured with a default gateway.
  • the host 640 belongs to the first subnet, and the second host 642, the third host 644, and the fourth host 646 belong to the second subnet.
  • the controller 620 pre-stores information about the subnet where the first host 640 and the second host 642 are located ( The gateway, the network number, and the subnet mask are included, and the first proxy device and the second proxy device respectively correspond to the two subnets.
  • the controller includes: a second pre-storage module 910, a first information acquisition module 920, a second feedback module 930, a second information acquisition module 940, a path generation module 950, and a flow table delivery module 960.
  • the second pre-storage module 910 is configured to pre-store a gateway, a network number, and a subnet mask of a subnet where the first host 640 and the second host 642 are located, and the first proxy device and the first The MAC address of the second proxy device.
  • the first information obtaining module 920 is configured to acquire network information of the first host 640 by using the received first ARP request, where the first ARP request is sent by the first host 640 and is related to the first A switch connected to a host 640 cannot find an ARP request forwarded to the controller 620 after forwarding the flow table.
  • the first information acquiring module 920 includes: a fourth receiving unit 921 and a first acquiring unit 922.
  • the fourth receiving unit 921 is configured to receive the first ARP request sent by the first host 640.
  • the first obtaining unit 922 is configured to acquire network information of the first host 440 by using the first ARP request received by the fourth receiving unit 921.
  • the second feedback module 930 is configured to feed back, by the switch connected to the first host 640, the first ARP response to the first host 640, where the source MAC address in the first ARP response is the first proxy device.
  • MAC address the source IP address is the IP address of the second host, so as to
  • the first host 640 uses the MAC address of the first proxy device as the MAC address of the second host 642, and the first proxy device is a proxy device corresponding to the subnet in which the first host 640 is located.
  • the second information acquiring module 940 is configured to acquire network information of the second host 642 by constructing a second ARP request.
  • the second information acquiring module 940 includes: a third receiving unit 941, a second constructing unit 942, a second sending unit 943, a second receiving unit 944, and a second obtaining unit 945.
  • the third receiving unit 941 is configured to receive a data packet sent by the first host 640, where a destination MAC address of the data packet is a MAC address of the first proxy device, and a destination IP address is the second host 642 IP address.
  • the second constructing unit 942 is configured to construct a second ARP request according to the IP address of the second host 642 in the data packet received by the third receiving unit 941, where the source MAC address of the second ARP request is The MAC address of the second proxy device, the source IP address being the IP address of the first host 640, and the destination IP address being the IP address of the second host 642, so that the second host 642 will be the second proxy device
  • the MAC address is used as the MAC address of the first host 640
  • the second proxy device is a proxy device corresponding to the subnet in which the second host 642 is located.
  • the second sending unit 943 is configured to send, by using a switch in a subnet where the second host 642 is located, a second ARP request configured by the second configuration unit 942 to a subnet in which the second host 642 is located. All hosts.
  • the second receiving unit 944 is configured to use a switch connected to the second host 642 according to a gateway, a network number, and a subnet mask of a subnet where the second host 642 is pre-stored by the second pre-storage module 910. And receiving, by the second host 642, the second ARP response, where the source MAC address and the source IP address of the second ARP response are respectively the MAC address IP address of the second host 642.
  • the second obtaining unit 945 is configured to acquire network information of the second host 642 according to the second ARP response received by the second receiving unit 944.
  • the path generation module 950 is configured to generate, according to the network information of the first host 640 acquired by the first information acquiring module 920 and the network information decision generation of the second host 642 acquired by the second information acquiring module 940. Forwarding between the first host 640 and the second host 642 Path.
  • the path generation module 950 specifically includes: a shortest generation unit 951, or an optimal generation unit 952.
  • the shortest generation unit 951 is configured to calculate, according to the network information of the first host 640 acquired by the first information acquiring module 920 and the network information of the second host 642 acquired by the second information acquiring module 940.
  • the optimal generation unit 952 is configured to calculate, according to the network information of the first host 640 acquired by the first information acquiring module 920 and the network information of the second host 642 acquired by the second information acquiring module 940.
  • the optimal forwarding path between the first host 640 and the second host 642 is used as the forwarding path between the first host 640 and the second host 642.
  • the flow table issuing module 960 is configured to send a forwarding flow table to each switch on the forwarding path generated by the path generating module 950, so that each switch on the forwarding path is in accordance with the forwarding flow table.
  • the data packet is forwarded between the first host 640 and the second host 642.
  • the controller provided by the embodiment obtains the network information of the first host and the second host by implementing the proxy ARP function of the first proxy device and the second proxy device, according to the first host stored in advance. And the information about the subnet where the second host is located and the corresponding gateway information and the obtained network information of the first host and the second host determine a forwarding path, so that all switches in the OpenFlow network can implement a simple forwarding function. Therefore, the problem that the dedicated OpenFlow switch in the OpenFlow network cannot implement the gateway/routing function is solved, and the effect that the switch functioning as the gateway/routing function is not required in the OpenFlow network is achieved.
  • FIG. 10 a block diagram showing the structure of a forwarding path generating system provided in Embodiment 7 of the present invention is shown.
  • the system includes the controller 1010, the first host 1020, and the second host 1030 provided in the fifth embodiment or the sixth embodiment.
  • the system for generating a forwarding path obtains the network information of the first host and the second host by using the controller, and generates a forwarding path according to the obtained network information of the first host and the second host.
  • the problem that the dedicated OpenFlow switch in the OpenFlow network cannot implement the function is solved, and the effect that the switch functioning as the gateway/routing function is not required in the OpenFlow network is achieved.
  • the controller includes: a processor 1 101 and a transmitter 1 102.
  • the processor 1101 is configured to acquire network information of the first host by using the received first ARP request, where the first ARP request is sent by the first host and connected to the first host.
  • the switch cannot find the ARP request forwarded to the controller after forwarding the flow table.
  • the processor 1101 is further configured to acquire network information of the second host by constructing a second ARP request.
  • the processor 1101 is further configured to generate, according to the acquired network information of the first host and the network information of the second host, a forwarding path between the first host and the second host.
  • the transmitter 1102 is configured to send, to each switch on the forwarding path generated by the processor 1 101, a forwarding flow table, so that each switch on the forwarding path is configured according to the forwarding flow table.
  • a data packet is forwarded between the first host and the second host.
  • the controller provided in this embodiment generates a forwarding path according to the obtained network information of the first host and the second host by acquiring the network information of the first host and the second host, so that the first host and the first host and The second host communicates and resolves the dedicated one in the OpenFlow network.
  • the OpenFlow switch cannot implement the problem of this function, and the effect of the switch that does not need to be separately set to the gateway/routing function in the OpenFlow network is achieved.
  • FIG. 12 a block diagram showing the structure of a controller provided in Embodiment 9 of the present invention is shown. This embodiment is mainly illustrated by the application of the controller to the implementation environment shown in FIG.
  • the controller includes: a memory 1201, a processor 1202, a transmitter 1203, and a receiver 1204.
  • the memory 1201 is configured to pre-store a gateway, a network number, and a subnet mask of a subnet where the first host 440 and the second host 442 are located, and a MAC address of the first gateway and the second gateway. And IP address.
  • the processor 1202 is configured to obtain network information of the first host 440 by using the received first ARP request, where the first ARP request is sent by the first host 440 and is related to the first host 440.
  • the connected switch cannot find the ARP request forwarded to the controller 420 after forwarding the flow table.
  • the processor 1202 is specifically configured to control the receiver 1204 to receive the first ARP request sent by the first host 440.
  • the processor 1202 is further configured to acquire network information of the first host 440 by using the first ARP request received by the receiver 1204.
  • the transmitter 1203 is configured to feed back, by the switch connected to the first host 440, the first ARP response to the first host 440, where the source MAC address and the source IP address in the first ARP response are respectively The MAC address and IP address of the first gateway.
  • the processor 1202 is further configured to acquire network information of the second host 442 by constructing a second ARP request.
  • the processor 1202 is specifically configured to control the receiver 1204 to receive a data packet sent by the first host 440, where a destination MAC address of the data packet is a MAC address of the first gateway, and The IP address is the IP address of the second host 442.
  • the processor 1202 is further configured to construct a second ARP request according to the IP address of the second host 442 in the data packet received by the receiver 1204.
  • the source MAC address and the source IP address of the second ARP request are respectively the MAC address and the IP address of the second gateway, and the destination IP address is the IP of the second host 442.
  • the second gateway is a configuration gateway of the second host 442.
  • the processor 1202 is further configured to control a subnet where the second host 442 is pre-stored by the transmitter 1203 according to the memory 1201. a gateway, a network number, and a subnet mask, where the second ARP request is sent to all hosts in the subnet where the second host 442 is located by using a switch in the subnet where the second host 442 is located; the processor 1202
  • the receiver 1202 is further configured to receive, by using a switch connected to the second host 442, a second ARP response fed back by the second host 442, a source MAC address and a source IP address of the second ARP response.
  • the processor is configured to obtain the network information of the second host 442 according to the second ARP response received by the receiver 1204.
  • the processor 1202 is further configured to generate the first host 440 and the second host 442 according to the acquired network information of the first host 440 and the acquired network information of the second host 442. The forwarding path between.
  • the processor 1202 is further configured to calculate the first host 440 and the network according to the acquired network information of the first host 440 and the acquired network information of the second host 442.
  • the shortest forwarding path between the second host 442; the shortest forwarding path is used as a forwarding path between the first host 440 and the second host 442; or the processor 1202 is further configured to be used according to Calculating the optimal forwarding path between the first host 440 and the second host 442 by using the acquired network information of the first host 440 and the acquired network information of the second host 442;
  • the optimal forwarding path is used as a forwarding path between the first host 440 and the second host 442.
  • the processor 1202 is further configured to send a forwarding flow table to each switch on the generated forwarding path, so that each switch on the forwarding path is in the first host 440 according to the forwarding flow table. And forwarding the data packet with the second host 442.
  • the controller provided in this embodiment obtains network information of the first host and the second host by implementing the ARP function of the first gateway and the second gateway, according to the first host and the pre-stored
  • the information about the subnet where the second host is located and the corresponding gateway information and the obtained network information of the first host and the second host determine a forwarding path, so that all switches in the Open Flow network can implement a simple forwarding function. Resolved a dedicated in the OpenFlow network
  • the OpenFlow switch cannot implement the problem of the gateway/routing function, and the effect of the switch that does not need to be separately set to the gateway/routing function in the OpenFlow network is achieved.
  • FIG. 12 shows a structural block diagram of a controller provided in Embodiment 10 of the present invention. This embodiment is mainly illustrated by the application of the controller to the implementation environment shown in FIG. 6.
  • the controller includes: a memory 1201, a processor 1202, a transmitter 1203, and a receiver 1204.
  • the memory 1201 is configured to pre-store a gateway, a network number, and a subnet mask of a subnet where the first host 640 and the second host 642 are located, and the first proxy device and the second proxy device. MAC address.
  • the processor 1202 is configured to acquire network information of the first host 640 by using the received first ARP request, where the first ARP request is sent by the first host 640 and is related to the first host 640 The connected switch cannot find the ARP request forwarded to the controller 620 after forwarding the flow table.
  • the processor 1202 is specifically configured to control the receiver 1204 to receive the first ARP request sent by the first host 640.
  • the processor 1202 is further configured to pass the receiver.
  • the received first ARP request of 1204 acquires network information of the first host 440.
  • the transmitter 1203 is configured to feed back, by the switch connected to the first host 640, the first ARP response to the first host 640, where the source MAC address in the first ARP response is the MAC address of the first proxy device.
  • the address, the source IP address is the IP address of the second host, so that the first host 640 uses the MAC address of the first proxy device as the MAC address of the second host 642, and the first proxy device corresponds to the The proxy device in the subnet where the first host 640 is located.
  • the processor 1202 is further configured to acquire network information of the second host 642 by constructing a second ARP request.
  • the processor 1202 is specifically configured to control the receiver 1204 to receive a data packet sent by the first host 640, where a destination MAC address of the data packet is a MAC address of the first proxy device, The destination IP address is the IP address of the second host 642.
  • the processor 1202 is further configured to use the second host 642 in the data packet received by the receiver 1204.
  • the IP address of the second ARP request is configured, the source MAC address of the second ARP request is the MAC address of the second proxy device, the source IP address is the IP address of the first host 640, and the destination IP address is the second The IP address of the host 642, so that the second host 642 uses the MAC address of the second proxy device as the MAC address of the first host 640, and the second proxy device corresponds to the second host 642.
  • the proxy device in the subnet; the processor 1202 is further configured to control the sender 1203 to send the second ARP request to the second host by using a switch in a subnet where the second host 642 is located
  • the processor 1202 is further configured to control, according to the gateway, the network number, and the subnet mask of the subnet where the second host 642 is pre-stored by the receiver 1204 according to the memory 1201.
  • the second ARP response fed back by the second host 642 is received by the switch connected to the second host 642, where the source MAC address and the source IP address of the second ARP response are respectively the MAC address of the second host 642. IP address;
  • Processor 1202 is also configured to acquire the second host network response information 642 according to the second ARP received by the receiver 1204.
  • the processor 1202 is further configured to generate the first host 640 and the second host 642 according to the acquired network information of the first host 640 and the acquired network information of the second host 642. The forwarding path between.
  • the processor 1202 is specifically configured to calculate, according to the acquired network information of the first host 640 and the acquired network information of the second host 642, the first host 640 and the first The shortest forwarding path between the two hosts 642; the shortest forwarding path is used as a forwarding path between the first host 640 and the second host 642; or the processor 1202 is further configured to be used according to the Calculating the optimal forwarding path between the first host 640 and the second host 642 by calculating the obtained network information of the first host 640 and the acquired network information of the second host 642; The forwarding path is used as a forwarding path between the first host 640 and the second host 642.
  • the transmitter 1203 is further configured to send, to each switch on the forwarding path generated by the processor 1202, a forwarding flow table, so that each switch on the forwarding path is in the foregoing according to the forwarding flow table.
  • a data packet is forwarded between a host 640 and the second host 642.
  • the controller provided in this embodiment implements the first proxy device and the second proxy.
  • the proxy ARP function of the device acquires network information of the first host and the second host, according to pre-stored information of the first host and the second host where the second host is located, and corresponding gateway information and the obtained first host.
  • the network information of the second host determines the forwarding path, so that all the switches in the OpenFlow network can implement the simple forwarding function, thereby solving the problem that the dedicated OpenFlow switch in the OpenFlow network cannot implement the gateway/routing function. There is no need to separately set the effect of the switch functioning as a gateway/routing function in the OpenFlow network.
  • a person skilled in the art may understand that all or part of the steps of implementing the above embodiments may be completed by hardware, or may be instructed by a program to execute related hardware, and the program may be stored in a computer readable storage medium.
  • the storage medium mentioned may be a read only memory, a magnetic disk or an optical disk or the like.

Landscapes

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

Abstract

The present invention belongs to the technical field of networks, and disclosed are a forwarding path generating method, controller, and system. The method comprises: obtaining network information of a first host by using a received first ARP request; obtaining network information of a second host by constructing a second ARP request; deciding to generate a forwarding path according to the network information of the first host and the second host; and delivering a forwarding flow table to each switch on the forwarding path, so that each switch on the forwarding path forwards a data packet between the first host and the second host according to the forwarding flow table. According to the present invention, a controller is used to replace a part of OpenFlow switches that implement a gateway/router in an OpenFlow network, so that the problem that a dedicated OpenFlow switch in the OpenFlow network cannot implement the function is solved, and the effect that a switch functioning as a gateway/router does not need to be set separately in the OpenFlow network is achieved.

Description

转发路径的生成方法、 控制器和系统 本申请要求于 2013 年 4 月 22 日提交中国专利局、 申请号为 201310140475.6、发明名称为 "转发路径的生成方法、控制器和系统" 的中国 专利申请的优先权, 上述专利申请的全部内容通过引用结合在本申请中。  Method, controller and system for generating forwarding path The present application claims to be filed on April 22, 2013 by the Chinese Patent Office, the application number is 201310140475.6, and the invention name is "transmission path generation method, controller and system" The entire contents of the above-identified patent application are incorporated herein by reference.
技术领域 Technical field
本发明涉及网络技术领域, 特别涉及一种转发路径的生成方法、 控制器 和系统。  The present invention relates to the field of network technologies, and in particular, to a method, a controller, and a system for generating a forwarding path.
背景技术 Background technique
OpenFlow是一种新型网络交换模型, 包括 OpenFlow交换机( OpenFlow Switch )和控制器(Crontroller ); 其中, OpenFlow 交换机进行数据层的转发; 控制器对网络进行集中控制, 实现控制层的功能。 OpenFlow交换机分为两类: 专用的 OpenFlow交换机和支持 OpenFlow的交换机。 专用的 OpenFlow交换 机不具有控制逻辑, 只是用来在端口间转发数据包的一个简单路径部件, 对 于接收到的数据包都按照 OpenFlow模式进行转发; 而支持 OpenFlow的交换 机既可以按照 OpenFlow模式进行转发数据包,也可以按照现有交换机的转发 模式进行转发数据包。  OpenFlow is a new type of network switching model, including OpenFlow switch (OpenFlow Switch) and controller (Crontroller); Among them, OpenFlow switch forwards the data layer; controller controls the network centrally to realize the function of the control layer. OpenFlow switches fall into two categories: dedicated OpenFlow switches and switches that support OpenFlow. A dedicated OpenFlow switch does not have control logic. It is only a simple path component for forwarding data packets between ports. The received data packets are forwarded according to OpenFlow mode. The switches supporting OpenFlow can forward data according to OpenFlow mode. Packets can also be forwarded according to the forwarding mode of the existing switch.
在实际 OpenFlow网络中, 由 OpenFlow交换机和控制器来共同完成现有 网络中完全由交换机 /路由器控制的报文转发过程, 从而实现数据转发和路由 控制的分离。 请参考图 1, 其示出了现有 openflow网络的实施环境, 该实施 环境包括控制器 120、 第一主机 140和第二主机 142、 第一交换机 160、 第二 交换机 162、 第三交换机 164、 第四交换机 166和第五交换机 168, 其中第一 主机 140和第二主机 142属于不同的子网, 分别连接在第一交换机 160和第 二交换机 162的端口上, 第四交换机 166和第五交换机 168分别实现第一主 机 140和第二主机 142的配置网关功能, 即假设第一主机 140配置第一网关、 第二主机 142 配置第二网关, 第一网关和第二网关的作用分别由第四交换机 166和第五交换机 168实现。在第一主机 140和第二主机 142的实际通信过程 中, 第一主机 140首先和第四交换机 166之间通过 ARP ( Address Resolution Protocol , 地址解析协议) 学习过程获取第一网关的 MAC ( Medium/Media Access Control, 介质访问控制层)地址, 获取到第一网关的 MAC地址之后, 第一主机向第四交换机 166发送目的主机为第二主机 142的数据包, 第四交 换机收到该数据包之后, 若查询不到与该数据包对应的转发流表信息, 则将 该数据包上报给控制器, 控制器根据子网信息和该数据包的目的 IP地址决策 后下发转发流表, 第四交换机 166将该数据包转发给第五交换机 168, 第五交 换机 168和第二主机 142之间通过 ARP学习过程获取第二主机 142的 MAC 地址, 获取到第二主机 142的 MAC地址之后, 将该数据包转发给第二主机 142。 In the actual OpenFlow network, the OpenFlow switch and the controller jointly complete the packet forwarding process controlled by the switch/router in the existing network, thereby realizing the separation of data forwarding and routing control. Please refer to FIG. 1 , which illustrates an implementation environment of an existing openflow network, where the implementation environment includes a controller 120, a first host 140 and a second host 142, a first switch 160, a second switch 162, and a third switch 164. The fourth switch 166 and the fifth switch 168, wherein the first host 140 and the second host 142 belong to different subnets, respectively connected to ports of the first switch 160 and the second switch 162, and the fourth switch 166 and the fifth switch 168, respectively, implements the configuration gateway function of the first host 140 and the second host 142, that is, the first host 140 configures the first gateway, the second host 142 configures the second gateway, and the functions of the first gateway and the second gateway are respectively performed by the fourth switch 166 and fifth switch 168 are implemented. During the actual communication between the first host 140 and the second host 142, the first host 140 first obtains the MAC of the first gateway through an ARP (Address Resolution Protocol) learning process between the first host 140 and the fourth switch 166 (Medium/ Media Access Control, medium access control layer) address, after obtaining the MAC address of the first gateway, the first host sends a data packet of the destination host to the second host 142 to the fourth switch 166, and after receiving the data packet, the fourth switch receives the data packet. If the forwarding flow table information corresponding to the data packet is not queried, the data packet is reported to the controller, and the controller sends the forwarding flow table according to the subnet information and the destination IP address of the data packet, and the fourth The switch 166 forwards the data packet to the fifth switch 168. The fifth switch 168 and the second host 142 obtain the MAC address of the second host 142 through the ARP learning process, and obtain the MAC address of the second host 142. The data packet is forwarded to the second host 142.
在实现本发明的过程中, 发明人发现现有技术至少存在以下缺点: 部分 OpenFlow交换机需要承担网关 /路由的功能,比如图 1中的第四交换机 166和 第五交换机 168, 而 OpenFlow网络中的专用的 OpenFlow交换机无法实现该 功能, 即如果充当网关作用的第四交换机 166 和第五交换机 168 为专用的 Openflow交换机时, 则无法实现该功能。  In the process of implementing the present invention, the inventors have found that the prior art has at least the following disadvantages: Some OpenFlow switches need to undertake gateway/routing functions, such as the fourth switch 166 and the fifth switch 168 in FIG. 1, but in the OpenFlow network. This function cannot be implemented by a dedicated OpenFlow switch, that is, if the fourth switch 166 and the fifth switch 168 acting as gateways are dedicated Openflow switches, this function cannot be implemented.
发明内容 Summary of the invention
为了解决 OpenFlow网络中的专用的 OpenFlow交换机无法实现网关 /路 由的功能的问题, 本发明实施例提供了一种转发路径的生成方法、 控制器和 系统。 所述技术方案如下:  In order to solve the problem that the dedicated OpenFlow switch in the OpenFlow network cannot implement the function of the gateway/route, the embodiment of the present invention provides a method, a controller, and a system for generating a forwarding path. The technical solution is as follows:
根据本发明的一个方面, 本发明实施例提供了一种转发路径的生成方法, 所述方法包括:  According to an aspect of the present invention, an embodiment of the present invention provides a method for generating a forwarding path, where the method includes:
控制器通过接收到的第一 ARP请求获取第一主机的网络信息, 所述第一 ARP请求是由所述第一主机发送的、 且与所述第一主机相连的交换机无法查 找到转发流表后转发给所述控制器的 ARP请求;  The controller obtains the network information of the first host by using the received first ARP request, where the first ARP request is sent by the first host, and the switch connected to the first host cannot find the forwarding flow table. An ARP request forwarded to the controller;
所述控制器通过构造第二 ARP请求获取第二主机的网络信息;  The controller acquires network information of the second host by constructing a second ARP request;
所述控制器根据所述第一主机的网络信息和所述第二主机的网络信息决 策生成所述第一主机和所述第二主机之间的转发路径; 所述控制器向所述转发路径上的每个交换机下发转发流表, 以便所述转 发路径上的每个交换机根据所述转发流表在所述第一主机和所述第二主机之 间转发数据包。 The controller generates a forwarding path between the first host and the second host according to the network information of the first host and the network information of the second host; Transmitting, by the controller, a forwarding flow table to each switch on the forwarding path, so that each switch on the forwarding path is between the first host and the second host according to the forwarding flow table Forward the packet.
在第一方面的第一种可能的实施方式中, 若所述第一 ARP请求中的目的 IP地址是第一网关的 IP地址, 所述第一网关是所述第一主机的配置网关, 则 所述通过接收到的第一 ARP请求获取第一主机的网络信息之后, 还包括: 所述控制器通过与所述第一主机相连的交换机向所述第一主机反馈第一 ARP响应, 所述第一 ARP响应中的源 MAC地址和源 IP地址分别为所述第 一网关的 MAC地址和 IP地址。  In a first possible implementation manner of the first aspect, if the destination IP address in the first ARP request is an IP address of the first gateway, and the first gateway is a configuration gateway of the first host, After the receiving, by the received first ARP request, the network information of the first host, the controller further includes: the controller feeding back a first ARP response to the first host by using a switch connected to the first host, where The source MAC address and the source IP address in the first ARP response are respectively the MAC address and the IP address of the first gateway.
结合第一方面的第一种可能的实施方式, 在第二种可能的实施方式中, 所述控制器通过构造第二 ARP请求获取第二主机的网络信息, 包括:  With reference to the first possible implementation manner of the first aspect, in a second possible implementation, the controller acquires network information of the second host by constructing the second ARP request, including:
所述控制器接收所述第一主机发送的数据包,所述数据包的目的 MAC地 址为所述第一网关的 MAC地址, 目的 IP地址为所述第二主机的 IP地址; 所述控制器根据所述第二主机的 IP地址构造第二 ARP请求, 所述第二 ARP请求的源 MAC地址和源 I P地址分别为第二网关的 MAC地址和 I P地址, 目的 IP地址为所述第二主机的 IP地址,所述第二网关为所述第二主机的配置 网关;  Receiving, by the controller, a data packet sent by the first host, where a destination MAC address of the data packet is a MAC address of the first gateway, and a destination IP address is an IP address of the second host; Constructing a second ARP request according to the IP address of the second host, where the source MAC address and the source IP address of the second ARP request are respectively a MAC address and an IP address of the second gateway, and the destination IP address is the second host IP address, the second gateway is a configuration gateway of the second host;
所述控制器通过所述第二主机所在子网内的交换机将所述第二 ARP请求 发送给所述第二主机所在子网内的所有主机;  The controller sends the second ARP request to all hosts in the subnet where the second host is located by using a switch in a subnet where the second host is located;
所述控制器通过与所述第二主机相连的交换机接收所述第二主机反馈的 第二 ARP响应, 所述第二 ARP响应的源 MAC地址和源 IP地址分别为所述 第二主机的 MAC地址和 IP地址。  Receiving, by the switch connected to the second host, the second ARP response that is sent by the second host, where the source MAC address and the source IP address of the second ARP response are respectively the MAC address of the second host Address and IP address.
结合第一方面的第二种可能的实施方式, 在第三种可能的实施方式中, 所述控制器通过接收到的第一 ARP请求获取第一主机的网络信息之前, 还包 括:  With reference to the second possible implementation manner of the first aspect, in a third possible implementation manner, before the acquiring, by the controller, the network information of the first host by using the received first ARP request, the controller further includes:
所述控制器预先存储所述第一主机和所述第二主机所在子网的网关、 网 络号和子网掩码,以及所述第一网关和所述第二网关的 MAC地址和 I P地址; 所述控制器通过所述第二主机所在子网的交换机将所述第二 ARP请求发 送给所述第二主机所在子网内的所有主机, 包括; The controller pre-stores a gateway, a network number, and a subnet mask of a subnet where the first host and the second host are located, and a MAC address and an IP address of the first gateway and the second gateway; The controller sends the second ARP request by using a switch of a subnet where the second host is located All hosts in the subnet where the second host is located, including;
所述控制器根据所述第二主机所在子网的网关、 网络号和子网掩码将所 述第二 ARP请求发送给所述第二主机所在子网内的所有主机。  The controller sends the second ARP request to all hosts in the subnet where the second host is located according to the gateway, the network number, and the subnet mask of the subnet where the second host is located.
结合第一方面, 在第四种可能的实施方式中, 若所述第一 ARP请求中的 目的 IP地址是所述第二主机的 IP地址, 则所述通过接收到的第一 ARP请求 获取第一主机的网络信息之后, 还包括:  With reference to the first aspect, in a fourth possible implementation, if the destination IP address in the first ARP request is an IP address of the second host, the acquiring the first ARP request by using the received After a host's network information, it also includes:
所述控制器通过与所述第一主机相连的交换机向所述第一主机反馈第一 ARP响应, 所述第一 ARP响应中的源 MAC地址为第一代理设备的 MAC地 址, 源 IP地址为所述第二主机的 IP地址, 以便所述第一主机将所述第一代理 设备的 MAC地址作为所述第二主机的 MAC地址, 所述第一代理设备为对应 于所述第一主机所在子网内的代理设备。  The controller feeds back a first ARP response to the first host by using a switch connected to the first host, where a source MAC address in the first ARP response is a MAC address of the first proxy device, and a source IP address is The IP address of the second host, so that the first host uses the MAC address of the first proxy device as the MAC address of the second host, where the first proxy device is located corresponding to the first host A proxy device within a subnet.
结合第一方面的第四种可能的实施方式, 在第五种可能的实施方式中, 所述控制器通过构造第二 ARP请求获取第二主机的网络信息, 包括:  With reference to the fourth possible implementation manner of the first aspect, in a fifth possible implementation manner, the controller, by configuring the second ARP request, to obtain the network information of the second host, includes:
所述控制器接收所述第一主机发送的数据包,所述数据包的目的 MAC地 址为所述第一代理设备的 MAC地址,目的 IP地址为所述第二主机的 IP地址; 所述控制器根据所述第二主机的 IP地址构造第二 ARP请求, 所述第二 ARP请求的源 MAC地址为第二代理设备的 MAC地址, 源 IP地址为所述第 一主机的 IP地址, 目的 IP地址为所述第二主机的 IP地址, 以便所述第二主 机将所述第二代理设备的 MAC地址作为所述第一主机的 MAC地址, 所述第 二代理设备为对应于所述第二主机所在子网内的代理设备;  Receiving, by the controller, a data packet sent by the first host, where a destination MAC address of the data packet is a MAC address of the first proxy device, and a destination IP address is an IP address of the second host; The device generates a second ARP request according to the IP address of the second host, where the source MAC address of the second ARP request is the MAC address of the second proxy device, and the source IP address is the IP address of the first host, and the destination IP address. The address is the IP address of the second host, so that the second host uses the MAC address of the second proxy device as the MAC address of the first host, and the second proxy device corresponds to the second The proxy device in the subnet where the host is located;
所述控制器通过所述第二主机所在子网内的交换机将所述第二 ARP请求 发送给所述第二主机所在子网内的所有主机;  The controller sends the second ARP request to all hosts in the subnet where the second host is located by using a switch in a subnet where the second host is located;
所述控制器通过与所述第二主机相连的交换机接收所述第二主机反馈的 第二 ARP响应, 所述第二 ARP响应的源 MAC地址和源 IP地址分别为所述 第二主机的 MAC地址 IP地址。  Receiving, by the switch connected to the second host, the second ARP response that is sent by the second host, where the source MAC address and the source IP address of the second ARP response are respectively the MAC address of the second host Address IP address.
结合第一方面的第五种可能的实施方式, 在第六种可能的实施方式中, 所述控制器通过接收到的第一 ARP请求获取第一主机的网络信息之前, 还包 括: 所述控制器预先存储所述第一主机和所述第二主机所在子网的网关、 网 络号和子网掩码, 以及所述第一代理设备和所述第二代理设备的 MAC地址; 所述控制器通过所述第二主机所在子网的交换机将所述第二 ARP请求发 送给所述第二主机所在子网内的所有主机, 包括; With reference to the fifth possible implementation manner of the first aspect, in a sixth possible implementation, before the acquiring, by the first ARP request, the network information of the first host, the controller further includes: The controller pre-stores a gateway, a network number, and a subnet mask of a subnet where the first host and the second host are located, and a MAC address of the first proxy device and the second proxy device; The controller sends the second ARP request to all hosts in the subnet where the second host is located by using a switch of the subnet where the second host is located, including:
所述控制器根据所述第二主机所在子网的网关、 网络号和子网掩码将所 述第二 ARP请求发送给所述第二主机所在子网内的所有主机。  The controller sends the second ARP request to all hosts in the subnet where the second host is located according to the gateway, the network number, and the subnet mask of the subnet where the second host is located.
结合第一方面、 第一方面的第一种、 第二种、 第三种、 第四种、 第五种 或者第六种可能的实施方式, 在第七种可能的实施方式中, 所述根据所述第 一主机的网络信息和所述第二主机的网络信息决策生成所述第一主机和所述 第二主机之间的转发路径, 包括:  With reference to the first aspect, the first, second, third, fourth, fifth or sixth possible implementation manner of the first aspect, in a seventh possible implementation manner, the The network information of the first host and the network information of the second host determine a forwarding path between the first host and the second host, including:
根据所述第一主机的网络信息和所述第二主机的网络信息计算所述第一 主机和所述第二主机之间的最短转发路径; 将所述最短转发路径作为所述第 一主机和所述第二主机之间的转发路径;  Calculating a shortest forwarding path between the first host and the second host according to network information of the first host and network information of the second host; using the shortest forwarding path as the first host and a forwarding path between the second hosts;
或者;  Or
根据所述第一主机的网络信息和所述第二主机的网络信息计算所述第一 主机和所述第二主机之间的最优转发路径; 将所述最优转发路径作为所述第 一主机和所述第二主机之间的转发路径。  Calculating an optimal forwarding path between the first host and the second host according to network information of the first host and network information of the second host; using the optimal forwarding path as the first A forwarding path between the host and the second host.
第二方面, 提供了一种控制器, 用于包括至少一个交换机的 OpenFlow 网络中, 所述控制器, 包括:  In a second aspect, a controller is provided for use in an OpenFlow network including at least one switch, where the controller includes:
第一信息获取模块, 用于通过接收到的第一 ARP请求获取第一主机的网 络信息, 所述第一 ARP请求是由所述第一主机发送的、 且与所述第一主机相 连的交换机无法查找到转发流表后转发给所述控制器的 ARP请求;  a first information acquiring module, configured to acquire network information of the first host by using the received first ARP request, where the first ARP request is a switch sent by the first host and connected to the first host The ARP request forwarded to the controller after forwarding the flow table cannot be found;
第二信息获取模块, 用于通过构造第二 ARP请求获取第二主机的网络信 息;  a second information acquiring module, configured to acquire network information of the second host by constructing a second ARP request;
路径生成模块, 用于根据所述第一信息获取模块获取到的第一主机的网 络信息和所述第二信息获取模块获取到的第二主机的网络信息决策生成所述 第一主机和所述第二主机之间的转发路径;  a path generating module, configured to generate the first host and the network according to the network information of the first host acquired by the first information acquiring module and the network information of the second host acquired by the second information acquiring module a forwarding path between the second hosts;
流表下发模块, 用于向所述路径生成模块生成的转发路径上的每个交换 机下发转发流表, 以便所述转发路径上的每个交换机根据所述转发流表在所 述第一主机和所述第二主机之间转发数据包。 a flow table issuing module, configured to perform each exchange on a forwarding path generated by the path generation module The forwarding flow table is sent by the machine, so that each switch on the forwarding path forwards the data packet between the first host and the second host according to the forwarding flow table.
在第二方面的第一种可能的实施方式中, 若所述第一 ARP请求中的目的 IP地址是第一网关的 IP地址, 所述第一网关是所述第一主机的配置网关, 所 述控制器, 还包括:  In a first possible implementation manner of the second aspect, if the destination IP address in the first ARP request is an IP address of the first gateway, the first gateway is a configuration gateway of the first host, where The controller also includes:
第一反馈模块, 用于通过与所述第一主机相连的交换机向所述第一主机 反馈第一 ARP响应, 所述第一 ARP响应中的源 MAC地址和源 IP地址分别 为所述第一网关的 MAC地址和 IP地址。  a first feedback module, configured to feed back, by the switch connected to the first host, the first ARP response to the first host, where the source MAC address and the source IP address in the first ARP response are respectively the first The MAC address and IP address of the gateway.
结合第二方面的第一种可能的实施方式, 在第二种可能的实施方式中, 所述第二信息获取模块, 包括:  With reference to the first possible implementation manner of the second aspect, in the second possible implementation, the second information acquiring module includes:
第一接收单元, 用于接收所述第一主机发送的数据包, 所述数据包的目 的 MAC地址为所述第一网关的 MAC地址, 目的 IP地址为所述第二主机的 IP地址;  a first receiving unit, configured to receive a data packet sent by the first host, where a destination MAC address of the data packet is a MAC address of the first gateway, and a destination IP address is an IP address of the second host;
第一构造单元, 用于根据所述第一接收单元接收到的数据包中的第二主 机的 IP地址构造第二 ARP请求, 所述第二 ARP请求的源 MAC地址和源 IP 地址分别为第二网关的 MAC地址和 IP地址, 目的 IP地址为所述第二主机的 IP地址, 所述第二网关为所述第二主机的配置网关;  a first constructing unit, configured to construct a second ARP request according to the IP address of the second host in the data packet received by the first receiving unit, where the source MAC address and the source IP address of the second ARP request are respectively The MAC address and the IP address of the second gateway, the destination IP address is the IP address of the second host, and the second gateway is the configuration gateway of the second host;
第一发送单元, 用于通过所述第二主机所在子网内的交换机将所述第一 构造单元构造的第二 ARP请求发送给所述第二主机所在子网内的所有主机; 第二接收单元, 用于通过与所述第二主机相连的交换机接收所述第二主 机反馈的第二 ARP响应, 所述第二 ARP响应的源 MAC地址和源 IP地址分 别为所述第二主机的 MAC地址和 IP地址。  a first sending unit, configured to send, by using a switch in a subnet where the second host is located, a second ARP request configured by the first configuration unit to all hosts in a subnet where the second host is located; a unit, configured to receive, by using a switch that is connected to the second host, a second ARP response that is sent by the second host, where the source MAC address and the source IP address of the second ARP response are respectively the MAC address of the second host Address and IP address.
结合第二方面的第二种可能的实施方式, 在第三种可能的实施方式中, 所述控制器, 还包括:  With reference to the second possible implementation of the second aspect, in a third possible implementation, the controller further includes:
第一预先存储模块, 用于预先存储所述第一主机和所述第二主机所在子 网的网关、 网络号和子网掩码, 以及所述第一网关和所述第二网关的 MAC地 址和 IP地址;  a first pre-storage module, configured to pre-store a gateway, a network number, and a subnet mask of a subnet where the first host and the second host are located, and a MAC address of the first gateway and the second gateway IP address;
所述第一发送单元, 具体用于根据所述第一预先存储模块预先存储的第 二主机所在子网的网关、 网络号和子网掩码将所述第二 ARP请求发送给所述 第二主机所在子网内的所有主机。 The first sending unit is specifically configured to be pre-stored according to the first pre-storage module The gateway, the network number, and the subnet mask of the subnet where the second host is located sends the second ARP request to all hosts in the subnet where the second host is located.
结合第二方面, 在第四种可能的实施方式中, 若所述第一 ARP请求中的 目的 IP地址是所述第二主机的 IP地址, 所述控制器, 还包括:  With reference to the second aspect, in a fourth possible implementation, if the destination IP address in the first ARP request is the IP address of the second host, the controller further includes:
第二反馈模块, 用于通过与所述第一主机相连的交换机向所述第一主机 反馈第一 ARP响应,所述第一 ARP响应中的源 MAC地址为第一代理设备的 MAC地址, 源 IP地址为所述第二主机的 IP地址, 以便所述第一主机将所述 第一代理设备的 MAC地址作为所述第二主机的 MAC地址, 所述第一代理设 备为对应于所述第一主机所在子网内的代理设备。  a second feedback module, configured to feed back, by the switch connected to the first host, a first ARP response to the first host, where a source MAC address in the first ARP response is a MAC address of the first proxy device, and a source The IP address is the IP address of the second host, so that the first host uses the MAC address of the first proxy device as the MAC address of the second host, and the first proxy device corresponds to the first A proxy device in a subnet where the host resides.
结合第二方面的第四种可能的实施方式, 在第五种可能的实施方式中, 所述第二信息获取模块, 包括:  With reference to the fourth possible implementation of the second aspect, in a fifth possible implementation, the second information acquiring module includes:
第三接收单元, 用于接收所述第一主机发送的数据包, 所述数据包的目 的 MAC地址为所述第一代理设备的 MAC地址,目的 IP地址为所述第二主机 的 IP地址;  a third receiving unit, configured to receive a data packet sent by the first host, where a destination MAC address of the data packet is a MAC address of the first proxy device, and a destination IP address is an IP address of the second host;
第二构造单元, 用于根据所述第三接收单元接收到的数据包中的第二主 机的 IP地址构造第二 ARP请求, 所述第二 ARP请求的源 MAC地址为第二 代理设备的 MAC地址, 源 IP地址为所述第一主机的 IP地址, 目的 IP地址 为所述第二主机的 IP地址, 以便所述第二主机将所述第二代理设备的 MAC 地址作为所述第一主机的 MAC地址,所述第二代理设备为对应于所述第二主 机所在子网内的代理设备;  a second constructing unit, configured to construct a second ARP request according to the IP address of the second host in the data packet received by the third receiving unit, where the source MAC address of the second ARP request is the MAC address of the second proxy device An address, a source IP address is an IP address of the first host, and a destination IP address is an IP address of the second host, so that the second host uses the MAC address of the second proxy device as the first host MAC address, the second proxy device is a proxy device corresponding to a subnet in which the second host is located;
第二发送单元, 用于通过所述第二主机所在子网内的交换机将所述第二 构造单元构造的第二 ARP请求发送给所述第二主机所在子网内的所有主机; 第二接收单元, 用于通过与所述第二主机相连的交换机接收所述第二主 机反馈的第二 ARP响应, 所述第二 ARP响应的源 MAC地址和源 IP地址分 别为所述第二主机的 MAC地址 IP地址。  a second sending unit, configured to send, by using a switch in a subnet where the second host is located, a second ARP request configured by the second configuration unit to all hosts in a subnet where the second host is located; a unit, configured to receive, by using a switch that is connected to the second host, a second ARP response that is sent by the second host, where the source MAC address and the source IP address of the second ARP response are respectively the MAC address of the second host Address IP address.
结合第二方面的第五种可能的实施方式, 在第六种可能的实施方式中, 所述控制器, 还包括:  With reference to the fifth possible implementation of the second aspect, in a sixth possible implementation, the controller further includes:
第二预先存储模块, 用于预先存储所述第一主机和所述第二主机所在子 网的网关、 网络号和子网掩码, 以及所述第一代理设备和所述第二代理设备 的 MAC地址; a second pre-storage module, configured to pre-store the first host and the second host a gateway, a network number, and a subnet mask of the network, and a MAC address of the first proxy device and the second proxy device;
所述第二发送单元, 具体用于根据所述第二预先存储模块预先存储的第 二主机所在子网的网关、 网络号和子网掩码将所述第二 ARP请求发送给所述 第二主机所在子网内的所有主机。  The second sending unit is configured to send the second ARP request to the second host according to a gateway, a network number, and a subnet mask of a subnet where the second host is pre-stored by the second pre-storage module. All hosts in the subnet.
结合第二方面、 第二方面的第一种、 第二种、 第三种、 第四种、 第五种 或者第六种可能的实施方式, 在第七种可能的实施方式中, 所述路径生成模 块, 包括:  With reference to the second aspect, the first, second, third, fourth, fifth or sixth possible implementation manner of the second aspect, in a seventh possible implementation manner, the path Generate modules, including:
最短生成单元, 用于根据所述第一信息获取模块获取到的第一主机的网 络信息和所述第二信息获取模块获取到的第二主机的网络信息计算所述第一 主机和所述第二主机之间的最短转发路径; 将所述最短转发路径作为所述第 一主机和所述第二主机之间的转发路径;  a shortest generating unit, configured to calculate, according to the network information of the first host acquired by the first information acquiring module and the network information of the second host acquired by the second information acquiring module, the first host and the first a shortest forwarding path between the two hosts; using the shortest forwarding path as a forwarding path between the first host and the second host;
或者;  Or
最优生成单元, 用于根据所述第一信息获取模块获取到的第一主机的网 络信息和所述第二信息获取模块获取到的第二主机的网络信息计算所述第一 主机和所述第二主机之间的最优转发路径; 将所述最优转发路径作为所述第 一主机和所述第二主机之间的转发路径。  An optimal generating unit, configured to calculate the first host and the network according to the network information of the first host acquired by the first information acquiring module and the network information of the second host acquired by the second information acquiring module An optimal forwarding path between the second host; the optimal forwarding path is used as a forwarding path between the first host and the second host.
第三方面, 提供了一种转发路径的生成系统, 包括第二方面和第二方面 的各种可能的实施方式中任一所述的控制器、 第一主机和第二主机。  In a third aspect, a forwarding path generation system is provided, comprising the controller, the first host and the second host of any of the second aspect and the various possible implementations of the second aspect.
本发明实施例提供的技术方案带来的有益效果是:  The beneficial effects brought by the technical solutions provided by the embodiments of the present invention are:
通过控制器来代替在 OpenFlow 网络中实现网关 /路由功能的部分 OpenFlow交换机, 从而解决了 OpenFlow网络中的专用的 OpenFlow交换 机无法实现该功能的问题, 达到了 OpenFlow 网络中不需要单独设置起到网 关 /路由功能的交换机的效果。  The controller replaces part of the OpenFlow switch that implements the gateway/routing function in the OpenFlow network, thereby solving the problem that the dedicated OpenFlow switch in the OpenFlow network cannot implement the function, and the OpenFlow network does not need to be separately set to function as a gateway/ The effect of the routing function of the switch.
附图说明 DRAWINGS
为了更清楚地说明本发明实施例或现有技术中的技术方案, 下面将对实 施例或现有技术描述中所需要使用的附图作简单地介绍, 显而易见地, 下面 描述中的附图仅仅是本发明的一些实施例, 对于本领域普通技术人员来讲, 在不付出创造性劳动性的前提下, 还可以根据这些附图获得其他的附图。 In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the embodiments or the prior art description will be briefly described below, obviously, the following The drawings in the description are only some of the embodiments of the present invention, and those skilled in the art can obtain other drawings based on these drawings without any inventive labor.
图 1是本发明实施例实施环境示意图;  1 is a schematic diagram of an implementation environment of an embodiment of the present invention;
图 2是本发明实施例一提供的转发路径的生成方法的方法流程图; 图 3是本发明实施例二提供的转发路径的生成方法的方法流程图; 图 4是本发明实施例二的实施环境示意图;  2 is a flowchart of a method for generating a forwarding path according to Embodiment 1 of the present invention; FIG. 3 is a flowchart of a method for generating a forwarding path according to Embodiment 2 of the present invention; FIG. 4 is a flowchart of Embodiment 2 of the present invention; Environmental diagram
图 5是本发明实施例三提供的转发路径的生成方法的方法流程图; 图 6是本发明实施例三的实施环境示意图;  5 is a flowchart of a method for generating a forwarding path according to Embodiment 3 of the present invention; FIG. 6 is a schematic diagram of an implementation environment of Embodiment 3 of the present invention;
图 7是本发明实施例四提供的控制器的结构示意图;  7 is a schematic structural diagram of a controller according to Embodiment 4 of the present invention;
图 8是本发明实施例五提供的控制器的结构示意图;  8 is a schematic structural diagram of a controller according to Embodiment 5 of the present invention;
图 9是本发明实施例六提供的控制器的结构示意图;  9 is a schematic structural diagram of a controller according to Embodiment 6 of the present invention;
图 10是本发明实施例七提供的转发路径的生成系统的结构方框图; 图 11是本发明实施例八提供的控制器的结构方框图;  Figure 10 is a block diagram showing the structure of a system for generating a forwarding path according to a seventh embodiment of the present invention; Figure 11 is a block diagram showing the structure of a controller according to Embodiment 8 of the present invention;
图 12是本发明实施例九和十提供的控制器的结构方框图。  Figure 12 is a block diagram showing the structure of a controller provided in Embodiments 9 and 10 of the present invention.
具体实施方式 detailed description
为使本发明的目的、 技术方案和优点更加清楚, 下面将结合附图对本发 明实施方式作进一步地详细描述。  The embodiments of the present invention will be further described in detail below with reference to the accompanying drawings.
实施例一  Embodiment 1
请参考图 2,其示出了本发明实施例一提供的转发路径的生成方法的方法 流程图。 本实施例主要以将该转发路径的生成方法应用在控制器中为例来举 例说明。 该转发路径的生成方法包括:  Referring to FIG. 2, a flowchart of a method for generating a forwarding path according to Embodiment 1 of the present invention is shown. In this embodiment, the method for generating the forwarding path is applied to the controller as an example for illustration. The method for generating the forwarding path includes:
步骤 201,控制器通过接收到的第一 ARP请求获取第一主机的网络信息; 控制器通过接收到的第一 ARP 请求获取第一主机的网络信息, 该第一 Step 201: The controller acquires network information of the first host by using the received first ARP request. The controller acquires network information of the first host by using the received first ARP request, where the first
ARP请求是由第一主机发送的、 且与第一主机相连的交换机无法查找到转发 流表后转发给控制器的 ARP请求。 The ARP request is sent by the first host, and the switch connected to the first host cannot find the ARP request forwarded to the controller after forwarding the flow table.
步骤 202, 控制器通过构造第二 ARP请求获取第二主机的网络信息; 为了生成第一主机和第二主机之间的转发路径, 控制器通过构造第二 Step 202: The controller acquires network information of the second host by constructing a second ARP request. To generate a forwarding path between the first host and the second host, the controller constructs the second
ARP请求获取第二主机的网络信息。 步骤 203, 控制器根据第一主机的网络信息和第二主机的网络信息决策 生成第一主机和第二主机之间的转发路径; The ARP requests to obtain the network information of the second host. Step 203: The controller generates a forwarding path between the first host and the second host according to the network information of the first host and the network information of the second host.
控制器根据第一主机的网络信息和第二主机的网络信息决策生成转发路 径, 以便第一主机和第二主机之间根据转发路径进行通信。  The controller generates a forwarding path according to the network information of the first host and the network information of the second host, so that the first host and the second host communicate according to the forwarding path.
步骤 204, 控制器向转发路径上的每个交换机下发转发流表;  Step 204: The controller sends a forwarding flow table to each switch on the forwarding path.
控制器根据生成的转发路径为转发路径上的交换机生成对应的转发流 表, 并将生成的转发流表发送给对应的交换机, 以便对应的交换机根据转发 流表更新本地的转发流表, 并根据更新后的转发流表转发第一主机和第二主 机之间的通信数据包。  The controller generates a corresponding forwarding flow table for the switch on the forwarding path according to the generated forwarding path, and sends the generated forwarding flow table to the corresponding switch, so that the corresponding switch updates the local forwarding flow table according to the forwarding flow table, and according to The updated forwarding flow table forwards the communication data packet between the first host and the second host.
综上所述, 本实施例提供的转发路径的生成方法, 通过控制器获取第一 主机和第二主机的网络信息, 根据获取到的第一主机和第二主机的网络信息 决策生成转发路径, 以便第一主机和第二主机进行通信, 解决了 OpenFlow 网络中的专用的 OpenFlow交换机无法实现该功能的问题,达到了 OpenFlow 网络中不需要单独设置起到网关 /路由功能的交换机的效果。  In summary, in the method for generating a forwarding path provided by the embodiment, the controller obtains the network information of the first host and the second host, and generates a forwarding path according to the obtained network information of the first host and the second host. In order to communicate between the first host and the second host, the problem that the dedicated OpenFlow switch in the OpenFlow network cannot implement the function is solved, and the effect that the switch functioning as the gateway/routing function is not required in the OpenFlow network is achieved.
需要说明的是, 具体实施环境可以分为两种情况, 第一种情况为第一主 机和第二主机分别配置第一网关和第二网关时, 控制器实现第一网关和第二 网关的功能; 第二种情况为第一主机和第二主机没有配置默认网关时, 控制 器实现第一代理设备和第二代理设备的功能。 首先对第一种情况进行详细介绍;  It should be noted that the specific implementation environment may be divided into two situations. In the first case, when the first host and the second host respectively configure the first gateway and the second gateway, the controller implements the functions of the first gateway and the second gateway. In the second case, when the first host and the second host do not have a default gateway configured, the controller implements the functions of the first proxy device and the second proxy device. First, the first case will be described in detail;
实施例二  Embodiment 2
请参考图 3,其示出了本发明实施例二提供的转发路径的生成方法的方法 流程图。 本实施例主要以该转发路径的生成方法应用于图 4所示的实施环境 中来举例说明。 参考图 4可知, 本实施环境包括控制器 420、 第一主机 440、 第二主机 442、 第三主机 444和第四主机 446、 第一交换机 460、 第二交换 机 462、 第三交换机 464、 第四交换机 466和第五交换机 468, 其中第一主 机 440属于第一子网, 第二主机 442、 第三主机 444和第四主机 446属于第 二子网, 第一主机 440和第三主机 444连接在第一交换机 460的端口上, 第 二主机 442连接在第二交换机 462的端口上, 第四主机 446连接在第五交换 机 468的端口上, 假设第一主机 440上配置网关为第一网关, 第二主机 442 上配置网关为第二网关, 第一主机 440属于第一子网, 第二主机 442、 第三 主机 444和第四主机 446属于第二子网, 第一网关和第二网关由控制器 420 实现。 该方法包括: Please refer to FIG. 3, which is a flowchart of a method for generating a forwarding path according to Embodiment 2 of the present invention. This embodiment is mainly illustrated by applying the forwarding path generation method to the implementation environment shown in FIG. 4. Referring to FIG. 4, the implementation environment includes a controller 420, a first host 440, a second host 442, a third host 444, and a fourth host 446, a first switch 460, a second switch 462, a third switch 464, and a fourth The switch 466 and the fifth switch 468, wherein the first host 440 belongs to the first subnet, the second host 442, the third host 444, and the fourth host 446 belong to the second subnet, and the first host 440 and the third host 444 are connected to On the port of the first switch 460, the first The second host 442 is connected to the port of the second switch 462, and the fourth host 446 is connected to the port of the fifth switch 468. It is assumed that the first host 440 is configured as the first gateway, and the second host 442 is configured as the second gateway. The gateway, the first host 440 belongs to the first subnet, the second host 442, the third host 444, and the fourth host 446 belong to the second subnet, and the first gateway and the second gateway are implemented by the controller 420. The method includes:
步骤 301, 预先存储第一主机和第二主机所在子网的网关、 网络号和子 网掩码, 以及第一网关和第二网关的 MAC地址和 IP地址;  Step 301: Pre-store a gateway, a network number, and a subnet mask of a subnet where the first host and the second host are located, and a MAC address and an IP address of the first gateway and the second gateway.
控制器预先存储第一主机 440和第二主机 442所在子网的网关、 网络号 和子网掩码, 以及第一网关和第二网关的 MAC地址和 I P地址, 以便控制器 420在后续的过程中实现与第一主机 440对应的第一网关和与第二主机 442 对应的第二网关来获取第一主机 440和第二主机 442的 MAC地址、 IP地址 和端口信息; 并同时根据子网的网关、 网络号和子网掩码决策转发路径。  The controller pre-stores the gateway, the network number and the subnet mask of the subnet where the first host 440 and the second host 442 are located, and the MAC address and IP address of the first gateway and the second gateway, so that the controller 420 is in the subsequent process. Implementing a first gateway corresponding to the first host 440 and a second gateway corresponding to the second host 442 to obtain MAC address, IP address, and port information of the first host 440 and the second host 442; and simultaneously according to the gateway of the subnet , network number and subnet mask decision forwarding path.
步骤 302, 第一主机向第一交换机发送第一 ARP请求;  Step 302: The first host sends a first ARP request to the first switch.
第一主机 440要和外界进行通信, 首先要根据所配置网关即第一网关的 IP地址查询第一网关的 MAC地址; 所以第一主机 440构造第一 ARP请求, 该第一 ARP请求的源 MAC地址为第一主机 440的 MAC地址, 源 IP地址为 第一主机 440的 IP地址, 目的 MAC地址为 0, 目的 IP地址为第一网关的 IP 地址。 第一主机 440将该第一 ARP请求发送给第一交换机 460。  The first host 440 needs to communicate with the outside world. First, the MAC address of the first gateway is queried according to the configured gateway, that is, the IP address of the first gateway. Therefore, the first host 440 constructs a first ARP request, and the source MAC address of the first ARP request. The address is the MAC address of the first host 440, the source IP address is the IP address of the first host 440, the destination MAC address is 0, and the destination IP address is the IP address of the first gateway. The first host 440 sends the first ARP request to the first switch 460.
相应的, 第一交换机 460接收该第一 ARP请求。  Correspondingly, the first switch 460 receives the first ARP request.
步骤 303, 第一交换机查询本地转发流表, 若查询不到与所接收到的第 一 ARP请求对应的转发流表信息, 则以包输入消息( Packet-ln )的形式发送 给控制器;  Step 303: The first switch queries the local forwarding flow table. If the forwarding flow table information corresponding to the received first ARP request is not found, the first switch sends the information to the controller in the form of a packet input message (Packet-ln).
第一交换机 460根据接收到的第一 ARP请求中的目的 IP地址查询本地 转发流表, 若查询到与该目的 IP地址对应的转发流表信息, 则按照转发流表 信息进行转发; 若查询不到与该目的 IP地址对应的转发流表信息, 则将接收 到的第一 ARP请求以包输入消息的形式发送给控制器 420。  The first switch 460 queries the local forwarding flow table according to the destination IP address in the received first ARP request, and if the forwarding flow table information corresponding to the destination IP address is queried, the forwarding is performed according to the forwarding flow table information; To the forwarding flow table information corresponding to the destination IP address, the received first ARP request is sent to the controller 420 in the form of a packet input message.
相应的, 控制器 420接收该第一 ARP请求。  Correspondingly, the controller 420 receives the first ARP request.
步骤 304,控制器通过接收到的第一 ARP请求获取第一主机的网络信息; 控制器 420根据接收到的第一 ARP请求获取到第一主机 440的 MAC地 址和 IP地址, 将第一主机 440的 MAC地址和 IP地址作为第一主机 440的 网络信息;由于该第一 ARP请求是以包输入消息的形式发送给控制器 420的, 所以控制器 420还可以根据需要获取第一主机 440的端口信息, 将第一主机 440的 MAC地址、 IP地址和端口信息作为第一主机 440的网络信息。 换句 话说, 第一主机 440的网络信息可以包括第一主机 440的 MAC地址和 IP地 址, 也可以包括第一主机 440的 MAC地址、 IP地址和端口信息。 Step 304: The controller acquires network information of the first host by using the received first ARP request. The controller 420 obtains the MAC address and the IP address of the first host 440 according to the received first ARP request, and uses the MAC address and the IP address of the first host 440 as the network information of the first host 440; due to the first ARP request The controller 420 can also obtain the port information of the first host 440 according to the need, and the MAC address, the IP address, and the port information of the first host 440 are used as the first host 440. Network information. In other words, the network information of the first host 440 may include the MAC address and IP address of the first host 440, and may also include the MAC address, IP address, and port information of the first host 440.
步骤 305, 控制器构造第一 ARP响应, 并通过与第一主机相连的交换机 向第一主机反馈该第一 ARP响应;  Step 305: The controller constructs a first ARP response, and feeds back the first ARP response to the first host by using a switch connected to the first host.
由于控制器 420实现了第一网关的作用,所以在接收到第一 ARP请求后 发现其目的 IP地址为第一网关的 IP地址时, 控制器 420主动构造第一 ARP 响应, 该第一 ARP响应的源 MAC地址为第一网关的 MAC地址, 源 IP地址 为第一网关的 IP地址, 目的 MAC地址为第一主机 440的 MAC地址, 目的 IP地址为第一主机 440的 IP地址, 并以包输出消息( Packet-Out )的形式将 该第一 ARP响应从第一交换机 460连接第一主机 440的端口发出。  Since the controller 420 implements the function of the first gateway, when the first ARP request is received and the destination IP address is found to be the IP address of the first gateway, the controller 420 actively constructs a first ARP response, the first ARP response. The source MAC address is the MAC address of the first gateway, the source IP address is the IP address of the first gateway, the destination MAC address is the MAC address of the first host 440, and the destination IP address is the IP address of the first host 440, and the packet is The output message (Packet-Out) is sent in the form of a first ARP response from the first switch 460 to the port of the first host 440.
相应的, 第一主机 440接收该第一 ARP响应。  Correspondingly, the first host 440 receives the first ARP response.
步骤 306, 第一主机保存第一网关的 MAC地址;  Step 306: The first host saves a MAC address of the first gateway.
第一主机 440接收到第一 ARP响应之后, 保存该第一 ARP响应中的第 一网关的 MAC地址。  After receiving the first ARP response, the first host 440 saves the MAC address of the first gateway in the first ARP response.
经过上述步骤 302到步骤 306, 第一主机 440完成与控制器 420实现的 第一网关之间的 ARP学习过程。  After the above steps 302 to 306, the first host 440 completes the ARP learning process between the first gateway implemented by the controller 420.
步骤 307, 第一主机向第一交换机发送目的主机为第二主机的数据包; 通过步骤 302到步骤 305, 第一主机 440 已经获取到第一网关的 MAC 地址, 所以第一主机 440 向第二主机 442发送数据包时, 数据包中的目的 MAC为第一网关的 MAC地址, 目的 IP为第二主机 442的 IP,第一主机 440 将该数据包发送给第一交换机 460。  Step 307: The first host sends a data packet whose destination host is the second host to the first switch. The first host 440 has obtained the MAC address of the first gateway by using the step 302 to the step 305, so the first host 440 goes to the second host. When the host 442 sends a data packet, the destination MAC address in the data packet is the MAC address of the first gateway, the destination IP address is the IP address of the second host 442, and the first host 440 sends the data packet to the first switch 460.
相应的, 第一交换机 460接收该数据包。  Correspondingly, the first switch 460 receives the data packet.
步骤 308, 第一交换机查询本地转发流表, 若查询不到与该数据包对应 的转发流表信息, 则以包输入消息的形式发送给控制器; Step 308, the first switch queries the local forwarding flow table, and if the query does not correspond to the data packet, The forwarding flow table information is sent to the controller in the form of a packet input message;
第一交换机 460收到第一主机 440发送的数据包,根据数据包中的 IP地 址查询本地转发流表, 若查询到与该目的 IP地址对应的转发流表信息, 则按 照转发流表信息进行转发;若查询不到与该目的 IP地址对应的转发流表信息, 则将该数据包以包输入消息的形式发送给控制器 420。  The first switch 460 receives the data packet sent by the first host 440, and queries the local forwarding flow table according to the IP address in the data packet. If the forwarding flow table information corresponding to the destination IP address is queried, the information is forwarded according to the forwarding flow table information. Forwarding; if the forwarding flow table information corresponding to the destination IP address is not found, the data packet is sent to the controller 420 in the form of a packet input message.
相应的, 控制器 420接收该数据包。  Correspondingly, the controller 420 receives the data packet.
步骤 309, 控制器根据第二主机的 IP地址构造第二 ARP请求, 并通过 第二主机所在子网内的交换机将第二 ARP请求发送给第二主机所在子网内的 所有主机;  Step 309: The controller constructs a second ARP request according to the IP address of the second host, and sends the second ARP request to all hosts in the subnet where the second host is located through the switch in the subnet where the second host is located.
控制器 420收到该数据包时, 也不知道第二主机 442的 MAC地址, 由 于控制器 420 实现了第二网关的作用, 所以在收到目的 IP地址为第二主机 442的 IP地址的数据包时, 主动构造第二 ARP请求, 该第二 ARP请求源 MAC地址和源 IP地址分别为第二网关的 MAC地址和 IP地址,目的 MAC地 址全零, 目的 IP地址为第二主机的 IP地址, 并根据第二主机 442所在子网 的网关、 网络号和子网掩码将该第二 ARP请求以包输出消息的形式发送给第 二主机 442所在子网内的所有主机。  When the controller 420 receives the data packet, it does not know the MAC address of the second host 442. Since the controller 420 implements the role of the second gateway, the data of the IP address of the second host 442 is received at the destination IP address. When the packet is configured, the second ARP request is actively constructed. The source MAC address and the source IP address of the second ARP request are respectively the MAC address and the IP address of the second gateway, the destination MAC address is all zero, and the destination IP address is the IP address of the second host. And sending the second ARP request in the form of a packet output message to all hosts in the subnet where the second host 442 is located according to the gateway, the network number, and the subnet mask of the subnet where the second host 442 is located.
相应的, 第二主机 442所在子网内的所有主机收到该第二 ARP请求, 比 如第二主机 442、 第三主机 444和第四主机 446, 其中第三主机 444和第四 主机 446未在图 3中标出。  Correspondingly, all hosts in the subnet where the second host 442 is located receive the second ARP request, such as the second host 442, the third host 444, and the fourth host 446, where the third host 444 and the fourth host 446 are not in the Marked in Figure 3.
步骤 310, 第二主机响应第二 ARP请求;  Step 310: The second host responds to the second ARP request.
第二主机 442收到第二交换机 462发送的第二 ARP请求, 发现该第二 ARP请求中的目的 IP地址和自己的 IP地址一样, 于是构造第二 ARP响应, 该第二 ARP响应的源 MAC地址和源 IP地址分别为第二主机 442的 MAC地 址和 IP地址, 目的 MAC地址和目的 IP地址分别为第二网关的 MAC地址 IP 地址, 并通过第二交换机 462向控制器 420发送该第二 ARP响应。  The second host 442 receives the second ARP request sent by the second switch 462, and finds that the destination IP address in the second ARP request is the same as its own IP address, and then constructs a second ARP response, the source MAC address of the second ARP response. The address and the source IP address are respectively the MAC address and the IP address of the second host 442, and the destination MAC address and the destination IP address are respectively the MAC address IP address of the second gateway, and the second switch 462 sends the second to the controller 420. ARP response.
相应的,控制器 420通过与第二主机相连的交换机 462接收第二主机 442 反馈的第二 ARP响应。  Correspondingly, the controller 420 receives the second ARP response fed back by the second host 442 through the switch 462 connected to the second host.
步骤 31 1, 控制器获取第二主机的网络信息; 控制器 420根据接收到的第二 ARP响应获取到第二主机 442的 MAC地 址和 IP地址, 将第二主机 442的 MAC地址和 IP地址作为第二主机 442的 网络信息;由于该第一 ARP请求是以包输入消息的形式发送给控制器 420的, 所以控制器 420还可以根据需要获取第二主机 442的端口信息, 将第二主机 442的 MAC地址、 IP地址和端口信息作为第二主机 442的网络信息。 换句 话说, 第二主机 442的网络信息可以包括第二主机 442的 MAC地址和 IP地 址, 也可以包括第二主机 442的 MAC地址、 IP地址和端口信息。 Step 31: The controller acquires network information of the second host. The controller 420 obtains the MAC address and the IP address of the second host 442 according to the received second ARP response, and uses the MAC address and the IP address of the second host 442 as the network information of the second host 442; due to the first ARP request The controller 420 can also obtain the port information of the second host 442 as needed, and use the MAC address, the IP address, and the port information of the second host 442 as the second host 442. Network information. In other words, the network information of the second host 442 may include the MAC address and IP address of the second host 442, and may also include the MAC address, IP address, and port information of the second host 442.
经过上述步骤 307到步骤 31 1, 控制器完成实现的第二网关与第二主机 442之间的 ARP学习过程;  After the foregoing step 307 to step 31 1, the controller completes the ARP learning process between the implemented second gateway and the second host 442;
步骤 312, 控制器根据第一主机的网络信息和第二主机的网络信息计算 第一主机和第二主机之间的最短转发路径; 将最短转发路径作为第一主机和 第二主机之间的转发路径;  Step 312: The controller calculates a shortest forwarding path between the first host and the second host according to the network information of the first host and the network information of the second host. The shortest forwarding path is used as forwarding between the first host and the second host. Path
控制器 420通过分析第一交换机 460发送来的数据包的目的 IP地址,发 现该数据包的目的主机即第二主机 442和第一主机 440处于不同的子网, 判 断是一个三层转发,并且通过 ARP学习过程已经获取到第一主机 440和第二 主机 442的网络信息, 根据路由算法决策生成转发路径, 假设按照最短路径 策略来生成转发路径, 则生成的转发路径可以为: 第一交换机 460<—— >第 三交换机 464<—— >第二交换机 462。比如,当第一主机 440和第二主机 442 的网络信息包括 MAC地址、 IP地址和端口信息的时候, 控制器 420根据第 一主机 440和第二主机 442的 IP地址可以判断为三层转发,根据路由算法决 策生成转发路径, 假设按照最短路径策略来生成转发路径, 则根据第一主机 440 和第二主机 442 的端口信息生成的转发路径可以为: 第一交换机 460<—— >第三交换机 464<—— >第二交换机 462。  The controller 420 analyzes the destination IP address of the data packet sent by the first switch 460, and finds that the destination host of the data packet, that is, the second host 442 and the first host 440 are in different subnets, and determines that it is a three-layer forwarding, and The network information of the first host 440 and the second host 442 is obtained through the ARP learning process, and the forwarding path is generated according to the routing algorithm. If the forwarding path is generated according to the shortest path policy, the generated forwarding path may be: <-> Third switch 464 <-> Second switch 462. For example, when the network information of the first host 440 and the second host 442 includes the MAC address, the IP address, and the port information, the controller 420 can determine that the IP address of the first host 440 and the second host 442 is three-layer forwarding. The forwarding path is generated according to the routing algorithm decision. If the forwarding path is generated according to the shortest path policy, the forwarding path generated according to the port information of the first host 440 and the second host 442 may be: the first switch 460<->the third switch 464 <-> second switch 462.
需要说明的是, 控制器 420还可以根据第一主机 440的网络信息和第二 主机 442的网络信息计算第一主机 440和第二主机 442之间的最优转发路径; 最优转发路径为链路带宽最优的路径, 将最优转发路径作为第一主机 440和 第二主机 442之间的转发路径, 这里仅以最短路径策略为例进行说明。  It should be noted that the controller 420 may further calculate an optimal forwarding path between the first host 440 and the second host 442 according to the network information of the first host 440 and the network information of the second host 442. The optimal forwarding path is a chain. The optimal path of the path is used as the forwarding path between the first host 440 and the second host 442. The shortest path policy is used as an example for description.
步骤 313, 控制器根据生成的转发路径为转发路径上的交换机生成对应 的转发流表, 并将生成的转发流表发送给对应的交换机; Step 313: The controller generates a corresponding switch for the switch on the forwarding path according to the generated forwarding path. Forwarding the flow table, and sending the generated forwarding flow table to the corresponding switch;
控制器 420根据生成的转发路径为转发路径上的交换机生成对应的转发 流表, 并将生成的转发流表发送给对应的交换机, 比如, 控制器 420为最短 路径上的第一交换机 460、 第三交换机 464和第二交换机 462生成对应的转 发流表, 并将与第一交换机 460对应的转发流表发送给第一交换机 460、 将 与第三交换机 464对应的转发流表发送给第三交换机 464、 将与第二交换机 462对应的转发流表发送给第二交换机 462。 其中第三交换机 464未在图 3 中标出。  The controller 420 generates a corresponding forwarding flow table for the switch on the forwarding path according to the generated forwarding path, and sends the generated forwarding flow table to the corresponding switch. For example, the controller 420 is the first switch 460 on the shortest path. The third switch 464 and the second switch 462 generate a corresponding forwarding flow table, and send the forwarding flow table corresponding to the first switch 460 to the first switch 460, and send the forwarding flow table corresponding to the third switch 464 to the third switch. 464. Send the forwarding flow table corresponding to the second switch 462 to the second switch 462. The third switch 464 is not labeled in Figure 3.
步骤 314, 对应的交换机根据转发流表更新本地的转发流表;  Step 314: The corresponding switch updates the local forwarding flow table according to the forwarding flow table.
比如, 对应的最短路径上的第一交换机 460、 第三交换机 464和第二交 换机 462更新本地的转发流表。  For example, the first switch 460, the third switch 464, and the second switch 462 on the corresponding shortest path update the local forwarding flow table.
步骤 315, 对应的交换机根据更新后的转发流表转发第一主机和第二主 机之间的通信数据包。  Step 315: The corresponding switch forwards the communication data packet between the first host and the second host according to the updated forwarding flow table.
比如, 对应的最短路径上的第一交换机 460、 第三交换机 464和第二交 换机 462根据更新后的转发流表转发第一主机 440和第二主机 442之间的通 信数据包。  For example, the first switch 460, the third switch 464, and the second switch 462 on the corresponding shortest path forward the communication data packet between the first host 440 and the second host 442 according to the updated forwarding flow table.
综上所述, 本实施例提供的转发路径的生成方法, 通过控制器来代替在 OpenFlow网络中实现网关 /路由功能的部分 OpenFlow交换机, 由控制器实 现了第一网关和第二网关的 ARP功能,使得 Open Flow网络中的所有交换机 只要实现简单的转发功能即可, 从而解决了 OpenFlow 网络中的专用的 OpenFlow交换机无法实现该网关 /路由功能的问题, 达到了 OpenFlow网络 中不需要单独设置起到网关 /路由功能的交换机的效果。 下面对第二种情况进行详细介绍;  In summary, the method for generating a forwarding path provided by this embodiment replaces a part of an OpenFlow switch that implements a gateway/routing function in an OpenFlow network by using a controller, and the ARP function of the first gateway and the second gateway is implemented by the controller. Therefore, all the switches in the Open Flow network can implement the simple forwarding function, thereby solving the problem that the dedicated OpenFlow switch in the OpenFlow network cannot implement the gateway/routing function, and the OpenFlow network does not need to be separately set up. The effect of the gateway/route function switch. The second case will be described in detail below;
实施例三  Embodiment 3
请参考图 5,其示出了本发明实施例三提供的转发路径的生成方法的方法 流程图。 本实施例主要以该转发路径的生成方法应用于图 6所示的实施环境 中来举例说明。 参考图 6可知, 本实施环境包括控制器 620、 第一主机 640、 第二主机 642、 第三主机 644和第四主机 646、 第一交换机 660、 第二交换 机 662、 第三交换机 664、 第四交换机 666和第五交换机 668, 其中第一主 机 640属于第一子网, 第二主机 642、 第三主机 644和第四主机 646属于第 二子网, 第一主机 640和第三主机 644连接在第一交换机 660的端口上, 第 二主机 642连接在第二交换机 662的端口上, 第四主机 646连接在第五交换 机 668的端口上, 假设第一主机 640和第二主机 642没有配置默认网关, 第 一主机 640属于第一子网, 第二主机 642、 第三主机 644和第四主机 646属 于第二子网, 控制器 620上预先存储了第一主机 640和第二主机 642所在子 网的信息 (包括网关、 网络号及子网掩码)和分别对应于两个子网的第一代 理设备和第二代理设备。 该方法包括: Please refer to FIG. 5, which is a flowchart of a method for generating a forwarding path according to Embodiment 3 of the present invention. This embodiment is mainly illustrated by applying the method for generating the forwarding path to the implementation environment shown in FIG. 6. Referring to FIG. 6, the implementation environment includes a controller 620, a first host 640, The second host 642, the third host 644 and the fourth host 646, the first switch 660, the second switch 662, the third switch 664, the fourth switch 666, and the fifth switch 668, wherein the first host 640 belongs to the first subnet The second host 642, the third host 644, and the fourth host 646 belong to the second subnet. The first host 640 and the third host 644 are connected to the port of the first switch 660, and the second host 642 is connected to the second switch 662. On the port, the fourth host 646 is connected to the port of the fifth switch 668. It is assumed that the first host 640 and the second host 642 are not configured with a default gateway. The first host 640 belongs to the first subnet, and the second host 642 and the third host. The host 644 and the fourth host 646 belong to the second subnet, and the information about the subnet where the first host 640 and the second host 642 are located (including the gateway, the network number, and the subnet mask) are pre-stored on the controller 620 and respectively correspond to The first proxy device and the second proxy device of the two subnets. The method includes:
步骤 501, 存储器预先存储第一主机和第二主机所在子网的网关、 网络 号和子网掩码, 以及第一代理设备和第二代理设备的 MAC地址;  Step 501: The memory pre-stores a gateway, a network number, and a subnet mask of the subnet where the first host and the second host are located, and a MAC address of the first proxy device and the second proxy device.
控制器 620预先存储第一主机 640和第二主机 642所在子网的网关、 网 络号和子网掩码, 以及第一代理设备和第二代理设备的 MAC地址; 以便控制 器 620在后续的过程中实现与第一主机 640所在子网对应的第一代理设备和 与第二主机 642所在子网对应的第二代理设备来获取第一主机 640和第二主 机 642的网络信息, 该网络信息包括 MAC地址、 IP地址和端口信息; 并同 时根据子网的信息决策转发路径。  The controller 620 pre-stores the gateway, the network number and the subnet mask of the subnet where the first host 640 and the second host 642 are located, and the MAC addresses of the first proxy device and the second proxy device; so that the controller 620 is in the subsequent process. The first proxy device corresponding to the subnet where the first host 640 is located and the second proxy device corresponding to the subnet where the second host 642 is located are configured to obtain network information of the first host 640 and the second host 642, where the network information includes the MAC address. Address, IP address, and port information; and decide the forwarding path based on the information of the subnet.
步骤 502, 第一主机向第一交换机发送第一 ARP请求;  Step 502: The first host sends a first ARP request to the first switch.
第一主机 640要和第二主机 642进行通信, 首先要根据第二主机 642的 IP地址查询第二主机 642的 MAC地址;所以第一主机 640构造第一 ARP请 求, 该第一 ARP请求源 MAC为第一主机 640的 MAC, 源 IP地址为第一主 机 640的 IP地址, 目的 MAC地址为 0, 目的 IP地址为第二主机 642的 IP 地址。 第一主机 640将该第一 ARP请求发送给第一交换机 660。  The first host 640 is to communicate with the second host 642. First, the MAC address of the second host 642 is queried according to the IP address of the second host 642. Therefore, the first host 640 constructs a first ARP request, and the first ARP request source MAC For the MAC of the first host 640, the source IP address is the IP address of the first host 640, the destination MAC address is 0, and the destination IP address is the IP address of the second host 642. The first host 640 sends the first ARP request to the first switch 660.
相应的, 第一交换机 660接收该第一 ARP请求。  Correspondingly, the first switch 660 receives the first ARP request.
步骤 503, 第一交换机查询本地转发流表, 若查询不到与所接收到的第 一 ARP请求对应的转发流表信息, 则以包输入消息的形式发送给控制器; 第一交换机 660根据接收到的第一 ARP请求中的目的 IP地址查询本地 转发流表, 若查询到与该目的 IP地址对应的转发流表信息, 则按照转发流表 信息进行转发; 若查询不到与该目的 IP地址对应的转发流表信息, 则将接收 到的第一 ARP请求以包输入消息的形式发送给控制器 620。 Step 503: The first switch queries the local forwarding flow table. If the forwarding flow table information corresponding to the received first ARP request is not found, the first switch sends the information to the controller in the form of a packet input message. The destination IP address in the first ARP request is queried locally. The forwarding flow table, if the forwarding flow table information corresponding to the destination IP address is queried, is forwarded according to the forwarding flow table information; if the forwarding flow table information corresponding to the destination IP address is not queried, the received An ARP request is sent to the controller 620 in the form of a packet input message.
相应的, 控制器 620接收该第一 ARP请求。  Correspondingly, the controller 620 receives the first ARP request.
步骤 504,控制器通过接收到的第一 ARP请求获取第一主机的网络信息; 控制器 620根据接收到的第一 ARP请求获取到第一主机 640的 MAC地 址和 IP地址, 将第一主机 640的 MAC地址和 IP地址作为第一主机 640的 网络信息;由于该第一 ARP请求是以包输入消息的形式发送给控制器 620的, 所以控制器 620还可以根据需要获取第一主机 640的端口信息, 将第一主机 640的 MAC地址、 IP地址和端口信息作为第一主机 640的网络信息。 换句 话说, 第一主机 640的网络信息可以包括第一主机 640的 MAC地址和 IP地 址, 也可以包括第一主机 640的 MAC地址、 IP地址和端口信息。  Step 504: The controller acquires the network information of the first host by using the received first ARP request. The controller 620 acquires the MAC address and the IP address of the first host 640 according to the received first ARP request, and the first host 640 is obtained. The MAC address and the IP address are used as the network information of the first host 640. Since the first ARP request is sent to the controller 620 in the form of a packet input message, the controller 620 can also obtain the port of the first host 640 as needed. The information, the MAC address, the IP address, and the port information of the first host 640 are used as the network information of the first host 640. In other words, the network information of the first host 640 may include the MAC address and IP address of the first host 640, and may also include the MAC address, IP address, and port information of the first host 640.
步骤 505, 控制器构造第一 ARP响应, 并通过与第一主机相连的交换机 向第一主机反馈该第一 ARP响应;  Step 505: The controller constructs a first ARP response, and feeds back the first ARP response to the first host by using a switch connected to the first host.
由于控制器 620实现了第一代理设备的作用,所以在接收到第一 ARP请 求后发现其目的 IP地址为第二主机 142的 IP地址时, 控制器 620主动构造 第一 ARP响应,该第一 ARP响应源 MAC地址为第一代理设备的 MAC地址, 源 IP地址为第二主机 642的 IP地址,目的 MAC地址为第一主机 640的 MAC 地址, 目的 IP地址为第一主机 640的 IP地址, 并以包输出消息的形式将该 第一 ARP响应从第一交换机 660连接第一主机 640的端口发出。  Since the controller 620 implements the role of the first proxy device, the controller 620 actively constructs a first ARP response, when the first ARP request is received and the destination IP address is the IP address of the second host 142. The ARP response source MAC address is the MAC address of the first proxy device, the source IP address is the IP address of the second host 642, the destination MAC address is the MAC address of the first host 640, and the destination IP address is the IP address of the first host 640. The first ARP response is sent from the port of the first switch 660 to the first host 640 in the form of a packet output message.
相应的, 第一主机 640接收该第一 ARP响应。  Correspondingly, the first host 640 receives the first ARP response.
步骤 506, 第一主机保存第一代理设备的 MAC地址;  Step 506: The first host saves a MAC address of the first proxy device.
第一主机 640接收到第一 ARP响应之后, 将该第一 ARP响应中中第一 代理设备的 MAC地址作为第二主机 642的 MAC地址保存。  After receiving the first ARP response, the first host 640 saves the MAC address of the first proxy device in the first ARP response as the MAC address of the second host 642.
经过上述步骤 502到步骤 506, 第一主机 640完成与控制器 620实现的 第一代理设备之间的 ARP学习过程。  After the above steps 502 to 506, the first host 640 completes the ARP learning process between the first proxy device implemented by the controller 620.
步骤 507, 第一主机向第一交换机发送目的主机为第二主机的数据包; 通过步骤 506, 第一主机 640已经获取到第一代理设备的 MAC地址, 并 且将该第一代理设备的 MAC地址作为第二主机 642的 MAC地址进行保存, 所以第一主机 640要向第二主机 642发送数据包中目的 MAC地址实际为第 一代理设备的 MAC地址, 目的 IP地址为第二主机 642的 IP地址, 第一主机 640将该数据包发送给第一交换机 660。 Step 507: The first host sends a data packet whose destination host is the second host to the first switch. In step 506, the first host 640 has obtained the MAC address of the first proxy device, and And the MAC address of the first proxy device is saved as the MAC address of the second host 642, so the first host 640 sends the destination MAC address of the data packet to the second host 642 as the MAC address of the first proxy device. The IP address is the IP address of the second host 642, and the first host 640 sends the data packet to the first switch 660.
相应的, 第一交换机 660接收该数据包。  Correspondingly, the first switch 660 receives the data packet.
步骤 508, 第一交换机查询本地转发流表, 若查询不到与给数据包对应 的转发流表信息, 则以包输入消息的形式发送给控制器;  Step 508: The first switch queries the local forwarding flow table. If the forwarding flow table information corresponding to the data packet is not found, the first switch sends the information to the controller in the form of a packet input message.
第一交换机 660收到第一主机 640发送的数据包,根据数据包中的 IP地 址查询本地转发流表, 若查询到与该目的 IP地址对应的转发流表信息, 则按 照转发流表信息进行转发;若查询不到与该目的 IP地址对应的转发流表信息, 则将该数据包以包输入消息的形式发送给控制器 620。  The first switch 660 receives the data packet sent by the first host 640, and queries the local forwarding flow table according to the IP address in the data packet. If the forwarding flow table information corresponding to the destination IP address is queried, the information is forwarded according to the forwarding flow table information. Forwarding; if the forwarding flow table information corresponding to the destination IP address is not found, the data packet is sent to the controller 620 in the form of a packet input message.
相应的, 控制器 620接收该数据包。  Correspondingly, the controller 620 receives the data packet.
步骤 509, 控制器根据第二主机的 IP地址构造第二 ARP请求, 并通过 第二主机所在子网内的交换机将第二 ARP请求发送给第二主机所在子网内的 所有主机;  Step 509: The controller constructs a second ARP request according to the IP address of the second host, and sends the second ARP request to all hosts in the subnet where the second host is located through the switch in the subnet where the second host is located.
控制器 620收到该数据包时, 也不知道第二主机 642的 MAC地址, 由 于控制器 620实现了第二代理设备的作用, 所以在收到目的 IP地址为第二主 机 642的 IP地址的数据包时, 主动构造第二 ARP请求, 该第二 ARP请求源 MAC地址为第二代理设备的 MAC地址, 源 IP地址为第一主机 640的 IP地 址, 目的 MAC地址全零, 目的 IP地址为第二主机 642的 IP地址, 并根据第 二主机 642所在子网的网关、网络号和子网掩码将该第二 ARP请求以包输出 消息的形式发送给第二主机 642所在子网内的所有主机。  When the controller 620 receives the data packet, it does not know the MAC address of the second host 642. Since the controller 620 implements the role of the second proxy device, the destination IP address is received as the IP address of the second host 642. In the case of the data packet, the second ARP request is actively constructed. The second ARP request source MAC address is the MAC address of the second proxy device, the source IP address is the IP address of the first host 640, the destination MAC address is all zero, and the destination IP address is The IP address of the second host 642 is sent to all the subnets of the second host 642 in the form of a packet output message according to the gateway, the network number, and the subnet mask of the subnet where the second host 642 is located. Host.
相应的, 与第二主机 642所在子网内的所有主机收到该第二 ARP请求, 比如第二主机 642、 第三主机 644和第四主机 646, 其中三主机 644和第四 主机 646未在图 5中标出。  Correspondingly, all the hosts in the subnet where the second host 642 is located receive the second ARP request, such as the second host 642, the third host 644 and the fourth host 646, wherein the three hosts 644 and the fourth host 646 are not in the Marked in Figure 5.
步骤 510, 第二主机响应第二 ARP请求;  Step 510: The second host responds to the second ARP request.
第二主机 642收到第二交换机 662发送的第二 ARP请求, 发现该第二 ARP请求中的目的 IP地址和自己的 IP地址一样, 于是构造第二 ARP响应, 该第二 ARP响应源 MAC地址为第二主机 642的 MAC地址, 源 IP地址为第 二主机 642的 IP地址, 目的 MAC地址为第二代理设备的 MAC地址, 目的 IP为第一主机 640的 IP地址, 通过第二交换机 662向控制器 620发送该第 二 ARP响应。 The second host 642 receives the second ARP request sent by the second switch 662, and finds that the destination IP address in the second ARP request is the same as its own IP address, and then constructs a second ARP response. The second ARP response source MAC address is the MAC address of the second host 642, the source IP address is the IP address of the second host 642, the destination MAC address is the MAC address of the second proxy device, and the destination IP is the IP address of the first host 640. The address is sent by the second switch 662 to the controller 620 for the second ARP response.
相应的, 控制器 620接收该第二 ARP响应。  Correspondingly, the controller 620 receives the second ARP response.
步骤 51 1, 控制器获取第二主机的网络信息;  Step 51: The controller acquires network information of the second host.
控制器 620根据接收到的第二 ARP响应获取到第二主机 642的 MAC地 址和 IP地址, 将第二主机 642的 MAC地址和 IP地址作为第二主机 642的 网络信息;由于该第一 ARP请求是以包输入消息的形式发送给控制器 620的, 所以控制器 620还可以根据需要获取第二主机 642的端口信息, 将第二主机 642的 MAC地址、 IP地址和端口信息作为第二主机 642的网络信息。 换句 话说, 第二主机 642的网络信息可以包括第二主机 642的 MAC地址和 IP地 址, 也可以包括第二主机 642的 MAC地址、 IP地址和端口信息。  The controller 620 obtains the MAC address and the IP address of the second host 642 according to the received second ARP response, and uses the MAC address and the IP address of the second host 642 as the network information of the second host 642; The controller 620 can also obtain the port information of the second host 642 as needed, and use the MAC address, IP address, and port information of the second host 642 as the second host 642. Network information. In other words, the network information of the second host 642 may include the MAC address and IP address of the second host 642, and may also include the MAC address, IP address, and port information of the second host 642.
经过上述步骤 507到步骤 51 1, 控制器完成实现的第二代理设备与第二 主机 642之间的 ARP学习过程;  After the above steps 507 to 51 1 , the controller completes the ARP learning process between the implemented second proxy device and the second host 642;
步骤 512, 控制器根据第一主机的网络信息和第二主机的网络信息计算 第一主机和第二主机之间的最短转发路径; 将最短转发路径作为第一主机和 第二主机之间的转发路径;  Step 512: The controller calculates a shortest forwarding path between the first host and the second host according to the network information of the first host and the network information of the second host. The shortest forwarding path is used as the forwarding between the first host and the second host. Path
控制器 620通过分析第一交换机 660发送来的数据包的目的 IP地址,发 现该数据包的目的主机即第二主机 642和第一主机 640处于不同的子网, 判 断是一个三层转发,并且通过 ARP学习过程已经获取到第一主机 640和第二 主机 642的 MAC地址、 IP地址和端口信息, 根据路由算法决策生成转发路 径, 假设按照最短路径策略来生成转发路径, 则生成的转发路径可以为: 第 一交换机 660<—— >第三交换机 664<—— >第二交换机 662。 比如, 当第一 主机 640和第二主机 642的网络信息包括 MAC地址、 IP地址和端口信息的 时候, 控制器 620根据第一主机 640和第二主机 642的 IP地址可以判断为 三层转发, 根据路由算法决策生成转发路径, 假设按照最短路径策略来生成 转发路径, 则根据第一主机 640和第二主机 642的端口信息生成的转发路径 可以为: 第一交换机 660<—— >第三交换机 664<—— >第二交换机 662。 需要说明的是, 控制器 620还可以根据第一主机 640的网络信息和第二 主机 642的网络信息计算第一主机 640和第二主机 642之间的最优转发路径; 最优转发路径为链路带宽最优的路径, 将最优转发路径作为第一主机 640和 第二主机 642之间的转发路径, 这里仅以最短路径策略为例进行说明。 The controller 620 analyzes the destination IP address of the data packet sent by the first switch 660, and finds that the destination host of the data packet, that is, the second host 642 and the first host 640 are in different subnets, and determines that it is a three-layer forwarding, and The MAC address, IP address, and port information of the first host 640 and the second host 642 are obtained through the ARP learning process, and the forwarding path is generated according to the routing algorithm decision. If the forwarding path is generated according to the shortest path policy, the generated forwarding path may be generated. The first switch 660 <-> the third switch 664 <-> the second switch 662. For example, when the network information of the first host 640 and the second host 642 includes the MAC address, the IP address, and the port information, the controller 620 can determine that the IP address of the first host 640 and the second host 642 is three-layer forwarding. Generating a forwarding path according to the routing algorithm decision, and assuming that the forwarding path is generated according to the shortest path policy, the forwarding path generated according to the port information of the first host 640 and the second host 642 It may be: a first switch 660<-> a third switch 664<-> a second switch 662. It should be noted that the controller 620 may further calculate an optimal forwarding path between the first host 640 and the second host 642 according to the network information of the first host 640 and the network information of the second host 642. The optimal forwarding path is a chain. The optimal path of the path is used as the forwarding path between the first host 640 and the second host 642. The shortest path policy is used as an example for description.
步骤 513, 控制器根据生成的转发路径为转发路径上的交换机生成对应 的转发流表, 并将生成的转发流表发送给对应的交换机;  Step 513: The controller generates a corresponding forwarding flow table for the switch on the forwarding path according to the generated forwarding path, and sends the generated forwarding flow table to the corresponding switch.
控制器 620根据生成的转发路径为转发路径上的交换机生成对应的转发 流表, 并将生成的转发流表发送给对应的交换机, 比如, 控制器 620为最短 路径上的第一交换机 660、 第三交换机 664和第二交换机 662生成对应的转 发流表, 并将与第一交换机 660对应的转发流表发送给第一交换机 660、 将 与第三交换机 664对应的转发流表发送给第三交换机 664、 将与第二交换机 662对应的转发流表发送给第二交换机 662。 其中第三交换机 664未在图 5 中标出。  The controller 620 generates a corresponding forwarding flow table for the switch on the forwarding path according to the generated forwarding path, and sends the generated forwarding flow table to the corresponding switch. For example, the controller 620 is the first switch 660 on the shortest path. The third switch 664 and the second switch 662 generate a corresponding forwarding flow table, and send the forwarding flow table corresponding to the first switch 660 to the first switch 660, and send the forwarding flow table corresponding to the third switch 664 to the third switch. 664. Send the forwarding flow table corresponding to the second switch 662 to the second switch 662. The third switch 664 is not labeled in Figure 5.
步骤 514, 对应的交换机根据转发流表更新本地的转发流表;  Step 514: The corresponding switch updates the local forwarding flow table according to the forwarding flow table.
比如, 对应的最短路径上的第一交换机 660、 第三交换机 664和第二交 换机 662更新本地转发流表信息。  For example, the first switch 660, the third switch 664, and the second switch 662 on the corresponding shortest path update the local forwarding flow table information.
步骤 515, 对应的交换机根据更新后的转发流表转发第一主机和第二主 机之间的通信数据包。  Step 515: The corresponding switch forwards the communication data packet between the first host and the second host according to the updated forwarding flow table.
比如, 对应的最短路径上的第一交换机 660、 第三交换机 664和第二交 换机 662根据更新后的转发流表转发第一主机 640和第二主机 642之间的通 信数据包。  For example, the first switch 660, the third switch 664, and the second switch 662 on the corresponding shortest path forward the communication data packet between the first host 640 and the second host 642 according to the updated forwarding flow table.
综上所述, 本实施例提供的三层转发的实现方法, 通过控制器来代替在 OpenFlow网络中实现网关 /路由功能的部分 OpenFlow交换机, 由控制器实 现对应于通信的两个子网的第一代理设备和第二代理设备的代理 ARP功能, 使得 OpenFlow 网络中的所有交换机只要实现简单的转发功能即可, 从而解 决了 OpenFlow网络中的专用的 OpenFlow交换机无法实现网关 /路由功能的 问题, 达到了 OpenFlow网络中不需要单独设置起到网关 /路由功能的交换机 的效果。 In summary, the implementation method of the three-layer forwarding provided by the embodiment replaces the partial OpenFlow switch that implements the gateway/routing function in the OpenFlow network by using the controller, and the controller implements the first two subnets corresponding to the communication. The proxy ARP function of the proxy device and the second proxy device enables all switches in the OpenFlow network to implement a simple forwarding function, thereby solving the problem that the dedicated OpenFlow switch in the OpenFlow network cannot implement the gateway/routing function. There is no need to separately set up a switch functioning as a gateway/router in the OpenFlow network. Effect.
需要说明的是, 控制器和交换机之间可以通过专用的网络传输控制消息, 和交换机之间转发数据的通讯路径在物理链路上隔离; 也可以和交换机之间 转发数据的通讯路径为同一路径, 通过不同的规则区分控制器与交换机之间 的控制消息和交换机之间的转发数据。 下述为本发明设备实施例, 其中未详尽描述的内容, 可以结合参考上述 对应的方法实施例。  It should be noted that the control message can be transmitted between the controller and the switch through a dedicated network, and the communication path for forwarding data between the switch and the switch is isolated on the physical link; or the communication path for forwarding data with the switch is the same path. Different rules are used to distinguish between control messages between the controller and the switch and forwarding data between the switches. The following is an embodiment of the device of the present invention, and the content that is not described in detail may be referred to the corresponding method embodiment.
实施例四  Embodiment 4
请参考图 7,其示出了本发明实施例四提供的控制器的结构示意图,该控 制器, 包括: 第一信息获取模块 710、 第二信息获取模块 720、 路径生成模块 730和流表下发模块 740。  Please refer to FIG. 7 , which is a schematic structural diagram of a controller according to Embodiment 4 of the present invention. The controller includes: a first information acquiring module 710, a second information acquiring module 720, a path generating module 730, and a flow table. Send module 740.
所述第一信息获取模块 710, 用于通过接收到的第一 ARP请求获取第一 主机的网络信息, 所述第一 ARP请求是由所述第一主机发送的、 且与所述第 一主机相连的交换机无法查找到转发流表后转发给所述控制器的 ARP请求; 所述第二信息获取模块 720, 用于通过构造第二 ARP请求获取第二主机 的网络信息;  The first information obtaining module 710 is configured to acquire network information of the first host by using the received first ARP request, where the first ARP request is sent by the first host, and is related to the first host The connected switch cannot find the ARP request that is forwarded to the controller after forwarding the flow table. The second information obtaining module 720 is configured to acquire the network information of the second host by constructing the second ARP request.
所述路径生成模块 730, 用于根据所述第一信息获取模块 710获取到的 第一主机的网络信息和所述第二信息获取模块 720获取到的第二主机的网络 信息决策生成所述第一主机和所述第二主机之间的转发路径;  The path generation module 730 is configured to generate, according to the network information of the first host acquired by the first information acquiring module 710 and the network information of the second host acquired by the second information acquiring module 720. a forwarding path between a host and the second host;
所述流表下发模块 740, 用于向所述路径生成模块 730生成的转发路径 上的每个交换机下发转发流表, 以便所述转发路径上的每个交换机根据所述 转发流表在所述第一主机和所述第二主机之间转发数据包。  The flow table issuing module 740 is configured to send a forwarding flow table to each switch on the forwarding path generated by the path generation module 730, so that each switch on the forwarding path is in accordance with the forwarding flow table. Transmitting a data packet between the first host and the second host.
综上所述, 本实施例提供的控制器, 通过获取第一主机和第二主机的网 络信息, 根据获取到的第一主机和第二主机的网络信息决策生成转发路径, 以便第一主机和第二主机进行通信, 解决了 OpenFlow 网络中的专用的 OpenFlow交换机无法实现该功能的问题,达到了 OpenFlow网络中不需要单 独设置起到网关 /路由功能的交换机的效果。 实施例五 In summary, the controller provided in this embodiment generates a forwarding path according to the obtained network information of the first host and the second host by acquiring the network information of the first host and the second host, so that the first host and the first host and The second host communicates, which solves the problem that the dedicated OpenFlow switch in the OpenFlow network cannot implement the function, and achieves the effect that the switch that does not need to be separately set to the gateway/route function is required in the OpenFlow network. Embodiment 5
请参考图 8,其示出了本发明实施例五提供的控制器的结构示意图。本实 施例主要以该控制器应用于图 4所示的实施环境中来举例说明。 参考图 4可 知, 本实施环境包括控制器 420、 第一主机 440、 第二主机 442、 第三主机 444和第四主机 446、 第一交换机 460、 第二交换机 462、 第三交换机 464、 第四交换机 466和第五交换机 468, 其中第一主机 440属于第一子网, 第二 主机 442、 第三主机 444和第四主机 446属于第二子网, 第一主机 440和第 三主机 444连接在第一交换机 460的端口上, 第二主机 442连接在第二交换 机 462的端口上, 第四主机 446连接在第五交换机 468的端口上, 假设第一 主机 440上配置网关为第一网关, 第二主机 442上配置网关为第二网关, 第 一主机 440属于第一子网, 第二主机 442、 第三主机 444和第四主机 446属 于第二子网, 第一网关和第二网关由控制器 420实现, 控制器 420上预先存 储了第一主机 440、 第二主机 442所在子网的信息 (包括网关、 网络号及子 网掩码 )及相应的网关信息(包括网关的 IP地址和 MAC地址)。 该控制器, 包括: 第一预先存储模块 810、 第一信息获取模块 820、 第一反馈模块 830、 第二信息获取模块 840、 路径生成模块 850和流表下发模块 860。  Please refer to FIG. 8, which is a schematic structural diagram of a controller provided in Embodiment 5 of the present invention. This embodiment is mainly illustrated by the application of the controller to the implementation environment shown in FIG. Referring to FIG. 4, the implementation environment includes a controller 420, a first host 440, a second host 442, a third host 444, and a fourth host 446, a first switch 460, a second switch 462, a third switch 464, and a fourth The switch 466 and the fifth switch 468, wherein the first host 440 belongs to the first subnet, the second host 442, the third host 444, and the fourth host 446 belong to the second subnet, and the first host 440 and the third host 444 are connected to On the port of the first switch 460, the second host 442 is connected to the port of the second switch 462, and the fourth host 446 is connected to the port of the fifth switch 468. The second host 442 is configured as a second gateway, the first host 440 belongs to the first subnet, and the second host 442, the third host 444, and the fourth host 446 belong to the second subnet, and the first gateway and the second gateway are controlled. The 420 is implemented on the controller 420, and the information about the subnet where the first host 440 and the second host 442 are located (including the gateway, the network number, and the subnet mask) and corresponding Gateway information (including IP address and MAC address of the gateway). The controller includes: a first pre-storage module 810, a first information acquisition module 820, a first feedback module 830, a second information acquisition module 840, a path generation module 850, and a flow table delivery module 860.
所述第一预先存储模块 810, 用于预先存储所述第一主机 440和所述第 二主机 442所在子网的网关、 网络号和子网掩码, 以及所述第一网关和所述 第二网关的 MAC地址和 I P地址。  The first pre-storage module 810 is configured to pre-store a gateway, a network number, and a subnet mask of a subnet where the first host 440 and the second host 442 are located, and the first gateway and the second The MAC address and IP address of the gateway.
所述第一信息获取模块 820, 用于通过接收到的第一 ARP请求获取第一 主机 440的网络信息,所述第一 ARP请求是由所述第一主机 440发送的、且 与所述第一主机 440相连的交换机无法查找到转发流表后转发给所述控制器 420的 ARP请求。  The first information obtaining module 820 is configured to acquire network information of the first host 440 by using the received first ARP request, where the first ARP request is sent by the first host 440, and the first A switch connected to a host 440 cannot find an ARP request forwarded to the controller 420 after forwarding the flow table.
具体的讲, 所述第一信息获取模块 820, 包括: 第四接收单元 821 和第 一获取单元 822。  Specifically, the first information acquiring module 820 includes: a fourth receiving unit 821 and a first acquiring unit 822.
所述第四接收单元 821,用于接收所述第一主机 440发送的所述第一 ARP 请求。 所述第一获取单元 822, 用于通过所述第四接收单元 821接收到的第一 ARP请求获取第一主机 440的网络信息。 The fourth receiving unit 821 is configured to receive the first ARP request sent by the first host 440. The first obtaining unit 822 is configured to acquire network information of the first host 440 by using the first ARP request received by the fourth receiving unit 821.
所述第一反馈模块 830, 用于通过与所述第一主机 440相连的交换机向 所述第一主机 440反馈第一 ARP响应, 所述第一 ARP响应中的源 MAC地 址和源 IP地址分别为所述第一网关的 MAC地址和 IP地址。  The first feedback module 830 is configured to feed back a first ARP response to the first host 440 by using a switch connected to the first host 440, where a source MAC address and a source IP address in the first ARP response are respectively Is the MAC address and IP address of the first gateway.
所述第二信息获取模块 840, 用于通过构造第二 ARP请求获取第二主机 442的网络信息。  The second information acquiring module 840 is configured to acquire network information of the second host 442 by constructing a second ARP request.
具体的讲, 所述第二信息获取模块 840, 包括: 第一接收单元 841、 第一 构造单元 842、 第一发送单元 843、 第二接收单元 844和第二获取单元 845。  Specifically, the second information acquiring module 840 includes: a first receiving unit 841, a first constructing unit 842, a first sending unit 843, a second receiving unit 844, and a second acquiring unit 845.
所述第一接收单元 841, 用于接收所述第一主机 440发送的数据包, 所 述数据包的目的 MAC地址为所述第一网关的 MAC地址,目的 IP地址为所述 第二主机 442的 IP地址。  The first receiving unit 841 is configured to receive a data packet sent by the first host 440, where a destination MAC address of the data packet is a MAC address of the first gateway, and a destination IP address is the second host 442. IP address.
所述第一构造单元 842, 用于根据所述第一接收单元 841接收到的数据 包中的第二主机 442的 IP地址构造第二 ARP请求,所述第二 ARP请求的源 MAC地址和源 IP地址分别为第二网关的 MAC地址和 IP地址, 目的 IP地址 为所述第二主机 442的 IP地址,所述第二网关为所述第二主机 442的配置网 关。  The first constructing unit 842 is configured to construct a second ARP request according to an IP address of the second host 442 in the data packet received by the first receiving unit 841, a source MAC address and a source of the second ARP request. The IP address is the MAC address and the IP address of the second gateway, the destination IP address is the IP address of the second host 442, and the second gateway is the configuration gateway of the second host 442.
所述第一发送单元 843, 用于根据所述第一预先存储模块 810预先存储 的第二主机 442所在子网的网关、网络号和子网掩码,通过所述第二主机 442 所在子网内的交换机将所述第一构造单元 842构造的第二 ARP请求发送给所 述第二主机 442所在子网内的所有主机。  The first sending unit 843 is configured to use, according to the gateway, the network number, and the subnet mask of the subnet where the second host 442 is pre-stored by the first pre-storage module 810, by using the second host 442 in the subnet The switch sends the second ARP request constructed by the first construction unit 842 to all hosts in the subnet where the second host 442 is located.
所述第二接收单元 844, 用于通过与所述第二主机 442相连的交换机接 收所述第二主机 442反馈的第二 ARP响应, 所述第二 ARP响应的源 MAC 地址和源 IP地址分别为所述第二主机 442的 MAC地址和 IP地址。  The second receiving unit 844 is configured to receive, by using a switch connected to the second host 442, a second ARP response that is sent by the second host 442, where the source MAC address and the source IP address of the second ARP response are respectively It is the MAC address and IP address of the second host 442.
所述第二获取单元 845, 用于根据所述第二接收单元 844接收到的第二 ARP响应获取所述第二主机 442的网络信息。  The second obtaining unit 845 is configured to acquire network information of the second host 442 according to the second ARP response received by the second receiving unit 844.
所述路径生成模块 850, 用于根据所述第一信息获取模块 820获取到的 第一主机 440 的网络信息和所述第二信息获取模块 840 获取到的第二主机 442的网络信息决策生成所述第一主机 440和所述第二主机 442之间的转发 路径。 The path generation module 850 is configured to: according to the network information of the first host 440 acquired by the first information acquiring module 820 and the second host acquired by the second information acquiring module 840 The network information decision of 442 generates a forwarding path between the first host 440 and the second host 442.
具体的讲,所述路径生成模块 850,具体包括: 最短生成单元 851,或者, 最优生成单元 852。  Specifically, the path generation module 850 specifically includes: a shortest generation unit 851, or an optimal generation unit 852.
所述最短生成单元 851, 用于根据所述第一信息获取模块 820获取到的 第一主机 440 的网络信息和所述第二信息获取模块 840 获取到的第二主机 442的网络信息计算所述第一主机 440和所述第二主机 442之间的最短转发 路径; 将所述最短转发路径作为所述第一主机 440和所述第二主机 442之间 的转发路径。  The shortest generation unit 851 is configured to calculate, according to the network information of the first host 440 acquired by the first information acquiring module 820 and the network information of the second host 442 acquired by the second information acquiring module 840. The shortest forwarding path between the first host 440 and the second host 442; the shortest forwarding path is used as a forwarding path between the first host 440 and the second host 442.
所述最优生成单元 852, 用于根据所述第一信息获取模块 820获取到的 第一主机 440 的网络信息和所述第二信息获取模块 840 获取到的第二主机 442的网络信息计算所述第一主机 440和所述第二主机 442之间的最优转发 路径; 将所述最优转发路径作为所述第一主机 440和所述第二主机 442之间 的转发路径。  The optimal generation unit 852 is configured to calculate, according to the network information of the first host 440 acquired by the first information acquiring module 820 and the network information of the second host 442 acquired by the second information acquiring module 840. An optimal forwarding path between the first host 440 and the second host 442; the optimal forwarding path is used as a forwarding path between the first host 440 and the second host 442.
所述流表下发模块 860, 用于向所述路径生成模块 850生成的转发路径 上的每个交换机下发转发流表, 以便所述转发路径上的每个交换机根据所述 转发流表在所述第一主机 440和所述第二主机 442之间转发数据包。  The flow table issuing module 860 is configured to deliver a forwarding flow table to each switch on the forwarding path generated by the path generation module 850, so that each switch on the forwarding path is in accordance with the forwarding flow table. The data packet is forwarded between the first host 440 and the second host 442.
综上所述,本实施例提供的控制器,通过实现第一网关和第二网关的 ARP 功能, 获取第一主机和第二主机的网络信息, 根据预先存储的所述第一主机 和所述第二主机所在子网的信息和相应的网关信息和获取到的第一主机和第 二主机的网络信息决策生成转发路径, 使得 OpenFlow 网络中的所有交换机 只要实现简单的转发功能即可, 从而解决了 OpenFlow 网络中的专用的 OpenFlow交换机无法实现该网关 /路由功能的问题, 达到了 OpenFlow网络 中不需要单独设置起到网关 /路由功能的交换机的效果。 实施例六  In summary, the controller provided in this embodiment obtains network information of the first host and the second host by implementing the ARP function of the first gateway and the second gateway, according to the first host and the pre-stored The information about the subnet where the second host is located and the corresponding gateway information and the obtained network information of the first host and the second host determine a forwarding path, so that all switches in the OpenFlow network can implement a simple forwarding function, thereby solving The dedicated OpenFlow switch in the OpenFlow network cannot implement the gateway/routing function, and the effect of the switch that does not need to be separately set to the gateway/routing function in the OpenFlow network is achieved. Embodiment 6
请参考图 9,其示出了本发明实施例六提供的控制器的结构示意图。本实 施例主要以该控制器应用于图 6所示的实施环境中来举例说明。 参考图 6可 知, 本实施环境包括控制器 620、 第一主机 640、 第二主机 642、 第三主机 644和第四主机 646、 第一交换机 660、 第二交换机 662、 第三交换机 664、 第四交换机 666和第五交换机 668, 其中第一主机 640属于第一子网, 第二 主机 642、 第三主机 644和第四主机 646属于第二子网, 第一主机 640和第 三主机 644连接在第一交换机 660的端口上, 第二主机 642连接在第二交换 机 662的端口上, 第四主机 646连接在第五交换机 668的端口上, 假设第一 主机 640和第二主机 642没有配置默认网关, 第一主机 640属于第一子网, 第二主机 642、 第三主机 644和第四主机 646属于第二子网, 控制器 620上 预先存储了第一主机 640和第二主机 642所在子网的信息 (包括网关、 网络 号及子网掩码)和分别对应于两个子网的第一代理设备和第二代理设备。 该 控制器, 包括: 第二预先存储模块 910、 第一信息获取模块 920、 第二反馈模 块 930、 第二信息获取模块 940、 路径生成模块 950和流表下发模块 960。 Please refer to FIG. 9, which is a schematic structural diagram of a controller provided in Embodiment 6 of the present invention. This embodiment is mainly illustrated by the application of the controller to the implementation environment shown in FIG. 6. Refer to Figure 6 The implementation environment includes a controller 620, a first host 640, a second host 642, a third host 644, and a fourth host 646, a first switch 660, a second switch 662, a third switch 664, a fourth switch 666, and The fifth switch 668, wherein the first host 640 belongs to the first subnet, the second host 642, the third host 644, and the fourth host 646 belong to the second subnet, and the first host 640 and the third host 644 are connected to the first switch. On the port of 660, the second host 642 is connected to the port of the second switch 662, and the fourth host 646 is connected to the port of the fifth switch 668. It is assumed that the first host 640 and the second host 642 are not configured with a default gateway. The host 640 belongs to the first subnet, and the second host 642, the third host 644, and the fourth host 646 belong to the second subnet. The controller 620 pre-stores information about the subnet where the first host 640 and the second host 642 are located ( The gateway, the network number, and the subnet mask are included, and the first proxy device and the second proxy device respectively correspond to the two subnets. The controller includes: a second pre-storage module 910, a first information acquisition module 920, a second feedback module 930, a second information acquisition module 940, a path generation module 950, and a flow table delivery module 960.
所述第二预先存储模块 910, 用于预先存储所述第一主机 640和所述第 二主机 642所在子网的网关、 网络号和子网掩码, 以及所述第一代理设备和 所述第二代理设备的 MAC地址。  The second pre-storage module 910 is configured to pre-store a gateway, a network number, and a subnet mask of a subnet where the first host 640 and the second host 642 are located, and the first proxy device and the first The MAC address of the second proxy device.
所述第一信息获取模块 920, 用于通过接收到的第一 ARP请求获取第一 主机 640的网络信息,所述第一 ARP请求是由所述第一主机 640发送的、且 与所述第一主机 640相连的交换机无法查找到转发流表后转发给所述控制器 620的 ARP请求。  The first information obtaining module 920 is configured to acquire network information of the first host 640 by using the received first ARP request, where the first ARP request is sent by the first host 640 and is related to the first A switch connected to a host 640 cannot find an ARP request forwarded to the controller 620 after forwarding the flow table.
具体的讲, 所述第一信息获取模块 920, 包括: 第四接收单元 921 和第 一获取单元 922。  Specifically, the first information acquiring module 920 includes: a fourth receiving unit 921 and a first acquiring unit 922.
所述第四接收单元 921,用于接收所述第一主机 640发送的所述第一 ARP 请求。  The fourth receiving unit 921 is configured to receive the first ARP request sent by the first host 640.
所述第一获取单元 922, 用于通过所述第四接收单元 921接收到的第一 ARP请求获取第一主机 440的网络信息。  The first obtaining unit 922 is configured to acquire network information of the first host 440 by using the first ARP request received by the fourth receiving unit 921.
所述第二反馈模块 930, 用于通过与所述第一主机 640相连的交换机向 所述第一主机 640反馈第一 ARP响应, 所述第一 ARP响应中的源 MAC地 址为第一代理设备的 MAC地址, 源 IP地址为第二主机的 IP地址, 以便所述 第一主机 640将所述第一代理设备的 MAC地址作为第二主机 642的 MAC地 址, 所述第一代理设备为对应于所述第一主机 640所在子网内的代理设备。 The second feedback module 930 is configured to feed back, by the switch connected to the first host 640, the first ARP response to the first host 640, where the source MAC address in the first ARP response is the first proxy device. MAC address, the source IP address is the IP address of the second host, so as to The first host 640 uses the MAC address of the first proxy device as the MAC address of the second host 642, and the first proxy device is a proxy device corresponding to the subnet in which the first host 640 is located.
所述第二信息获取模块 940, 用于通过构造第二 ARP请求获取第二主机 642的网络信息。  The second information acquiring module 940 is configured to acquire network information of the second host 642 by constructing a second ARP request.
具体的讲, 所述第二信息获取模块 940, 包括: 第三接收单元 941、 第二 构造单元 942、 第二发送单元 943、 第二接收单元 944和第二获取单元 945。  Specifically, the second information acquiring module 940 includes: a third receiving unit 941, a second constructing unit 942, a second sending unit 943, a second receiving unit 944, and a second obtaining unit 945.
所述第三接收单元 941, 用于接收所述第一主机 640发送的数据包, 所 述数据包的目的 MAC地址为所述第一代理设备的 MAC地址,目的 IP地址为 所述第二主机 642的 IP地址。  The third receiving unit 941 is configured to receive a data packet sent by the first host 640, where a destination MAC address of the data packet is a MAC address of the first proxy device, and a destination IP address is the second host 642 IP address.
所述第二构造单元 942, 用于根据所述第三接收单元 941接收到的数据 包中的第二主机 642的 IP地址构造第二 ARP请求,所述第二 ARP请求的源 MAC地址为第二代理设备的 MAC地址,源 IP地址为所述第一主机 640的 IP 地址, 目的 IP地址为所述第二主机 642的 IP地址, 以便所述第二主机 642 将所述第二代理设备的 MAC地址作为所述第一主机 640的 MAC地址, 所述 第二代理设备为对应于所述第二主机 642所在子网内的代理设备。  The second constructing unit 942 is configured to construct a second ARP request according to the IP address of the second host 642 in the data packet received by the third receiving unit 941, where the source MAC address of the second ARP request is The MAC address of the second proxy device, the source IP address being the IP address of the first host 640, and the destination IP address being the IP address of the second host 642, so that the second host 642 will be the second proxy device The MAC address is used as the MAC address of the first host 640, and the second proxy device is a proxy device corresponding to the subnet in which the second host 642 is located.
所述第二发送单元 943, 用于通过所述第二主机 642所在子网内的交换 机将所述第二构造单元 942构造的第二 ARP请求发送给所述第二主机 642 所在子网内的所有主机。  The second sending unit 943 is configured to send, by using a switch in a subnet where the second host 642 is located, a second ARP request configured by the second configuration unit 942 to a subnet in which the second host 642 is located. All hosts.
所述第二接收单元 944, 用于根据所述第二预先存储模块 910预先存储 的第二主机 642所在子网的网关、 网络号和子网掩码, 通过与所述第二主机 642相连的交换机接收所述第二主机 642反馈的第二 ARP响应, 所述第二 ARP响应的源 MAC地址和源 IP地址分别为所述第二主机 642的 MAC地址 IP地址。  The second receiving unit 944 is configured to use a switch connected to the second host 642 according to a gateway, a network number, and a subnet mask of a subnet where the second host 642 is pre-stored by the second pre-storage module 910. And receiving, by the second host 642, the second ARP response, where the source MAC address and the source IP address of the second ARP response are respectively the MAC address IP address of the second host 642.
所述第二获取单元 945, 用于根据所述第二接收单元 944接收到的第二 ARP响应获取所述第二主机 642的网络信息。  The second obtaining unit 945 is configured to acquire network information of the second host 642 according to the second ARP response received by the second receiving unit 944.
所述路径生成模块 950, 用于根据所述第一信息获取模块 920获取到的 第一主机 640 的网络信息和所述第二信息获取模块 940 获取到的第二主机 642的网络信息决策生成所述第一主机 640和所述第二主机 642之间的转发 路径。 The path generation module 950 is configured to generate, according to the network information of the first host 640 acquired by the first information acquiring module 920 and the network information decision generation of the second host 642 acquired by the second information acquiring module 940. Forwarding between the first host 640 and the second host 642 Path.
具体的讲,所述路径生成模块 950,具体包括: 最短生成单元 951,或者, 最优生成单元 952。  Specifically, the path generation module 950 specifically includes: a shortest generation unit 951, or an optimal generation unit 952.
所述最短生成单元 951, 用于根据所述第一信息获取模块 920获取到的 第一主机 640 的网络信息和所述第二信息获取模块 940 获取到的第二主机 642的网络信息计算所述第一主机 640和所述第二主机 642之间的最短转发 路径; 将所述最短转发路径作为所述第一主机 640和所述第二主机 642之间 的转发路径。  The shortest generation unit 951 is configured to calculate, according to the network information of the first host 640 acquired by the first information acquiring module 920 and the network information of the second host 642 acquired by the second information acquiring module 940. The shortest forwarding path between the first host 640 and the second host 642; the shortest forwarding path is used as a forwarding path between the first host 640 and the second host 642.
所述最优生成单元 952, 用于根据所述第一信息获取模块 920获取到的 第一主机 640 的网络信息和所述第二信息获取模块 940 获取到的第二主机 642的网络信息计算所述第一主机 640和所述第二主机 642之间的最优转发 路径; 将所述最优转发路径作为所述第一主机 640和所述第二主机 642之间 的转发路径。  The optimal generation unit 952 is configured to calculate, according to the network information of the first host 640 acquired by the first information acquiring module 920 and the network information of the second host 642 acquired by the second information acquiring module 940. The optimal forwarding path between the first host 640 and the second host 642 is used as the forwarding path between the first host 640 and the second host 642.
所述流表下发模块 960, 用于向所述路径生成模块 950生成的转发路径 上的每个交换机下发转发流表, 以便所述转发路径上的每个交换机根据所述 转发流表在所述第一主机 640和所述第二主机 642之间转发数据包。  The flow table issuing module 960 is configured to send a forwarding flow table to each switch on the forwarding path generated by the path generating module 950, so that each switch on the forwarding path is in accordance with the forwarding flow table. The data packet is forwarded between the first host 640 and the second host 642.
综上所述, 本实施例提供的控制器, 通过实现第一代理设备和第二代理 设备的代理 ARP功能, 获取第一主机和第二主机的网络信息, 根据预先存储 的所述第一主机和所述第二主机所在子网的信息和相应的网关信息和获取到 的第一主机和第二主机的网络信息决策生成转发路径, 使得 OpenFlow 网络 中的所有交换机只要实现简单的转发功能即可, 从而解决了 OpenFlow 网络 中的专用的 OpenFlow 交换机无法实现该网关 /路由功能的问题, 达到了 OpenFlow网络中不需要单独设置起到网关 /路由功能的交换机的效果。  In summary, the controller provided by the embodiment obtains the network information of the first host and the second host by implementing the proxy ARP function of the first proxy device and the second proxy device, according to the first host stored in advance. And the information about the subnet where the second host is located and the corresponding gateway information and the obtained network information of the first host and the second host determine a forwarding path, so that all switches in the OpenFlow network can implement a simple forwarding function. Therefore, the problem that the dedicated OpenFlow switch in the OpenFlow network cannot implement the gateway/routing function is solved, and the effect that the switch functioning as the gateway/routing function is not required in the OpenFlow network is achieved.
需要说明的是: 上述实施例提供的控制器在生成转发路径时, 仅以上述 各功能模块的划分进行举例说明, 实际应用中, 可以根据需要而将上述功能 分配由不同的功能模块完成, 即将控制器的内部结构划分成不同的功能模块, 以完成以上描述的全部或者部分功能。 另外, 上述实施例提供的控制器与转 发路径的生成方法实施例属于同一构思, 其具体实现过程详见方法实施例, 这里不再赘述。 实施例七 It should be noted that, when the controller provided by the foregoing embodiment generates the forwarding path, only the division of the foregoing functional modules is illustrated. In actual applications, the foregoing function allocation may be completed by different functional modules as needed. The internal structure of the controller is divided into different functional modules to perform all or part of the functions described above. In addition, the controller and the method for generating a forwarding path provided by the foregoing embodiments are in the same concept, and the specific implementation process is described in the method embodiment. I won't go into details here. Example 7
请参考图 10, 其示出了本发明实施例七提供的转发路径生成系统的结构 方框图。 该系统包括实施例五或者实施例六中提供的控制器 1010、 第一主机 1020和第二主机 1030。  Referring to FIG. 10, a block diagram showing the structure of a forwarding path generating system provided in Embodiment 7 of the present invention is shown. The system includes the controller 1010, the first host 1020, and the second host 1030 provided in the fifth embodiment or the sixth embodiment.
综上所述, 本实施例提供的转发路径的生成系统, 通过控制器获取第一 主机和第二主机的网络信息, 根据获取到的第一主机和第二主机的网络信息 决策生成转发路径, 以便第一主机和第二主机进行通信, 解决了 OpenFlow 网络中的专用的 OpenFlow交换机无法实现该功能的问题,达到了 OpenFlow 网络中不需要单独设置起到网关 /路由功能的交换机的效果。 实施例八  In summary, the system for generating a forwarding path provided by the embodiment obtains the network information of the first host and the second host by using the controller, and generates a forwarding path according to the obtained network information of the first host and the second host. In order to communicate between the first host and the second host, the problem that the dedicated OpenFlow switch in the OpenFlow network cannot implement the function is solved, and the effect that the switch functioning as the gateway/routing function is not required in the OpenFlow network is achieved. Example eight
请参考图 1 1, 其示出了本发明实施例八提供的控制器的结构方框图。 所 述控制器包括: 处理器 1 101和发送机 1 102。  Referring to FIG. 1, a block diagram of a controller provided in Embodiment 8 of the present invention is shown. The controller includes: a processor 1 101 and a transmitter 1 102.
所述处理器 1 101, 用于通过接收到的第一 ARP请求获取第一主机的网 络信息, 所述第一 ARP请求是由所述第一主机发送的、 且与所述第一主机相 连的交换机无法查找到转发流表后转发给所述控制器的 ARP请求。  The processor 1101 is configured to acquire network information of the first host by using the received first ARP request, where the first ARP request is sent by the first host and connected to the first host. The switch cannot find the ARP request forwarded to the controller after forwarding the flow table.
所述处理器 1 101, 还用于通过构造第二 ARP请求获取第二主机的网络 信息。  The processor 1101 is further configured to acquire network information of the second host by constructing a second ARP request.
所述处理器 1 101, 还用于根据获取到的第一主机的网络信息和第二主机 的网络信息决策生成所述第一主机和所述第二主机之间的转发路径。  The processor 1101 is further configured to generate, according to the acquired network information of the first host and the network information of the second host, a forwarding path between the first host and the second host.
所述发送机 1 102, 用于向所述处理器 1 101 生成的转发路径上的每个交 换机下发转发流表, 以便所述转发路径上的每个交换机根据所述转发流表在 所述第一主机和所述第二主机之间转发数据包。  The transmitter 1102 is configured to send, to each switch on the forwarding path generated by the processor 1 101, a forwarding flow table, so that each switch on the forwarding path is configured according to the forwarding flow table. A data packet is forwarded between the first host and the second host.
综上所述, 本实施例提供的控制器, 通过获取第一主机和第二主机的网 络信息, 根据获取到的第一主机和第二主机的网络信息决策生成转发路径, 以便第一主机和第二主机进行通信, 解决了 OpenFlow 网络中的专用的 OpenFlow交换机无法实现该功能的问题,达到了 OpenFlow网络中不需要单 独设置起到网关 /路由功能的交换机的效果。 实施例九 In summary, the controller provided in this embodiment generates a forwarding path according to the obtained network information of the first host and the second host by acquiring the network information of the first host and the second host, so that the first host and the first host and The second host communicates and resolves the dedicated one in the OpenFlow network. The OpenFlow switch cannot implement the problem of this function, and the effect of the switch that does not need to be separately set to the gateway/routing function in the OpenFlow network is achieved. Example nine
请参考图 12, 其示出了本发明实施例九提供的控制器的结构方框图。 本 实施例主要以该控制器应用于图 4所示的实施环境中来举例说明。 所述控制 器包括: 存储器 1201、 处理器 1202、 发送机 1203和接收机 1204。  Referring to FIG. 12, a block diagram showing the structure of a controller provided in Embodiment 9 of the present invention is shown. This embodiment is mainly illustrated by the application of the controller to the implementation environment shown in FIG. The controller includes: a memory 1201, a processor 1202, a transmitter 1203, and a receiver 1204.
所述存储器 1201, 用于预先存储所述第一主机 440和所述第二主机 442 所在子网的网关、 网络号和子网掩码, 以及所述第一网关和所述第二网关的 MAC地址和 IP地址。  The memory 1201 is configured to pre-store a gateway, a network number, and a subnet mask of a subnet where the first host 440 and the second host 442 are located, and a MAC address of the first gateway and the second gateway. And IP address.
所述处理器 1202, 用于通过接收到的第一 ARP请求获取第一主机 440 的网络信息, 所述第一 ARP请求是由所述第一主机 440发送的、 且与所述第 一主机 440 相连的交换机无法查找到转发流表后转发给所述控制器 420 的 ARP请求。  The processor 1202 is configured to obtain network information of the first host 440 by using the received first ARP request, where the first ARP request is sent by the first host 440 and is related to the first host 440. The connected switch cannot find the ARP request forwarded to the controller 420 after forwarding the flow table.
具体的讲, 所述处理器 1202, 具体用于控制所述接收机 1204接收所述 第一主机 440发送的所述第一 ARP请求。 所述处理器 1202, 还用于通过所 述接收机 1204接收到的第一 ARP请求获取第一主机 440的网络信息。  Specifically, the processor 1202 is specifically configured to control the receiver 1204 to receive the first ARP request sent by the first host 440. The processor 1202 is further configured to acquire network information of the first host 440 by using the first ARP request received by the receiver 1204.
所述发送机 1203,用于通过与所述第一主机 440相连的交换机向所述第 一主机 440反馈第一 ARP响应, 所述第一 ARP响应中的源 MAC地址和源 IP地址分别为所述第一网关的 MAC地址和 IP地址。  The transmitter 1203 is configured to feed back, by the switch connected to the first host 440, the first ARP response to the first host 440, where the source MAC address and the source IP address in the first ARP response are respectively The MAC address and IP address of the first gateway.
所述处理器 1202, 还用于通过构造第二 ARP请求获取第二主机 442的 网络信息。  The processor 1202 is further configured to acquire network information of the second host 442 by constructing a second ARP request.
具体的讲, 所述处理器 1202, 具体用于控制所述接收机 1204接收所述 第一主机 440发送的数据包,所述数据包的目的 MAC地址为所述第一网关的 MAC地址, 目的 IP地址为所述第二主机 442的 IP地址; 所述处理器 1202, 还具体用于根据所述接收机 1204接收到的数据包中的第二主机 442的 IP地 址构造第二 ARP请求, 所述第二 ARP请求的源 MAC地址和源 IP地址分别 为第二网关的 MAC地址和 IP地址, 目的 IP地址为所述第二主机 442的 IP 地址, 所述第二网关为所述第二主机 442的配置网关; 所述处理器 1202, 还 具体用于控制所述发送机 1203根据所述存储器 1201 预先存储的第二主机 442所在子网的网关、 网络号和子网掩码, 通过所述第二主机 442所在子网 内的交换机将所述第二 ARP请求发送给所述第二主机 442所在子网内的所有 主机; 所述处理器 1202, 还具体用于控制所述接收机 1204通过与所述第二 主机 442相连的交换机接收所述第二主机 442反馈的第二 ARP响应,所述第 二 ARP响应的源 MAC地址和源 IP地址分别为所述第二主机 442的 MAC地 址和 IP地址; 所述处理器 1202, 还具体用于根据所述接收机 1204接收到的 第二 ARP响应获取所述第二主机 442的网络信息。 Specifically, the processor 1202 is specifically configured to control the receiver 1204 to receive a data packet sent by the first host 440, where a destination MAC address of the data packet is a MAC address of the first gateway, and The IP address is the IP address of the second host 442. The processor 1202 is further configured to construct a second ARP request according to the IP address of the second host 442 in the data packet received by the receiver 1204. The source MAC address and the source IP address of the second ARP request are respectively the MAC address and the IP address of the second gateway, and the destination IP address is the IP of the second host 442. The second gateway is a configuration gateway of the second host 442. The processor 1202 is further configured to control a subnet where the second host 442 is pre-stored by the transmitter 1203 according to the memory 1201. a gateway, a network number, and a subnet mask, where the second ARP request is sent to all hosts in the subnet where the second host 442 is located by using a switch in the subnet where the second host 442 is located; the processor 1202 The receiver 1202 is further configured to receive, by using a switch connected to the second host 442, a second ARP response fed back by the second host 442, a source MAC address and a source IP address of the second ARP response. The processor is configured to obtain the network information of the second host 442 according to the second ARP response received by the receiver 1204.
所述处理器 1202,还用于根据所述获取到的第一主机 440的网络信息和 所述获取到的第二主机 442的网络信息决策生成所述第一主机 440和所述第 二主机 442之间的转发路径。  The processor 1202 is further configured to generate the first host 440 and the second host 442 according to the acquired network information of the first host 440 and the acquired network information of the second host 442. The forwarding path between.
具体的讲,所述处理器 1202,还具体用于根据所述获取到的第一主机 440 的网络信息和所述获取到的第二主机 442的网络信息计算所述第一主机 440 和所述第二主机 442之间的最短转发路径; 将所述最短转发路径作为所述第 一主机 440和所述第二主机 442之间的转发路径; 或者, 所述处理器 1202, 还具体用于根据所述获取到的第一主机 440的网络信息和所述获取到的第二 主机 442的网络信息计算所述第一主机 440和所述第二主机 442之间的最优 转发路径; 将所述最优转发路径作为所述第一主机 440和所述第二主机 442 之间的转发路径。  In particular, the processor 1202 is further configured to calculate the first host 440 and the network according to the acquired network information of the first host 440 and the acquired network information of the second host 442. The shortest forwarding path between the second host 442; the shortest forwarding path is used as a forwarding path between the first host 440 and the second host 442; or the processor 1202 is further configured to be used according to Calculating the optimal forwarding path between the first host 440 and the second host 442 by using the acquired network information of the first host 440 and the acquired network information of the second host 442; The optimal forwarding path is used as a forwarding path between the first host 440 and the second host 442.
所述处理器 1202, 还用于向所述生成的转发路径上的每个交换机下发转 发流表, 以便所述转发路径上的每个交换机根据所述转发流表在所述第一主 机 440和所述第二主机 442之间转发数据包。  The processor 1202 is further configured to send a forwarding flow table to each switch on the generated forwarding path, so that each switch on the forwarding path is in the first host 440 according to the forwarding flow table. And forwarding the data packet with the second host 442.
综上所述,本实施例提供的控制器,通过实现第一网关和第二网关的 ARP 功能, 获取第一主机和第二主机的网络信息, 根据预先存储的所述第一主机 和所述第二主机所在子网的信息和相应的网关信息和获取到的第一主机和第 二主机的网络信息决策生成转发路径, 使得 Open Flow 网络中的所有交换机 只要实现简单的转发功能即可, 从而解决了 OpenFlow 网络中的专用的 OpenFlow交换机无法实现该网关 /路由功能的问题, 达到了 OpenFlow网络 中不需要单独设置起到网关 /路由功能的交换机的效果。 实施例十 In summary, the controller provided in this embodiment obtains network information of the first host and the second host by implementing the ARP function of the first gateway and the second gateway, according to the first host and the pre-stored The information about the subnet where the second host is located and the corresponding gateway information and the obtained network information of the first host and the second host determine a forwarding path, so that all switches in the Open Flow network can implement a simple forwarding function. Resolved a dedicated in the OpenFlow network The OpenFlow switch cannot implement the problem of the gateway/routing function, and the effect of the switch that does not need to be separately set to the gateway/routing function in the OpenFlow network is achieved. Example ten
请参考图 12, 其示出了本发明实施例十提供的控制器的结构方框图。 本 实施例主要以该控制器应用于图 6所示的实施环境中来举例说明。 所述控制 器包括: 存储器 1201、 处理器 1202、 发送机 1203和接收机 1204。  Referring to FIG. 12, it shows a structural block diagram of a controller provided in Embodiment 10 of the present invention. This embodiment is mainly illustrated by the application of the controller to the implementation environment shown in FIG. 6. The controller includes: a memory 1201, a processor 1202, a transmitter 1203, and a receiver 1204.
所述存储器 1201, 用于预先存储所述第一主机 640和所述第二主机 642 所在子网的网关、 网络号和子网掩码, 以及所述第一代理设备和所述第二代 理设备的 MAC地址。  The memory 1201 is configured to pre-store a gateway, a network number, and a subnet mask of a subnet where the first host 640 and the second host 642 are located, and the first proxy device and the second proxy device. MAC address.
所述处理器 1202, 用于通过接收到的第一 ARP请求获取第一主机 640 的网络信息, 所述第一 ARP请求是由所述第一主机 640发送的、 且与所述第 一主机 640 相连的交换机无法查找到转发流表后转发给所述控制器 620 的 ARP请求。  The processor 1202 is configured to acquire network information of the first host 640 by using the received first ARP request, where the first ARP request is sent by the first host 640 and is related to the first host 640 The connected switch cannot find the ARP request forwarded to the controller 620 after forwarding the flow table.
具体的讲, 所述处理器 1202, 具体用于控制所述接收机 1204接收所述 第一主机 640发送的所述第一 ARP请求; 所述处理器 1202, 还具体用于通 过所述接收机 1204接收到的第一 ARP请求获取第一主机 440的网络信息。  Specifically, the processor 1202 is specifically configured to control the receiver 1204 to receive the first ARP request sent by the first host 640. The processor 1202 is further configured to pass the receiver. The received first ARP request of 1204 acquires network information of the first host 440.
所述发送机 1203,用于通过与所述第一主机 640相连的交换机向所述第 一主机 640反馈第一 ARP响应, 所述第一 ARP响应中的源 MAC地址为第 一代理设备的 MAC地址, 源 IP地址为第二主机的 IP地址, 以便所述第一主 机 640将所述第一代理设备的 MAC地址作为第二主机 642的 MAC地址,所 述第一代理设备为对应于所述第一主机 640所在子网内的代理设备。  The transmitter 1203 is configured to feed back, by the switch connected to the first host 640, the first ARP response to the first host 640, where the source MAC address in the first ARP response is the MAC address of the first proxy device. The address, the source IP address is the IP address of the second host, so that the first host 640 uses the MAC address of the first proxy device as the MAC address of the second host 642, and the first proxy device corresponds to the The proxy device in the subnet where the first host 640 is located.
所述处理器 1202, 还用于通过构造第二 ARP请求获取第二主机 642的 网络信息。  The processor 1202 is further configured to acquire network information of the second host 642 by constructing a second ARP request.
具体的讲, 所述处理器 1202, 具体用于控制所述接收机 1204接收所述 第一主机 640发送的数据包,所述数据包的目的 MAC地址为所述第一代理设 备的 MAC地址, 目的 IP地址为所述第二主机 642的 IP地址; 所述处理器 1202, 还具体用于根据所述接收机 1204接收到的数据包中的第二主机 642 的 IP地址构造第二 ARP请求, 所述第二 ARP请求的源 MAC地址为第二代 理设备的 MAC地址, 源 IP地址为所述第一主机 640的 IP地址, 目的 IP地 址为所述第二主机 642的 IP地址,以便所述第二主机 642将所述第二代理设 备的 MAC地址作为所述第一主机 640的 MAC地址, 所述第二代理设备为对 应于所述第二主机 642所在子网内的代理设备; 所述处理器 1202, 还具体用 于控制所述发送机 1203通过所述第二主机 642所在子网内的交换机将所述第 二 ARP请求发送给所述第二主机 642所在子网内的所有主机; 所述处理器 1202,还具体用于控制所述接收机 1204根据所述存储器 1201预先存储的第 二主机 642所在子网的网关、 网络号和子网掩码, 通过与所述第二主机 642 相连的交换机接收所述第二主机 642反馈的第二 ARP响应, 所述第二 ARP 响应的源 MAC地址和源 IP地址分别为所述第二主机 642的 MAC地址 IP地 址; 所述处理器 1202, 还具体用于根据所述接收机 1204接收到的第二 ARP 响应获取所述第二主机 642的网络信息。 Specifically, the processor 1202 is specifically configured to control the receiver 1204 to receive a data packet sent by the first host 640, where a destination MAC address of the data packet is a MAC address of the first proxy device, The destination IP address is the IP address of the second host 642. The processor 1202 is further configured to use the second host 642 in the data packet received by the receiver 1204. The IP address of the second ARP request is configured, the source MAC address of the second ARP request is the MAC address of the second proxy device, the source IP address is the IP address of the first host 640, and the destination IP address is the second The IP address of the host 642, so that the second host 642 uses the MAC address of the second proxy device as the MAC address of the first host 640, and the second proxy device corresponds to the second host 642. The proxy device in the subnet; the processor 1202 is further configured to control the sender 1203 to send the second ARP request to the second host by using a switch in a subnet where the second host 642 is located The processor 1202 is further configured to control, according to the gateway, the network number, and the subnet mask of the subnet where the second host 642 is pre-stored by the receiver 1204 according to the memory 1201. The second ARP response fed back by the second host 642 is received by the switch connected to the second host 642, where the source MAC address and the source IP address of the second ARP response are respectively the MAC address of the second host 642. IP address; Processor 1202 is also configured to acquire the second host network response information 642 according to the second ARP received by the receiver 1204.
所述处理器 1202,还用于根据所述获取到的第一主机 640的网络信息和 所述获取到的第二主机 642的网络信息决策生成所述第一主机 640和所述第 二主机 642之间的转发路径。  The processor 1202 is further configured to generate the first host 640 and the second host 642 according to the acquired network information of the first host 640 and the acquired network information of the second host 642. The forwarding path between.
具体的讲, 所述处理器 1202, 具体用于根据所述获取到的第一主机 640 的网络信息和所述获取到的第二主机 642的网络信息计算所述第一主机 640 和所述第二主机 642之间的最短转发路径; 将所述最短转发路径作为所述第 一主机 640和所述第二主机 642之间的转发路径; 或者, 所述处理器 1202, 还具体用于根据所述获取到的第一主机 640的网络信息和所述获取到的第二 主机 642的网络信息计算所述第一主机 640和所述第二主机 642之间的最优 转发路径; 将所述最优转发路径作为所述第一主机 640和所述第二主机 642 之间的转发路径。  Specifically, the processor 1202 is specifically configured to calculate, according to the acquired network information of the first host 640 and the acquired network information of the second host 642, the first host 640 and the first The shortest forwarding path between the two hosts 642; the shortest forwarding path is used as a forwarding path between the first host 640 and the second host 642; or the processor 1202 is further configured to be used according to the Calculating the optimal forwarding path between the first host 640 and the second host 642 by calculating the obtained network information of the first host 640 and the acquired network information of the second host 642; The forwarding path is used as a forwarding path between the first host 640 and the second host 642.
所述发送机 1203, 还用于向所述处理器 1202生成的转发路径上的每个 交换机下发转发流表, 以便所述转发路径上的每个交换机根据所述转发流表 在所述第一主机 640和所述第二主机 642之间转发数据包。  The transmitter 1203 is further configured to send, to each switch on the forwarding path generated by the processor 1202, a forwarding flow table, so that each switch on the forwarding path is in the foregoing according to the forwarding flow table. A data packet is forwarded between a host 640 and the second host 642.
综上所述, 本实施例提供的控制器, 通过实现第一代理设备和第二代理 设备的代理 ARP功能, 获取第一主机和第二主机的网络信息, 根据预先存储 的所述第一主机和所述第二主机所在子网的信息和相应的网关信息和获取到 的第一主机和第二主机的网络信息决策生成转发路径, 使得 OpenFlow 网络 中的所有交换机只要实现简单的转发功能即可, 从而解决了 OpenFlow 网络 中的专用的 OpenFlow 交换机无法实现该网关 /路由功能的问题, 达到了 OpenFlow网络中不需要单独设置起到网关 /路由功能的交换机的效果。 In summary, the controller provided in this embodiment implements the first proxy device and the second proxy. The proxy ARP function of the device acquires network information of the first host and the second host, according to pre-stored information of the first host and the second host where the second host is located, and corresponding gateway information and the obtained first host The network information of the second host determines the forwarding path, so that all the switches in the OpenFlow network can implement the simple forwarding function, thereby solving the problem that the dedicated OpenFlow switch in the OpenFlow network cannot implement the gateway/routing function. There is no need to separately set the effect of the switch functioning as a gateway/routing function in the OpenFlow network.
上述本发明实施例序号仅仅为了描述, 不代表实施例的优劣。  The serial numbers of the embodiments of the present invention are merely for the description, and do not represent the advantages and disadvantages of the embodiments.
本领域普通技术人员可以理解实现上述实施例的全部或部分步骤可以通 过硬件来完成, 也可以通过程序来指令相关的硬件完成, 所述的程序可以存 储于一种计算机可读存储介质中, 上述提到的存储介质可以是只读存储器, 磁盘或光盘等。  A person skilled in the art may understand that all or part of the steps of implementing the above embodiments may be completed by hardware, or may be instructed by a program to execute related hardware, and the program may be stored in a computer readable storage medium. The storage medium mentioned may be a read only memory, a magnetic disk or an optical disk or the like.
以上所述仅为本发明的较佳实施例, 并不用以限制本发明, 凡在本发明 的精神和原则之内, 所作的任何修改、 等同替换、 改进等, 均应包含在本发 明的保护范围之内。  The above is only the preferred embodiment of the present invention, and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc., which are within the spirit and scope of the present invention, should be included in the protection of the present invention. Within the scope.

Claims

权利要求 书 claims
1、 一种转发路径的生成方法, 其特征在于, 用于包括控制器和至少一个交 换机的 OpenFlow网络中, 所述方法包括: 1. A method for generating a forwarding path, characterized in that it is used in an OpenFlow network including a controller and at least one switch, and the method includes:
控制器通过接收到的第一 ARP请求获取第一主机的网络信息, 所述第一 ARP请求是由所述第一主机发送的、 且与所述第一主机相连的交换机无法查找 到转发流表后转发给所述控制器的 ARP请求; The controller obtains the network information of the first host through the received first ARP request. The first ARP request is sent by the first host and the switch connected to the first host cannot find the forwarding flow table. and then forward the ARP request to the controller;
所述控制器通过构造第二 ARP请求获取第二主机的网络信息; The controller obtains the network information of the second host by constructing a second ARP request;
所述控制器根据所述第一主机的网络信息和所述第二主机的网络信息决策 生成所述第一主机和所述第二主机之间的转发路径; The controller decides to generate a forwarding path between the first host and the second host based on the network information of the first host and the network information of the second host;
所述控制器向所述转发路径上的每个交换机下发转发流表, 以便所述转发 路径上的每个交换机根据所述转发流表在所述第一主机和所述第二主机之间转 发数据包。 The controller delivers a forwarding flow table to each switch on the forwarding path, so that each switch on the forwarding path communicates between the first host and the second host according to the forwarding flow table. Forward the packet.
2、 根据权利要求 1所述的方法, 其特征在于, 若所述第一 ARP请求中的 目的 IP地址是第一网关的 IP地址, 所述第一网关是所述第一主机的配置网关, 则所述通过接收到的第一 ARP请求获取第一主机的网络信息之后, 还包括: 所述控制器通过与所述第一主机相连的交换机向所述第一主机反馈第一 ARP响应,所述第一 ARP响应中的源 MAC地址和源 IP地址分别为所述第一网 关的 MAC地址和 IP地址。 2. The method according to claim 1, characterized in that, if the destination IP address in the first ARP request is the IP address of the first gateway, and the first gateway is the configuration gateway of the first host, Then, after obtaining the network information of the first host through the received first ARP request, it further includes: the controller feeds back the first ARP response to the first host through the switch connected to the first host, so The source MAC address and source IP address in the first ARP response are the MAC address and IP address of the first gateway respectively.
3、 根据权利要求 2 所述的方法, 其特征在于, 所述控制器通过构造第二 ARP请求获取第二主机的网络信息, 包括: 3. The method according to claim 2, wherein the controller obtains the network information of the second host by constructing a second ARP request, including:
所述控制器接收所述第一主机发送的数据包,所述数据包的目的 MAC地址 为所述第一网关的 MAC地址, 目的 IP地址为所述第二主机的 IP地址; The controller receives the data packet sent by the first host, the destination MAC address of the data packet is the MAC address of the first gateway, and the destination IP address is the IP address of the second host;
所述控制器根据所述第二主机的 IP地址构造第二 ARP请求,所述第二 ARP 请求的源 MAC地址和源 IP地址分别为第二网关的 MAC地址和 IP地址, 目的 IP地址为所述第二主机的 IP地址, 所述第二网关为所述第二主机的配置网关; 所述控制器通过所述第二主机所在子网内的交换机将所述第二 ARP请求发 送给所述第二主机所在子网内的所有主机; The controller constructs a second ARP request according to the IP address of the second host. The source MAC address and source IP address of the second ARP request are the MAC address and IP address of the second gateway respectively, and the destination IP address is the The IP address of the second host, the second gateway is the configuration gateway of the second host; the controller sends the second ARP request to the second host through the switch in the subnet where the second host is located. All hosts in the subnet where the second host is located;
所述控制器通过与所述第二主机相连的交换机接收所述第二主机反馈的第 二 ARP响应, 所述第二 ARP响应的源 MAC地址和源 IP地址分别为所述第二 主机的 MAC地址和 IP地址。 The controller receives the second feedback from the second host through a switch connected to the second host. Two ARP responses, the source MAC address and the source IP address of the second ARP response are the MAC address and IP address of the second host respectively.
4、 根据权利要求 3所述的方法, 其特征在于, 所述控制器通过接收到的第 一 ARP请求获取第一主机的网络信息之前, 还包括: 4. The method according to claim 3, wherein before the controller obtains the network information of the first host through the received first ARP request, it further includes:
所述控制器预先存储所述第一主机和所述第二主机所在子网的网关、 网络 号和子网掩码, 以及所述第一网关和所述第二网关的 MAC地址和 IP地址; 所述控制器通过所述第二主机所在子网的交换机将所述第二 ARP请求发送 给所述第二主机所在子网内的所有主机, 包括; The controller pre-stores the gateway, network number and subnet mask of the subnet where the first host and the second host are located, as well as the MAC address and IP address of the first gateway and the second gateway; The controller sends the second ARP request to all hosts in the subnet where the second host is located through the switch of the subnet where the second host is located, including;
所述控制器根据所述第二主机所在子网的网关、 网络号和子网掩码将所述 第二 ARP请求发送给所述第二主机所在子网内的所有主机。 The controller sends the second ARP request to all hosts in the subnet where the second host is located based on the gateway, network number and subnet mask of the subnet where the second host is located.
5、 根据权利要求 1所述的方法, 其特征在于, 若所述第一 ARP请求中的 目的 IP地址是所述第二主机的 IP地址, 则所述通过接收到的第一 ARP请求获 取第一主机的网络信息之后, 还包括: 5. The method according to claim 1, characterized in that, if the destination IP address in the first ARP request is the IP address of the second host, then the first ARP request received is obtained. After the network information of a host, it also includes:
所述控制器通过与所述第一主机相连的交换机向所述第一主机反馈第一 ARP响应,所述第一 ARP响应中的源 MAC地址为第一代理设备的 MAC地址, 源 IP地址为所述第二主机的 IP地址,以便所述第一主机将所述第一代理设备的 MAC地址作为所述第二主机的 MAC地址, 所述第一代理设备为对应于所述第 一主机所在子网内的代理设备。 The controller feeds back a first ARP response to the first host through a switch connected to the first host. The source MAC address in the first ARP response is the MAC address of the first proxy device, and the source IP address is The IP address of the second host, so that the first host uses the MAC address of the first proxy device as the MAC address of the second host, and the first proxy device is located corresponding to the location of the first host. Proxy device within the subnet.
6、 根据权利要求 5 所述的方法, 其特征在于, 所述控制器通过构造第二 ARP请求获取第二主机的网络信息, 包括: 6. The method according to claim 5, wherein the controller obtains the network information of the second host by constructing a second ARP request, including:
所述控制器接收所述第一主机发送的数据包,所述数据包的目的 MAC地址 为所述第一代理设备的 MAC地址, 目的 IP地址为所述第二主机的 IP地址; 所述控制器根据所述第二主机的 IP地址构造第二 ARP请求,所述第二 ARP 请求的源 MAC地址为第二代理设备的 MAC地址, 源 IP地址为所述第一主机 的 IP地址, 目的 IP地址为所述第二主机的 IP地址, 以便所述第二主机将所述 第二代理设备的 MAC地址作为所述第一主机的 MAC地址, 所述第二代理设备 为对应于所述第二主机所在子网内的代理设备; 所述控制器通过所述第二主机所在子网内的交换机将所述第二 ARP请求发 送给所述第二主机所在子网内的所有主机; The controller receives the data packet sent by the first host, the destination MAC address of the data packet is the MAC address of the first proxy device, and the destination IP address is the IP address of the second host; the control The device constructs a second ARP request according to the IP address of the second host, the source MAC address of the second ARP request is the MAC address of the second proxy device, the source IP address is the IP address of the first host, and the destination IP The address is the IP address of the second host, so that the second host uses the MAC address of the second proxy device as the MAC address of the first host, and the second proxy device is the IP address corresponding to the second host. The proxy device in the subnet where the host is located; The controller sends the second ARP request to all hosts in the subnet where the second host is located through the switch in the subnet where the second host is located;
所述控制器通过与所述第二主机相连的交换机接收所述第二主机反馈的第 二 ARP响应, 所述第二 ARP响应的源 MAC地址和源 IP地址分别为所述第二 主机的 MAC地址 IP地址。 The controller receives a second ARP response fed back by the second host through a switch connected to the second host. The source MAC address and source IP address of the second ARP response are respectively the MAC of the second host. Address IP address.
7、 根据权利要求 6所述的方法, 其特征在于, 所述控制器通过接收到的第 一 ARP请求获取第一主机的网络信息之前, 还包括: 7. The method according to claim 6, wherein before the controller obtains the network information of the first host through the received first ARP request, it further includes:
所述控制器预先存储所述第一主机和所述第二主机所在子网的网关、 网络 号和子网掩码, 以及所述第一代理设备和所述第二代理设备的 MAC地址; 所述控制器通过所述第二主机所在子网的交换机将所述第二 ARP请求发送 给所述第二主机所在子网内的所有主机, 包括; The controller pre-stores the gateway, network number and subnet mask of the subnet where the first host and the second host are located, as well as the MAC addresses of the first proxy device and the second proxy device; The controller sends the second ARP request to all hosts in the subnet where the second host is located through the switch in the subnet where the second host is located, including;
所述控制器根据所述第二主机所在子网的网关、 网络号和子网掩码将所述 第二 ARP请求发送给所述第二主机所在子网内的所有主机。 The controller sends the second ARP request to all hosts in the subnet where the second host is located based on the gateway, network number and subnet mask of the subnet where the second host is located.
8、 根据权利要求 1至 7任一所述的方法, 其特征在于, 所述根据所述第一 主机的网络信息和所述第二主机的网络信息决策生成所述第一主机和所述第二 主机之间的转发路径, 包括: 8. The method according to any one of claims 1 to 7, characterized in that: the decision to generate the first host and the second host is based on the network information of the first host and the network information of the second host. The forwarding path between the two hosts includes:
根据所述第一主机的网络信息和所述第二主机的网络信息计算所述第一主 机和所述第二主机之间的最短转发路径; 将所述最短转发路径作为所述第一主 机和所述第二主机之间的转发路径; Calculate the shortest forwarding path between the first host and the second host according to the network information of the first host and the network information of the second host; use the shortest forwarding path as the first host and the second host. The forwarding path between the second hosts;
或者; or;
根据所述第一主机的网络信息和所述第二主机的网络信息计算所述第一主 机和所述第二主机之间的最优转发路径; 将所述最优转发路径作为所述第一主 机和所述第二主机之间的转发路径。 Calculate the optimal forwarding path between the first host and the second host according to the network information of the first host and the network information of the second host; use the optimal forwarding path as the first The forwarding path between the host and the second host.
9、 一种控制器, 其特征在于, 用于包括至少一个交换机的 OpenFlow网络 中, 所述控制器, 包括: 9. A controller, characterized in that it is used in an OpenFlow network including at least one switch, and the controller includes:
第一信息获取模块, 用于通过接收到的第一 ARP请求获取第一主机的网络 信息, 所述第一 ARP请求是由所述第一主机发送的、 且与所述第一主机相连的 交换机无法查找到转发流表后转发给所述控制器的 ARP请求; A first information acquisition module, configured to obtain the network information of the first host through the received first ARP request, the first ARP request being sent by the first host and connected to the first host The switch cannot find the forwarding flow table and forward the ARP request to the controller;
第二信息获取模块,用于通过构造第二 ARP请求获取第二主机的网络信息; 路径生成模块, 用于根据所述第一信息获取模块获取到的第一主机的网络 信息和所述第二信息获取模块获取到的第二主机的网络信息决策生成所述第一 主机和所述第二主机之间的转发路径; The second information acquisition module is used to obtain the network information of the second host by constructing a second ARP request; the path generation module is used to obtain the network information of the first host and the second host according to the first information acquisition module. The network information decision of the second host obtained by the information acquisition module generates a forwarding path between the first host and the second host;
流表下发模块, 用于向所述路径生成模块生成的转发路径上的每个交换机 下发转发流表, 以便所述转发路径上的每个交换机根据所述转发流表在所述第 一主机和所述第二主机之间转发数据包。 A flow table delivery module, configured to deliver a forwarding flow table to each switch on the forwarding path generated by the path generation module, so that each switch on the forwarding path generates a forwarding flow table in the first step according to the forwarding flow table. Data packets are forwarded between the host and the second host.
10、 根据权利要求 9所述的控制器, 其特征在于, 若所述第一 ARP请求中 的目的 IP地址是第一网关的 IP地址,所述第一网关是所述第一主机的配置网关, 所述控制器, 还包括: 10. The controller according to claim 9, wherein if the destination IP address in the first ARP request is the IP address of the first gateway, the first gateway is the configuration gateway of the first host. , the controller also includes:
第一反馈模块, 用于通过与所述第一主机相连的交换机向所述第一主机反 馈第一 ARP响应, 所述第一 ARP响应中的源 MAC地址和源 IP地址分别为所 述第一网关的 MAC地址和 IP地址。 A first feedback module, configured to feed back a first ARP response to the first host through a switch connected to the first host, where the source MAC address and source IP address in the first ARP response are respectively the first The MAC address and IP address of the gateway.
11、根据权利要求 10所述的控制器, 其特征在于, 所述第二信息获取模块, 包括: 11. The controller according to claim 10, characterized in that the second information acquisition module includes:
第一接收单元, 用于接收所述第一主机发送的数据包, 所述数据包的目的 MAC地址为所述第一网关的 MAC地址, 目的 IP地址为所述第二主机的 IP地 址; The first receiving unit is used to receive the data packet sent by the first host, the destination MAC address of the data packet is the MAC address of the first gateway, and the destination IP address is the IP address of the second host;
第一构造单元, 用于根据所述第一接收单元接收到的数据包中的第二主机 的 IP地址构造第二 ARP请求, 所述第二 ARP请求的源 MAC地址和源 IP地址 分别为第二网关的 MAC地址和 IP地址, 目的 IP地址为所述第二主机的 IP地 址, 所述第二网关为所述第二主机的配置网关; A first construction unit configured to construct a second ARP request based on the IP address of the second host in the data packet received by the first receiving unit, where the source MAC address and source IP address of the second ARP request are respectively the first The MAC address and IP address of the second gateway, the destination IP address is the IP address of the second host, and the second gateway is the configuration gateway of the second host;
第一发送单元, 用于通过所述第二主机所在子网内的交换机将所述第一构 造单元构造的第二 ARP请求发送给所述第二主机所在子网内的所有主机; The first sending unit is configured to send the second ARP request constructed by the first construction unit to all hosts in the subnet where the second host is located through the switch in the subnet where the second host is located;
第二接收单元, 用于通过与所述第二主机相连的交换机接收所述第二主机 反馈的第二 ARP响应, 所述第二 ARP响应的源 MAC地址和源 IP地址分别为 所述第二主机的 MAC地址和 IP地址。 A second receiving unit configured to receive a second ARP response fed back by the second host through a switch connected to the second host, where the source MAC address and source IP address of the second ARP response are respectively the second The host's MAC address and IP address.
12、 根据权利要求 11所述的控制器, 其特征在于, 所述控制器, 还包括: 第一预先存储模块, 用于预先存储所述第一主机和所述第二主机所在子网 的网关、 网络号和子网掩码, 以及所述第一网关和所述第二网关的 MAC地址和 IP地址; 12. The controller according to claim 11, characterized in that, the controller further includes: a first pre-storage module, configured to pre-store the gateway of the subnet where the first host and the second host are located. , network number and subnet mask, and the MAC address and IP address of the first gateway and the second gateway;
所述第一发送单元, 具体用于根据所述第一预先存储模块预先存储的第二 主机所在子网的网关、 网络号和子网掩码将所述第二 ARP请求发送给所述第二 主机所在子网内的所有主机。 The first sending unit is specifically configured to send the second ARP request to the second host according to the gateway, network number and subnet mask of the subnet where the second host is located pre-stored by the first pre-storage module. All hosts in the subnet.
13、 根据权利要求 9所述的控制器, 其特征在于, 若所述第一 ARP请求中 的目的 IP地址是所述第二主机的 IP地址, 所述控制器, 还包括: 13. The controller according to claim 9, wherein if the destination IP address in the first ARP request is the IP address of the second host, the controller further includes:
第二反馈模块, 用于通过与所述第一主机相连的交换机向所述第一主机反 馈第一 ARP响应,所述第一 ARP响应中的源 MAC地址为第一代理设备的 MAC 地址, 源 IP地址为所述第二主机的 IP地址, 以便所述第一主机将所述第一代理 设备的 MAC地址作为所述第二主机的 MAC地址, 所述第一代理设备为对应于 所述第一主机所在子网内的代理设备。 The second feedback module is configured to feed back a first ARP response to the first host through a switch connected to the first host, where the source MAC address in the first ARP response is the MAC address of the first proxy device, source The IP address is the IP address of the second host, so that the first host uses the MAC address of the first proxy device as the MAC address of the second host, and the first proxy device is corresponding to the first proxy device. A proxy device within the subnet where a host is located.
14、根据权利要求 13所述的控制器, 其特征在于, 所述第二信息获取模块, 包括: 14. The controller according to claim 13, characterized in that the second information acquisition module includes:
第三接收单元, 用于接收所述第一主机发送的数据包, 所述数据包的目的 MAC地址为所述第一代理设备的 MAC地址,目的 IP地址为所述第二主机的 IP 地址; The third receiving unit is configured to receive the data packet sent by the first host, the destination MAC address of the data packet is the MAC address of the first proxy device, and the destination IP address is the IP address of the second host;
第二构造单元, 用于根据所述第三接收单元接收到的数据包中的第二主机 的 IP地址构造第二 ARP请求, 所述第二 ARP请求的源 MAC地址为第二代理 设备的 MAC地址, 源 IP地址为所述第一主机的 IP地址, 目的 IP地址为所述 第二主机的 IP地址, 以便所述第二主机将所述第二代理设备的 MAC地址作为 所述第一主机的 MAC地址,所述第二代理设备为对应于所述第二主机所在子网 内的代理设备; A second construction unit configured to construct a second ARP request based on the IP address of the second host in the data packet received by the third receiving unit, where the source MAC address of the second ARP request is the MAC of the second proxy device. address, the source IP address is the IP address of the first host, and the destination IP address is the IP address of the second host, so that the second host uses the MAC address of the second proxy device as the first host MAC address, the second proxy device is a proxy device corresponding to the subnet where the second host is located;
第二发送单元, 用于通过所述第二主机所在子网内的交换机将所述第二构 造单元构造的第二 ARP请求发送给所述第二主机所在子网内的所有主机; 第二接收单元, 用于通过与所述第二主机相连的交换机接收所述第二主机 反馈的第二 ARP响应, 所述第二 ARP响应的源 MAC地址和源 IP地址分别为 所述第二主机的 MAC地址 IP地址。 The second sending unit is configured to send the second ARP request constructed by the second construction unit to all hosts in the subnet where the second host is located through the switch in the subnet where the second host is located; A second receiving unit configured to receive a second ARP response fed back by the second host through a switch connected to the second host, where the source MAC address and source IP address of the second ARP response are respectively the second The host's MAC address IP address.
15、 根据权利要求 14所述的控制器, 其特征在于, 所述控制器, 还包括: 第二预先存储模块, 用于预先存储所述第一主机和所述第二主机所在子网 的网关、网络号和子网掩码,以及所述第一代理设备和所述第二代理设备的 MAC 地址; 15. The controller according to claim 14, characterized in that, the controller further includes: a second pre-storage module, configured to pre-store the gateway of the subnet where the first host and the second host are located. , network number and subnet mask, and the MAC addresses of the first proxy device and the second proxy device;
所述第二发送单元, 具体用于根据所述第二预先存储模块预先存储的第二 主机所在子网的网关、 网络号和子网掩码将所述第二 ARP请求发送给所述第二 主机所在子网内的所有主机。 The second sending unit is specifically configured to send the second ARP request to the second host according to the gateway, network number and subnet mask of the subnet where the second host is located pre-stored by the second pre-storage module. All hosts in the subnet.
16、 根据权利要求 9至 15任一所述的控制器, 其特征在于, 所述路径生成 模块, 包括: 16. The controller according to any one of claims 9 to 15, characterized in that the path generation module includes:
最短生成单元, 用于根据所述第一信息获取模块获取到的第一主机的网络 信息和所述第二信息获取模块获取到的第二主机的网络信息计算所述第一主机 和所述第二主机之间的最短转发路径; 将所述最短转发路径作为所述第一主机 和所述第二主机之间的转发路径; The shortest generation unit is configured to calculate the first host and the third host according to the network information of the first host acquired by the first information acquisition module and the network information of the second host acquired by the second information acquisition module. The shortest forwarding path between two hosts; using the shortest forwarding path as the forwarding path between the first host and the second host;
或者; or;
最优生成单元, 用于根据所述第一信息获取模块获取到的第一主机的网络 信息和所述第二信息获取模块获取到的第二主机的网络信息计算所述第一主机 和所述第二主机之间的最优转发路径; 将所述最优转发路径作为所述第一主机 和所述第二主机之间的转发路径。 The optimal generation unit is configured to calculate the first host and the first host according to the network information of the first host acquired by the first information acquisition module and the network information of the second host acquired by the second information acquisition module. The optimal forwarding path between the second hosts; using the optimal forwarding path as the forwarding path between the first host and the second host.
17、 一种转发路径的生成系统, 其特征在于, 所述系统包括如权利要求 9 至 16任一所述的控制器、 第一主机和第二主机。 。 17. A forwarding path generation system, characterized in that the system includes the controller according to any one of claims 9 to 16, a first host and a second host. .
PCT/CN2014/075149 2013-04-22 2014-04-11 Forwarding path generating method, controller, and system WO2014173235A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201310140475.6 2013-04-22
CN201310140475.6A CN104113474B (en) 2013-04-22 2013-04-22 Generation method, controller and the system of forward-path

Publications (1)

Publication Number Publication Date
WO2014173235A1 true WO2014173235A1 (en) 2014-10-30

Family

ID=51710110

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2014/075149 WO2014173235A1 (en) 2013-04-22 2014-04-11 Forwarding path generating method, controller, and system

Country Status (2)

Country Link
CN (1) CN104113474B (en)
WO (1) WO2014173235A1 (en)

Families Citing this family (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105847161B (en) * 2015-01-15 2019-07-23 南宁富桂精密工业有限公司 It controls equipment and its controls the method that interchanger updates flow table
CN107181681B (en) * 2016-03-10 2022-02-25 中兴通讯股份有限公司 SDN two-layer forwarding method and system
CN107465770B (en) * 2017-08-07 2022-04-15 刘昱 SDN network and non-SDN network communication method and device
CN107404546B (en) * 2017-08-07 2022-10-14 刘昱 Communication method and device in SDN network
CN114172750B (en) * 2022-02-14 2022-05-13 南京易科腾信息技术有限公司 Network communication method, device and storage medium based on encryption mechanism

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102349268A (en) * 2009-03-09 2012-02-08 日本电气株式会社 Openflow communication system and openflow communication method
WO2012137646A1 (en) * 2011-04-04 2012-10-11 日本電気株式会社 Network system, switch, and connection terminal detection method
CN102938794A (en) * 2012-11-14 2013-02-20 华为技术有限公司 Address resolution protocol (ARP) message forwarding method, exchanger and controller

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR100455130B1 (en) * 2000-12-23 2004-11-08 엘지전자 주식회사 Proxy arp operation method using virtual arp packet
US20060209818A1 (en) * 2005-03-18 2006-09-21 Purser Jimmy R Methods and devices for preventing ARP cache poisoning
CN101072238A (en) * 2007-07-09 2007-11-14 中兴通讯股份有限公司 Method for realizing identical subnet communication for MPLS three-layer virtual special net
CN101383835B (en) * 2008-10-21 2011-07-27 杭州华三通信技术有限公司 Method and device for implementing server safe isolation
WO2012033041A1 (en) * 2010-09-09 2012-03-15 日本電気株式会社 Computer system and communication method in computer system

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102349268A (en) * 2009-03-09 2012-02-08 日本电气株式会社 Openflow communication system and openflow communication method
WO2012137646A1 (en) * 2011-04-04 2012-10-11 日本電気株式会社 Network system, switch, and connection terminal detection method
CN102938794A (en) * 2012-11-14 2013-02-20 华为技术有限公司 Address resolution protocol (ARP) message forwarding method, exchanger and controller

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
CHANG, HE ET AL.: "An Implement of Cross-network Transmission Based on OpenFlow", SCIENCEPAPER, 13 July 2011 (2011-07-13), Retrieved from the Internet <URL:http://www.paper.edu.cn/releasepaper/content/201107-194> *

Also Published As

Publication number Publication date
CN104113474A (en) 2014-10-22
CN104113474B (en) 2017-08-29

Similar Documents

Publication Publication Date Title
US8995444B2 (en) Method and system for extending routing domain to non-routing end stations
EP2974133B1 (en) Method and system for controlling an underlying physical network by a software defined network
EP2907279B1 (en) Ensuring any-to-any reachability with opportunistic layer 3 forwarding in massive scale data center environments
JP2017028698A (en) Traffic switching method, device, and system
US20160330167A1 (en) Arp Implementation Method, Switch Device, and Control Device
WO2011120459A2 (en) Message forwarding method, equipment and network device
WO2015180084A1 (en) Packet forwarding method and vxlan gateway
JP6570740B2 (en) Cluster communication
WO2008077333A1 (en) A method, a system and a router for implementing communication between the ip devices
JP2012217178A5 (en)
CN101043430B (en) Method for converting network address between equipments
JP3813571B2 (en) Border router device, communication system, routing method, and routing program
WO2012075731A1 (en) Method and device for link fault detecting and recovering based on arp interaction
WO2014173235A1 (en) Forwarding path generating method, controller, and system
CN101257447A (en) Method, system and routing apparatus of load sharing
WO2012130083A1 (en) Address resolution protocol (arp) table entry configuration method and device
CN102801623A (en) Multi-access data transmitting method and device
JP2007208818A (en) Multi-home connection method and device
US9755939B2 (en) Network wide source group tag binding propagation
US20160218958A1 (en) Method and system for forwarding packet in id/locator separation environment
WO2013152496A1 (en) Information receiving and sending methods and apparatuses
WO2012041168A1 (en) Processing method for network connection for ipv6 network and device thereof
WO2009121265A1 (en) A method and equipment for implementing traffic engineering in a multi-homing and multi-address space network
WO2015010532A1 (en) Route table entries generating method and border gateway protocol speaker
WO2015100551A1 (en) Information transmission method, device and system

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

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

Country of ref document: EP

Kind code of ref document: A1