CN117651001A - Method and device for detecting direct connection equipment by switch, equipment and medium - Google Patents

Method and device for detecting direct connection equipment by switch, equipment and medium Download PDF

Info

Publication number
CN117651001A
CN117651001A CN202311772005.1A CN202311772005A CN117651001A CN 117651001 A CN117651001 A CN 117651001A CN 202311772005 A CN202311772005 A CN 202311772005A CN 117651001 A CN117651001 A CN 117651001A
Authority
CN
China
Prior art keywords
address
direct
switch
port
direct connection
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202311772005.1A
Other languages
Chinese (zh)
Inventor
杨巡
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Kyland Technology Co Ltd
Original Assignee
Kyland Technology Co Ltd
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 Kyland Technology Co Ltd filed Critical Kyland Technology Co Ltd
Priority to CN202311772005.1A priority Critical patent/CN117651001A/en
Publication of CN117651001A publication Critical patent/CN117651001A/en
Pending legal-status Critical Current

Links

Abstract

The application provides a method, a device, equipment and a medium for detecting direct-connected equipment by a switch, wherein the method comprises the following steps: setting an IP address segment to which the direct-connected equipment belongs according to an IP address estimated range of the direct-connected equipment, wherein the IP address estimated range and the IP address of the switch are in the same network segment; sequentially sending detection messages to the set IP address field through at least one port of the switch, and receiving response messages of the port in the set detection time; and constructing a corresponding network table item according to the response message, and acquiring the identity information of the direct-connected equipment according to the network table item, wherein the identity information comprises at least one of an MAC address, an IP address and port information. The method and the device solve the problem that the direct-connection equipment which cannot actively send the message can normally send and receive the message, so that the switch can detect the direct-connection equipment of all ports, and reliable guarantee is provided for network management.

Description

Method and device for detecting direct connection equipment by switch, equipment and medium
Technical Field
The present invention relates to the field of network link detection technologies, and in particular, to a method, an apparatus, a device, and a medium for detecting a direct connection device by using a switch.
Background
When the two-layer switch normally accesses the direct-connection equipment, the direct-connection equipment should actively send a message, the switch port adds the message into an FDB (Forwarding Data Base ) table entry after receiving the message, and then acquires the MAC address information of the direct-connection equipment by inquiring the FDB table entry; when the IP address information of the direct-connected device needs to be queried, the switch generally needs to query an ARP (Address Resolution Protocol ) table entry, but only when an ARP Request message is sent and an ARP Reply message is obtained, the ARP table entry can be constructed, and the ARP Request message needs to be sent by the destination IP address, so that the direct-connected device usually needs to actively send the ARP Request message when the direct-connected device IP address information is obtained.
When the direct connection device of the two-layer switch does not actively send a message, the switch cannot construct a corresponding FDB table entry and an ARP table entry, cannot acquire information such as an MAC address, an IP address, a connection port and the like of the direct connection device, and can judge whether the direct connection device can normally send and receive the message, so that the direct connection device cannot be detected under normal conditions and can correctly send the message to the direct connection device.
In addition, the two-layer switch cannot transmit and receive ARP messages across network segments, if the direct connection equipment and the switch are not in the same network segment, the direct connection equipment information cannot be normally detected, only ARP table entries are queried, and the port connected with the equipment cannot be obtained.
Disclosure of Invention
In view of this, the application provides a method, a device, equipment and a medium for detecting direct-connected equipment by a switch, which solve the problem that the direct-connected equipment can not actively send a message to receive and send the message normally, so that the switch can detect the direct-connected equipment of all ports, and provide reliable guarantee for network management.
In a first aspect, the present application provides a method for detecting a direct connection device by a switch, including:
setting an IP address segment to which the direct-connected equipment belongs according to an IP address estimated range of the direct-connected equipment, wherein the IP address estimated range and the IP address of the switch are in the same network segment;
sequentially sending detection messages to the set IP address field through at least one port of the switch, and receiving response messages of the port in the set detection time;
and constructing a corresponding network table item according to the response message, and acquiring the identity information of the direct-connected equipment according to the network table item, wherein the identity information comprises at least one of an MAC address, an IP address and port information.
In the method for detecting the direct-connection equipment by the switch, because the direct-connection equipment connected with the switch usually has a possible IP address range, the method sets an IP address field to which the direct-connection equipment belongs through the IP address estimated range of the direct-connection equipment, the IP address field comprises a plurality of IP addresses with serial numbers connected, sequentially sends detection messages to the IP address field through at least one port of the switch, receives whether response messages exist in the set detection time or not, and can construct a corresponding network table item when receiving the response messages, and acquire identity information such as the MAC address, the IP address, the port information and the like of the direct-connection equipment according to the network table item, thereby realizing detection and management of the direct-connection equipment on the port. The method and the device solve the problem that the direct-connection equipment which cannot actively send the message can normally send and receive the message, so that the switch can detect the direct-connection equipment of all ports, and reliable guarantee is provided for network management.
Optionally, the direct connection device includes a primary direct connection device and a secondary direct connection device, where the primary direct connection device is a direct connection device whose IP address estimated range and the IP address of the switch are in the same network segment, and the secondary direct connection device is a direct connection device whose IP address estimated range and the IP address of the switch are in different network segments;
when the direct connection device is the secondary direct connection device, before setting an IP address segment to which the direct connection device belongs according to the IP address estimated range of the direct connection device, the method further includes: and configuring the IP address estimated range of the secondary direct-connected equipment so that the IP address estimated range configured by the secondary direct-connected equipment and the IP address of the switch are in the same network segment.
From the above, the direct connection device may include a primary direct connection device and a secondary direct connection device, where the IP address estimated range of the primary direct connection device is in the same network segment with the IP address of the switch, and the IP address estimated range of the secondary direct connection device is in a different network segment with the IP address of the switch.
Optionally, the direct connection device includes a primary direct connection device and a secondary direct connection device, where the primary direct connection device is a direct connection device whose IP address estimated range and the IP address of the switch are in the same network segment, and the secondary direct connection device is a direct connection device whose IP address estimated range and the IP address of the switch are in different network segments;
when the direct connection device is the secondary direct connection device, before setting an IP address segment to which the direct connection device belongs according to the IP address estimated range of the direct connection device, the method further includes:
and configuring the secondary IP address of the switch so that the secondary IP address and the IP address estimated range of the secondary direct-connected equipment are in the same network segment.
From the above, the direct connection device may include a primary direct connection device and a secondary direct connection device, where the IP address estimated range of the primary direct connection device is in the same network segment as the IP address of the switch, and the IP address estimated range of the secondary direct connection device is in a different network segment from the IP address of the switch.
Optionally, sequentially sending, through at least one port of the switch, a detection message to the set IP address field includes:
and detecting the physical state of the port of the switch, determining a first port in a connection state, and sequentially sending detection messages to the set IP address field through the first port.
From the above, the switch can detect the physical state of its port, when detecting that the first port becomes to open (UP) state, can confirm that the first port is connected with the direct-connected device, and this moment this switch can send the detection message to the IP address field that sets for in proper order through this first port to realize the detection of the direct-connected device of this port, through the mode of sending the detection message to the single port, can accomplish the detection of the direct-connected device of port under the prerequisite of saving detection resources.
Optionally, before receiving the reply message of the port in the set detection time, the method further includes:
acquiring the aging time of the network table item;
and setting the set detection time to be smaller than the aging time.
Optionally, the set detection time is half of the aging time of the network entry.
By the above, setting the aging time of the network table entry can prevent the network table entry from occupying resources all the time under the condition of no use, and can be explosively increased along with time, so that the system performance is reduced, the system resources can be saved by setting the aging time of the network table entry, and simultaneously, the condition of missing detection can be avoided while saving the system resources by setting the detection time to be half of the aging time of the network table entry, so that the two detection can be realized before the network table entry ages.
Optionally, the constructing a corresponding network table according to the response message, and acquiring the identity information of the directly connected device according to the network table includes:
and sending the detection messages to the set IP address segment at intervals, receiving response messages fed back by the direct-connected equipment within the set detection time, and updating the network table item according to the response messages.
By the method, the switch can adopt a timing detection mode, sequentially send the detection messages to the set IP address field through at least one port at intervals, receive response messages fed back by the direct-connected equipment in the set detection time, and update the constructed network table item according to the response messages so as to realize timing detection and maintenance management of the direct-connected equipment.
In a second aspect, the present application provides a device for detecting a direct connection device by a switch, where the device includes:
the setting module is used for setting an IP address segment to which the direct-connected equipment belongs according to an IP address estimated range of the direct-connected equipment, wherein the IP address estimated range and the IP address of the switch are in the same network segment;
the communication module is used for sequentially sending detection messages to the set IP address field through at least one port of the switch and receiving response messages of the port in the set detection time;
and the processing module is used for constructing a corresponding network table according to the response message, and acquiring the identity information of the direct-connected equipment according to the network table, wherein the identity information comprises at least one of an MAC address, an IP address and port information.
In a third aspect, the present application provides a computing device comprising:
a processor;
a memory for storing one or more programs;
when the one or more programs are executed by the processor, the processor is caused to implement a method for detecting a direct connection device by a switch as described above.
In a fourth aspect, the present application provides a computer readable storage medium having stored thereon a computer program which, when executed by a computer, implements a method for detecting a direct connection device by a switch as described above.
These and other aspects of the application will be apparent from and elucidated with reference to the embodiment(s) described hereinafter.
Drawings
Fig. 1 is a flowchart of a method for detecting a direct-connected device by a switch according to an embodiment of the present application;
fig. 2 is a block diagram of a detection apparatus for a switch to direct connection device according to an embodiment of the present application;
fig. 3 is a block diagram of a computing device according to an embodiment of the present application.
It should be understood that in the foregoing structural schematic diagrams, the sizes and forms of the respective block diagrams are for reference only and should not constitute an exclusive interpretation of the embodiments of the present application. The relative positions and inclusion relationships between the blocks presented by the structural diagrams are merely illustrative of structural relationships between the blocks, and are not limiting of the physical connection of the embodiments of the present application.
Detailed Description
The technical scheme provided by the application is further described below by referring to the accompanying drawings and examples. It should be understood that the system structures and service scenarios provided in the embodiments of the present application are mainly for illustrating possible implementations of the technical solutions of the present application, and should not be construed as the only limitation of the technical solutions of the present application. As one of ordinary skill in the art can know, with the evolution of the system structure and the appearance of new service scenarios, the technical scheme provided in the application is applicable to similar technical problems.
Unless defined otherwise, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs. If there is a discrepancy, the meaning described in the present specification or the meaning obtained from the content described in the present specification is used. In addition, the terminology used herein is for the purpose of describing embodiments of the present application only and is not intended to be limiting of the present application.
The embodiment of the application provides a method for detecting direct-connected equipment by a switch, which solves the problem that the direct-connected equipment can not actively send messages and normally receives and sends the messages, so that the switch can detect the direct-connected equipment of all ports and provide reliable guarantee for network management.
Fig. 1 is a flowchart of a method for detecting a direct connection device by a switch according to an embodiment of the present application, where the method may be performed by the switch or a detection device connected to the switch, and the switch may be, for example, a two-layer switch belonging to a data link layer, may identify MAC address information in a data frame, forward according to the MAC address, and record the MAC addresses and corresponding ports in an address table in the switch. Referring to fig. 1, the method includes:
s110: and setting an IP address segment to which the direct-connected equipment belongs according to an IP address estimated range of the direct-connected equipment, wherein the IP address estimated range and the IP address of the switch are in the same network segment.
In this step, when the direct connection device is connected to the switch, there is generally a general IP address distribution range, that is, a part of the front IP address of the direct connection device is fixed, and only the last part of the number is allocated and generated, so when the main IP address of the switch and the estimated IP address range of the direct connection device are in the same network segment, the switch can set an IP address segment to which the direct connection device belongs according to the estimated IP address range of the direct connection device, where the IP address segment includes a plurality of IP addresses with serial numbers connected, and the IP addresses allocated to the direct connection device connected to the switch are covered, and by sequentially sending detection messages to the plurality of IP addresses, it is possible to implement that the detection messages can be sent to the direct connection device even if the specific IP address of the direct connection device is not determined.
In general, a switch can only use one IP address to communicate under the same VLAN, but in some embodiments, the direct-connected devices may include a primary direct-connected device and a secondary direct-connected device, where the primary direct-connected device is a direct-connected device whose IP address estimated range is in the same network segment as the primary IP address of the switch, and the secondary direct-connected device is a direct-connected device whose IP address estimated range is in a different network segment from the primary IP address of the switch, where the switch may use its primary IP address, and send detection messages to a set IP address segment sequentially through its port, so as to implement detection of the primary direct-connected device in the same network segment.
However, for secondary direct-connected devices that are in a different network segment than the primary IP address of the switch, the embodiments of the present application may implement device detection across network segments of the switch in two ways. One implementation manner may be to reconfigure an IP address prediction range of the secondary direct connection device, map an original IP address prediction range of the secondary direct connection device by using a mapping manner, generate a new IP address prediction range, so that the new IP address prediction range generated by mapping the secondary direct connection device is in the same network segment as a main IP address of the switch, set an IP address segment to which the secondary direct connection device belongs according to the new IP address prediction range of the secondary direct connection device, and based on this, the switch can continue to use its main IP address, and sequentially send detection messages to the set IP address segment through its port, so as to implement detection of the secondary direct connection device. The switch can use the secondary IP address to send detection messages to the set IP address segment in turn through the port of the switch, so as to realize detection of the secondary direct-connected equipment, and the switch has two IP addresses, namely a primary IP address and a secondary IP address, and can use the IP address to send detection messages to the primary direct-connected equipment and also can use the secondary IP address to send detection messages to the secondary direct-connected equipment, thereby realizing detection of equipment across network segments.
S120: and sequentially sending detection messages to the set IP address field through at least one port of the switch, and receiving response messages of the port in the set detection time.
In this step, after the switch sets the IP address field to which the direct connection device belongs, a timing detection manner may be adopted, and detection messages are sequentially sent to the IP address field on all the ports of the switch, and response messages of each port within a set detection time are received.
In some embodiments, the switch may further adopt a single port detection manner, when detecting that a certain port is connected to the direct connection device, send a detection message to the set IP address segment on the port in sequence, and receive a response message of the port within a set detection time, so as to implement detection of the direct connection device of the port, and by adopting a manner of sending the detection message to the single port, the detection of the direct connection device of the port can be completed on the premise of saving detection resources.
In some embodiments, when the direct connection device of the switch port is normally powered on and connected to the network cable, the physical state of the switch port may become an UP state, so whether the port is connected to the direct connection device may be detected according to the physical state of the switch port.
S130: and constructing a corresponding network table item according to the response message, and acquiring the identity information of the direct-connected equipment according to the network table item.
In this step, the detection message may be an ARP Request message, the Reply message may be an ARP Reply message, and the switch may construct and maintain an ARP table entry and an FDB table entry according to the sent ARP Request message and the received ARP Reply message, where the FDB table entry is a two-layer MAC address table, records a correspondence between a MAC address, a port, and a VLAN, and is used for two-layer forwarding, the ARP table entry records a correspondence between an IP address and a MAC address, and by querying the FDB table entry, the MAC address and the connected port information of the direct connection device may be obtained, and by querying the ARP table entry, the MAC address may be corresponding to the IP address, thereby obtaining the MAC address, the IP address, the connected port information, and so on of the direct connection device.
It should be noted that, the confirmation of the direct-connected device may be implemented through the detection message and the response message, for example: sending detection messages to 100 direct-connected devices in the IP address field, and only receiving response messages fed back by 80 direct-connected devices, acquiring port information and MAC addresses of the 80 direct-connected devices according to the response messages fed back by the 80 direct-connected devices, so as to construct network table items of the 80 direct-connected devices.
In some embodiments, the network entries may be prevented from always occupying resources without use by setting aging times for the network entries, and may explosively grow over time, degrading system performance. According to the aging time of the network table item, the set detection time can be half of the aging time of the network table item, and the two detection can be realized before the aging of the network table item, so that the system resource is saved, and the detection omission can be avoided.
In some embodiments, after the switch completes the construction of the network table entry, a timing detection manner may be further adopted, and detection messages are sequentially sent to the set IP address segment through at least one port of the switch at intervals, and response messages fed back by the direct-connection device in the set detection time are received, and the network table entry is updated according to the response messages, so that timing detection and maintenance management of the direct-connection device are realized.
In summary, in the method for detecting the direct-connected device by the switch provided by the embodiment of the application, on the premise that the IP address estimated range of the direct-connected device is known, an IP address field to which the direct-connected device belongs is set according to the IP address estimated range, the IP address field includes a plurality of IP addresses with serial numbers connected, the switch sequentially sends a detection message to the IP address field on a port of the switch, and receives whether the port has a response message within a set detection time, when the response message is received, a corresponding network table entry can be constructed, and identity information such as a MAC address, an IP address, port information and the like of the direct-connected device is obtained according to the table entry, so that detection and management of the direct-connected device on the port are realized. In addition, in the embodiment of the present application, a mapping configuration manner may be further adopted for the IP address estimated ranges of the directly connected devices in different network segments, so that the IP address estimated ranges of the directly connected devices after configuration and the IP address of the switch are in the same network segment, or according to the IP address estimated ranges of the directly connected devices in different network segments, the secondary IP address of the switch is configured for the switch, so that the secondary IP address of the switch and the IP address estimated ranges of the directly connected devices are in the same network segment, and through the two schemes, the IP address of the switch and the IP address estimated ranges of the directly connected devices are finally in the same network segment, so as to implement the sending and receiving of the detection message and the response message. The embodiment of the application solves the problem that the direct-connection equipment which cannot actively send the message can not normally send the message, so that the switch can detect the direct-connection equipment of all ports, and reliable guarantee is provided for network management.
As shown in fig. 2, an embodiment of the present application provides a device for detecting a switch to a direct connection device, which may be used to implement any step of a method for detecting a switch to a direct connection device shown in fig. 1 and an optional embodiment thereof. Referring to fig. 2, the apparatus includes a setting module 210, a communication module 220, and a processing module 230.
The setting module 210 is configured to set an IP address segment to which the direct-connected device belongs according to an IP address prediction range of the direct-connected device, where the IP address prediction range and the IP address of the switch are in the same network segment; the communication module 220 is configured to sequentially send a detection message to the set IP address field through at least one port of the switch, and receive a response message of the port within a set detection time; the processing module 230 is configured to construct a corresponding network table according to the response message, and obtain identity information of the directly connected device according to the network table, where the identity information includes at least one of a MAC address, an IP address, and port information.
In some embodiments, the direct-connected device includes a primary direct-connected device and a secondary direct-connected device, where the primary direct-connected device is a direct-connected device whose IP address estimated range is in the same network segment as the IP address of the switch, and the secondary direct-connected device is a direct-connected device whose IP address estimated range is in a different network segment from the IP address of the switch; when the direct connection device is the secondary direct connection device, the setting module 210 is further configured to configure an IP address prediction range of the secondary direct connection device, so that the IP address prediction range configured by the secondary direct connection device is in the same network segment as the IP address of the switch, or the setting module 210 is further configured to configure a secondary IP address of the switch, so that the secondary IP address is in the same network segment as the IP address prediction range of the secondary direct connection device.
It should be understood that the apparatus or module in the embodiments of the present application may be implemented by software, for example, by a computer program or instruction having the functions described above, and the corresponding computer program or instruction may be stored in a memory inside the terminal, and the processor reads the corresponding computer program or instruction inside the memory to implement the functions described above. Alternatively, the apparatus or module of the embodiments of the present application may be implemented by hardware. Still further, an apparatus or module in an embodiment of the present application may also be implemented by a combination of a processor and software modules.
It should be understood that, for details of processing of the apparatus or the module in the embodiment of the present application, reference may be made to the embodiment shown in fig. 1 and related expressions of related extended embodiments, and the embodiments of the present application will not be repeated herein.
Fig. 3 is a block diagram of a computing device 500 provided in an embodiment of the present application. The computing device 500 includes: processor 510, memory 520, communication interface 530, bus 540.
It should be appreciated that the communication interface 530 in the computing device 500 shown in fig. 3 may be used to communicate with other devices.
Wherein the processor 510 may be coupled to a memory 520. The memory 520 may be used to store the program codes and data. Accordingly, the memory 520 may be a storage unit internal to the processor 510, an external storage unit independent of the processor 510, or a component including a storage unit internal to the processor 510 and an external storage unit independent of the processor 510.
Optionally, computing device 500 may also include a bus 540. The memory 520 and the communication interface 530 may be connected to the processor 510 via a bus 540. Bus 540 may be a peripheral component interconnect standard (Peripheral Component Interconnect, PCI) bus or an extended industry standard architecture (Extended Industry Standard Architecture, EISA) bus, among others. The bus 540 may be classified as an address bus, a data bus, a control bus, or the like. For ease of illustration, only one line is shown in fig. 3, but not only one bus or one type of bus.
It should be appreciated that in embodiments of the present application, the processor 510 may employ a central processing unit (central processing unit, CPU). The processor may also be other general purpose processors, digital signal processors (digital signal processor, DSP), application specific integrated circuits (application specific integrated circuit, ASIC), field programmable gate arrays (field programmable gate Array, FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, or the like. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like. Or the processor 510 may employ one or more integrated circuits for executing associated programs to carry out the techniques provided in embodiments of the present application.
The memory 520 may include read only memory and random access memory, and provides instructions and data to the processor 510. A portion of the processor 510 may also include non-volatile random access memory. For example, processor 510 may also store information of the device type.
When the computing device 500 is running, the processor 510 executes computer-executable instructions in the memory 520 to perform the operational steps of the method described above.
It should be understood that the computing device 500 according to the embodiments of the present application may correspond to a respective subject performing the methods according to the embodiments of the present application, and that the above-described other operations and/or functions of the respective modules in the computing device 500 are respectively for implementing the respective flows of the methods of the embodiments, and are not described herein for brevity.
Those of ordinary skill in the art will appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware, or combinations of computer software and electronic hardware. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the solution. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present application.
It will be clear to those skilled in the art that, for convenience and brevity of description, specific working procedures of the above-described systems, apparatuses and units may refer to corresponding procedures in the foregoing method embodiments, and are not repeated herein.
In the several embodiments provided in this application, it should be understood that the disclosed systems, devices, and methods may be implemented in other manners. For example, the apparatus embodiments described above are merely illustrative, e.g., the division of the units is merely a logical function division, and there may be additional divisions when actually implemented, e.g., multiple units or components may be combined or integrated into another system, or some features may be omitted or not performed. Alternatively, the coupling or direct coupling or communication connection shown or discussed with each other may be an indirect coupling or communication connection via some interfaces, devices or units, which may be in electrical, mechanical or other form.
The units described as separate units may or may not be physically separate, and units shown as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
In addition, each functional unit in each embodiment of the present application may be integrated in one processing unit, or each unit may exist alone physically, or two or more units may be integrated in one unit.
The functions, if implemented in the form of software functional units and sold or used as a stand-alone product, may be stored in a computer-readable storage medium. Based on such understanding, the technical solution of the present application may be embodied essentially or in a part contributing to the prior art or in a part of the technical solution, in the form of a software product stored in a storage medium, including several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the methods described in the embodiments of the present application. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a random access Memory (Random Access Memory, RAM), a magnetic disk, or an optical disk, or other various media capable of storing program codes.
Embodiments of the present application also provide a computer-readable storage medium having stored thereon a computer program for performing the above-described method when executed by a processor, the method comprising at least one of the aspects described in the above-described embodiments.
Any combination of one or more computer readable media may be employed as the computer storage media of the embodiments herein. The computer readable medium may be a computer readable signal medium or a computer readable storage medium. The computer readable storage medium can be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or a combination of any of the foregoing. More specific examples (a non-exhaustive list) of the computer-readable storage medium would include the following: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In this document, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device.
The computer readable signal medium may include a propagated data signal with computer readable program code embodied therein, either in baseband or as part of a carrier wave. Such a propagated data signal may take any of a variety of forms, including, but not limited to, electro-magnetic, optical, or any suitable combination of the foregoing. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device.
Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.
Computer program code for carrying out operations of the present application may be written in one or more programming languages, including an object oriented programming language such as Java, smalltalk, C ++ and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any kind of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or may be connected to an external computer (for example, through the Internet using an Internet service provider).
It should be noted that the embodiments described in this application are only some embodiments of the present application, and not all embodiments. The components of the embodiments of the present application, as generally described and illustrated in the figures, may be arranged and designed in a wide variety of different configurations. Thus, the above detailed description of the embodiments of the present application, provided in the accompanying drawings, is not intended to limit the scope of the application as claimed, but is merely representative of selected embodiments of the application. All other embodiments, which can be made by those skilled in the art based on the embodiments of the present application without making any inventive effort, are intended to be within the scope of the present application.
The terms first, second, third, etc. or module a, module B, module C, etc. in the description and in the claims, etc. are used solely for distinguishing between similar objects and not necessarily for describing a particular sequential or chronological order, as may be appreciated, if permitted, to interchange particular orders or precedence orders to enable embodiments of the present application described herein to be implemented in orders other than those illustrated or described herein.
In the above description, reference numerals indicating steps are not necessarily meant to be performed as such, but intermediate steps or replaced by other steps may be included, and the order of the steps may be interchanged or performed simultaneously where permitted.
The term "comprising" as used in the description and claims should not be interpreted as being limited to what is listed thereafter; it does not exclude other elements or steps. Thus, it should be interpreted as specifying the presence of the stated features, integers, steps or components as referred to, but does not preclude the presence or addition of one or more other features, integers, steps or components, or groups thereof. Thus, the expression "a device comprising means a and B" should not be limited to a device consisting of only components a and B.
Reference in the specification to "one embodiment" or "an embodiment" means that a particular feature, structure, or characteristic described in connection with the embodiment is included in at least one embodiment of the application. Thus, appearances of the phrases "in one embodiment" or "in an embodiment" in various places throughout this specification are not necessarily all referring to the same embodiment, but may. Furthermore, in the various embodiments of the application, where no special description or logic conflicts exist, the terms and/or descriptions between the different embodiments are consistent and may be mutually referenced, the technical features of the different embodiments may be combined to form a new embodiment according to their inherent logic relationships.
Note that the above is only the preferred embodiments of the present application and the technical principles applied. It will be understood by those skilled in the art that the present invention is not limited to the particular embodiments described herein, but is capable of various obvious changes, rearrangements and substitutions as will now become apparent to those skilled in the art without departing from the scope of the invention. Therefore, while the present application has been described in connection with the above embodiments, the present invention is not limited to the above embodiments, but may include many other equivalent embodiments without departing from the spirit of the present invention, and the present invention is also within the scope of protection.

Claims (10)

1. A method for detecting a direct connection device by a switch, comprising:
setting an IP address segment to which the direct-connected equipment belongs according to an IP address estimated range of the direct-connected equipment, wherein the IP address estimated range and the IP address of the switch are in the same network segment;
sequentially sending detection messages to the set IP address field through at least one port of the switch, and receiving response messages of the port in the set detection time;
and constructing a corresponding network table item according to the response message, and acquiring the identity information of the direct-connected equipment according to the network table item, wherein the identity information comprises at least one of an MAC address, an IP address and port information.
2. The method of claim 1, wherein the direct-connect device comprises a primary direct-connect device and a secondary direct-connect device, wherein the primary direct-connect device is a direct-connect device whose IP address estimated range is in the same network segment as the IP address of the switch, and the secondary direct-connect device is a direct-connect device whose IP address estimated range is in a different network segment than the IP address of the switch;
when the direct connection device is the secondary direct connection device, before setting an IP address segment to which the direct connection device belongs according to the IP address estimated range of the direct connection device, the method further includes:
and configuring the IP address estimated range of the secondary direct-connected equipment so that the IP address estimated range configured by the secondary direct-connected equipment and the IP address of the switch are in the same network segment.
3. The method of claim 1, wherein the direct-connect device comprises a primary direct-connect device and a secondary direct-connect device, wherein the primary direct-connect device is a direct-connect device whose IP address estimated range is in the same network segment as the IP address of the switch, and the secondary direct-connect device is a direct-connect device whose IP address estimated range is in a different network segment than the IP address of the switch;
when the direct connection device is the secondary direct connection device, before setting an IP address segment to which the direct connection device belongs according to the IP address estimated range of the direct connection device, the method further includes:
and configuring the secondary IP address of the switch so that the secondary IP address and the IP address estimated range of the secondary direct-connected equipment are in the same network segment.
4. The method of claim 1, wherein sequentially sending the detection message to the set IP address field through at least one port of the switch comprises:
and detecting the physical state of the port of the switch, determining a first port in a connection state, and sequentially sending detection messages to the set IP address field through the first port.
5. The method of claim 1, further comprising, prior to receiving a reply message from the port within a set detection time:
acquiring the aging time of the network table item;
and setting the set detection time to be smaller than the aging time.
6. The method of claim 5, wherein the set detection time is half of the network entry aging time.
7. The method of claim 1, wherein the constructing a corresponding network table according to the response message, and obtaining the identity information of the direct-connected device according to the network table, comprises:
and sending the detection messages to the set IP address segment at intervals, receiving response messages fed back by the direct-connected equipment within the set detection time, and updating the network table item according to the response messages.
8. A device for detecting direct connection equipment of a switch, the device comprising:
the setting module is used for setting an IP address segment to which the direct-connected equipment belongs according to an IP address estimated range of the direct-connected equipment, wherein the IP address estimated range and the IP address of the switch are in the same network segment;
the communication module is used for sequentially sending detection messages to the set IP address field through at least one port of the switch and receiving response messages of the port in the set detection time;
and the processing module is used for constructing a corresponding network table according to the response message, and acquiring the identity information of the direct-connected equipment according to the network table, wherein the identity information comprises at least one of an MAC address, an IP address and port information.
9. A computing device, comprising:
a processor;
a memory for storing one or more programs;
the one or more programs, when executed by the processor, cause the processor to implement a method of detecting a direct connection device by a switch as claimed in any one of claims 1 to 7.
10. A computer-readable storage medium, on which a computer program is stored, which computer program, when being executed by a computer, implements a method for detecting a direct-connected device by a switch as claimed in any one of claims 1 to 7.
CN202311772005.1A 2023-12-21 2023-12-21 Method and device for detecting direct connection equipment by switch, equipment and medium Pending CN117651001A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311772005.1A CN117651001A (en) 2023-12-21 2023-12-21 Method and device for detecting direct connection equipment by switch, equipment and medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311772005.1A CN117651001A (en) 2023-12-21 2023-12-21 Method and device for detecting direct connection equipment by switch, equipment and medium

Publications (1)

Publication Number Publication Date
CN117651001A true CN117651001A (en) 2024-03-05

Family

ID=90047800

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311772005.1A Pending CN117651001A (en) 2023-12-21 2023-12-21 Method and device for detecting direct connection equipment by switch, equipment and medium

Country Status (1)

Country Link
CN (1) CN117651001A (en)

Similar Documents

Publication Publication Date Title
CN110635933B (en) Apparatus, control method, and recording medium for managing network of SDN
CN107528862B (en) Domain name resolution method and device
WO2020052605A1 (en) Network slice selection method and device
US10361992B2 (en) Method for synchronizing virtual machine location information between data center gateways, gateway, and system
CN109039919B (en) Forwarding path determining method, device, system, computer equipment and storage medium
WO2020057469A1 (en) Data processing method, related device, and computer storage medium
CN112243046B (en) Communication method and network card
WO2017114397A1 (en) Method, device and system for realizing heartbeat mechanism
US9325613B2 (en) Communication device and address learning method
WO2021139289A1 (en) Packet sending method, routing table entry generation method, device, and storage medium
CN112866435A (en) MAC address aging processing method and equipment
US10536368B2 (en) Network-aware routing in information centric networking
CN108966281B (en) Mesh network processing method, device, equipment and storage medium
CN108810183A (en) Processing method, device and the machine readable storage medium of conflict MAC Address
CN117651001A (en) Method and device for detecting direct connection equipment by switch, equipment and medium
CN113098787A (en) Flow processing method and equipment
CN109347734A (en) A kind of file transmitting method, device, the network equipment and computer-readable medium
US11436172B2 (en) Data frame interface network device
CN112566096B (en) Method, device and equipment for acquiring LTE user position change information
JP2007221522A (en) Polling device, terminal device, polling method and program
CN108965494A (en) Data transmission method and device in data system
CN113904980B (en) Channel switching method, device, switch and storage medium
CN117453380B (en) Cluster container group scheduling method, system and computer equipment
CN116436994B (en) Profinet protocol message transmission method, device, equipment and medium
CN113630322B (en) Network cutting method, device, network equipment and computer readable storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination