CN110855811A - Method for remotely binding mac and ip based on switch - Google Patents

Method for remotely binding mac and ip based on switch Download PDF

Info

Publication number
CN110855811A
CN110855811A CN201911135036.XA CN201911135036A CN110855811A CN 110855811 A CN110855811 A CN 110855811A CN 201911135036 A CN201911135036 A CN 201911135036A CN 110855811 A CN110855811 A CN 110855811A
Authority
CN
China
Prior art keywords
mac
binding
switch
address
command
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
CN201911135036.XA
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.)
Fujian Tianqing Online Interactive Technology Co Ltd
Original Assignee
Fujian Tianqing Online Interactive 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 Fujian Tianqing Online Interactive Technology Co Ltd filed Critical Fujian Tianqing Online Interactive Technology Co Ltd
Priority to CN201911135036.XA priority Critical patent/CN110855811A/en
Publication of CN110855811A publication Critical patent/CN110855811A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L2101/00Indexing scheme associated with group H04L61/00
    • H04L2101/60Types of network addresses
    • H04L2101/618Details of network addresses
    • H04L2101/622Layer-2 addresses, e.g. medium access control [MAC] addresses
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L43/00Arrangements for monitoring or testing data switching networks
    • H04L43/10Active monitoring, e.g. heartbeat, ping or trace-route
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L61/00Network arrangements, protocols or services for addressing or naming
    • H04L61/50Address allocation
    • H04L61/5046Resolving address allocation conflicts; Testing of addresses
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/08Protocols specially adapted for terminal emulation, e.g. Telnet

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Health & Medical Sciences (AREA)
  • Cardiology (AREA)
  • General Health & Medical Sciences (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

The invention provides a method for remotely binding mac and ip based on a switch, which comprises the following steps: step S1, a mac binding module is deployed on a tool machine, and the mac binding module remotely logs in the switch by utilizing ssh protocol; step S2, the mac binding module splices to form a corresponding command according to a binding command protocol provided by a switch equipment manufacturer and sends the spliced command to the switch; and step S3, the switch binds the mac address of the target machine and the ip address to be bound, after the switch executes all commands, the mac binding module utilizes the ping function to ping the ip address bound by the target machine, and judges the binding result by analyzing the return value obtained by ping. The invention improves the binding efficiency of the mac address and the ip address.

Description

Method for remotely binding mac and ip based on switch
Technical Field
The invention relates to the technical field of computer communication, in particular to a method for remotely binding mac and ip based on a switch.
Background
At present, computers are widely used in society, most industries use the computers in daily work, and people who use the computers know the concept of ip addresses. The IP address is indispensable to the computer; each computer provides a method for modifying an ip address, the ip address is convenient to modify, but many problems can be caused, for example, the modified ip address conflicts with others, so that normal internet surfing of other users can be influenced, so that management of the ip address is very important for each enterprise (especially large enterprises, which have many employees and basically have no idle internal network ip address), and currently, a network manager of each enterprise basically binds the mac address and the ip address on equipment such as a switch, so that after the ip address is modified randomly, only a local computer cannot surf the internet and the like, and normal work of others cannot be influenced. For the binding of mac and ip, a general method is to use remote management tools such as Putty, SecureCRT and the like to log in a switch and then construct and execute a command to perform a binding function.
Disclosure of Invention
In order to overcome the above problems, an object of the present invention is to provide a method for remotely binding mac and IP based on a switch, which can perform remote binding without causing conflict between an IP address and others, and improve the efficiency of binding mac and IP addresses.
The invention is realized by adopting the following scheme: a method for remotely binding mac and ip based on a switch comprises the following steps:
step S1, a mac binding module is deployed on a tool machine, and the mac binding module remotely logs in the switch by utilizing ssh protocol;
step S2, the mac binding module splices to form a corresponding command according to a binding command protocol provided by a switch equipment manufacturer and sends the spliced command to the switch;
and step S3, the switch binds the mac address of the target machine and the ip address to be bound, after the switch executes all commands, the mac binding module utilizes the ping function to ping the ip address bound by the target machine, and judges the binding result by analyzing the return value obtained by ping.
Further, the step S1 further includes: and performing networking operation on the tool machine, the switch and the target machine, and remotely logging in the switch by using a mac binding module on the tool machine by using a ssh protocol.
Further, when there are multiple commands in the command spliced in step S2, the command is sent in a manner of sending one by one, and then the line feed character \ n is sent to ensure that the command is executed, and after all the results of the command execution are received, the next command is sent.
Further, the step S2 further specifically includes: preparing mac address and ip address information corresponding to a target machine to be bound, and storing the mac address and ip address information into an excel file; importing the excel file content into a mac binding module, splicing the excel file content into a corresponding command according to a binding command protocol provided by a switch equipment manufacturer, wherein the command is as follows: system-view \ n + interface device port information \ n + ip source binding ip address mac-address mac address.
Further, the return value obtained by parsing ping in step S3 is: that is, if ping can be enabled, the binding is successful, and if ping is disabled, the binding is failed.
The invention has the beneficial effects that: the invention deploys a mac binding module on a tool machine, and the mac binding module remotely logs in a switch by utilizing a ssh protocol; the mac binding module splices to form a corresponding command according to a binding command protocol provided by a switch equipment manufacturer and sends the spliced command to the switch; after the binding command is executed, the mac binding module tries to ping the IP address of the target machine, and judges the binding result by analyzing the return value obtained by ping, so that remote binding can be performed, the conflict between the IP address and others can not be caused, and the efficiency of binding the mac address and the IP address is improved.
Drawings
FIG. 1 is a schematic flow diagram of the process of the present invention.
FIG. 2 is a diagram of the hardware connection framework of the present invention.
Detailed Description
The invention is further described below with reference to the accompanying drawings.
Referring to fig. 1 and fig. 2, a method for remotely binding mac and ip based on a switch according to the present invention includes the following steps:
step S1, a mac binding module is deployed on a tool machine, and the mac binding module remotely logs in the switch by utilizing ssh protocol; the step S1 further includes: and performing networking operation on the tool machine, the switch and the target machine, and remotely logging in the switch by using a mac binding module on the tool machine by using a ssh protocol.
Step S2, the mac binding module splices to form a corresponding command according to a binding command protocol provided by a switch equipment manufacturer and sends the spliced command to the switch; when there are multiple commands, the commands spliced in step S2 are sent in a manner of sending one by one, and then the command is sent, and then the line change symbol \ n is sent to ensure that the command is executed, and after all results of the command execution are received, the next command is sent.
And step S3, the switch binds the mac address of the target machine and the ip address to be bound, after the switch executes all commands, the mac binding module utilizes the ping function to ping the ip address bound by the target machine, and judges the binding result by analyzing the return value obtained by ping.
The step S2 further includes: preparing mac address and ip address information corresponding to a target machine to be bound, and storing the mac address and ip address information into an excel file; importing the excel file content into a mac binding module, splicing the excel file content into a corresponding command according to a binding command protocol provided by a switch equipment manufacturer, wherein the command is as follows: system-view \ n + interface device port information \ n + ip source binding ip address mac-address mac address. For example: taking the protocol of the apparatus of hua san (h3c) as an example, the corresponding mac binding command formed by splicing is:
system-view
interface g1/0/42
ip source binding ip-address 172.23.35.100 mac-address 3A17-EEDB-40F7
wherein g1/0/42, ip address (i.e. 172.23.35.100), mac address (i.e. 3A17-EEDB-40F 7) can be modified, and other content formats are not changed; and after the binding is finished, the mac binding module displays the binding result.
The return value obtained by analyzing ping in the step S3: that is, if ping can be enabled, the binding is successful, and if ping is disabled, the binding is failed.
The specific binding command is completed by the switch equipment, the mac binding module judges whether the command is executed or not by receiving a return value of the switch equipment after sending the binding related command to the switch equipment, and the mac binding module tries to remove the ping target machine after the command is executed, so as to confirm the binding result.
The mac binding module has the main functions: 1. and forming a corresponding command according to a specific protocol of the switch equipment, then sending the command to the switch equipment for execution, and waiting for the completion of the command execution.
2. And the Ping target machine acquires whether the switch equipment binding is successful or not by analyzing the Ping result.
The above description is only a preferred embodiment of the present invention, and all equivalent changes and modifications made in accordance with the claims of the present invention should be covered by the present invention.

Claims (5)

1. A method for remotely binding mac and ip based on a switch is characterized in that: the method comprises the following steps:
step S1, a mac binding module is deployed on a tool machine, and the mac binding module remotely logs in the switch by utilizing ssh protocol;
step S2, the mac binding module splices to form a corresponding command according to a binding command protocol provided by a switch equipment manufacturer and sends the spliced command to the switch;
and step S3, the switch binds the mac address of the target machine and the ip address to be bound, after the switch executes all commands, the mac binding module utilizes the ping function to ping the ip address bound by the target machine, and judges the binding result by analyzing the return value obtained by ping.
2. The method according to claim 1, wherein the mac and ip binding is performed remotely based on the switch, and the method comprises: the step S1 further includes: and performing networking operation on the tool machine, the switch and the target machine, and remotely logging in the switch by using a mac binding module on the tool machine by using a ssh protocol.
3. The method according to claim 1, wherein the mac and ip binding is performed remotely based on the switch, and the method comprises: when there are multiple commands, the commands spliced in step S2 are sent in a manner of sending one by one, and then the command is sent, and then the line change symbol \ n is sent to ensure that the command is executed, and after all results of the command execution are received, the next command is sent.
4. The method according to claim 1, wherein the mac and ip binding is performed remotely based on the switch, and the method comprises: the step S2 further includes: preparing mac address and ip address information corresponding to a target machine to be bound, and storing the mac address and ip address information into an excel file; importing the excel file content into a mac binding module, splicing the excel file content into a corresponding command according to a binding command protocol provided by a switch equipment manufacturer, wherein the command is as follows: system-view \ n + interface device port information \ n + ip source binding ip address mac-address mac address.
5. The method according to claim 1, wherein the mac and ip binding is performed remotely based on the switch, and the method comprises: the return value obtained by analyzing ping in the step S3: that is, if ping can be enabled, the binding is successful, and if ping is disabled, the binding is failed.
CN201911135036.XA 2019-11-19 2019-11-19 Method for remotely binding mac and ip based on switch Pending CN110855811A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201911135036.XA CN110855811A (en) 2019-11-19 2019-11-19 Method for remotely binding mac and ip based on switch

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201911135036.XA CN110855811A (en) 2019-11-19 2019-11-19 Method for remotely binding mac and ip based on switch

Publications (1)

Publication Number Publication Date
CN110855811A true CN110855811A (en) 2020-02-28

Family

ID=69602348

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201911135036.XA Pending CN110855811A (en) 2019-11-19 2019-11-19 Method for remotely binding mac and ip based on switch

Country Status (1)

Country Link
CN (1) CN110855811A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112994986A (en) * 2021-04-27 2021-06-18 四川新网银行股份有限公司 Configurable automatic port network state detection system and detection method

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103560914A (en) * 2013-11-01 2014-02-05 国网安徽省电力公司铜陵供电公司 Interchanger ARP table operation method based on instruction template
CN103763119A (en) * 2011-03-09 2014-04-30 成都勤智数码科技股份有限公司 Telnet/SSH-based network terminal management method
CN105071945A (en) * 2015-06-26 2015-11-18 国网山东省电力公司济南供电公司 Network terminal address bulk binding method based on interchanger technology
CN105208142A (en) * 2015-08-25 2015-12-30 江苏省电力公司镇江供电公司 Power grid information asset operation and maintenance IP address automatic allocation method

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103763119A (en) * 2011-03-09 2014-04-30 成都勤智数码科技股份有限公司 Telnet/SSH-based network terminal management method
CN103560914A (en) * 2013-11-01 2014-02-05 国网安徽省电力公司铜陵供电公司 Interchanger ARP table operation method based on instruction template
CN105071945A (en) * 2015-06-26 2015-11-18 国网山东省电力公司济南供电公司 Network terminal address bulk binding method based on interchanger technology
CN105208142A (en) * 2015-08-25 2015-12-30 江苏省电力公司镇江供电公司 Power grid information asset operation and maintenance IP address automatic allocation method

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112994986A (en) * 2021-04-27 2021-06-18 四川新网银行股份有限公司 Configurable automatic port network state detection system and detection method

Similar Documents

Publication Publication Date Title
CN102025535B (en) Virtual machine management method and device and network equipment
WO2021203979A1 (en) Operation and maintenance processing method and apparatus, and computer device
JPH09190396A (en) Positioning method and device in computer network
CN103916482A (en) Data synchronous transmission method based on sqlite
CN109284140B (en) Configuration method and related equipment
CN106998338A (en) A kind of method and device for realizing VNF deployment
CN104270204A (en) Testing method and testing equipment for wireless communication module
CN103744699A (en) Method and device for software upgrading of intelligent electric equipment
CN107124483A (en) Domain name analytic method and server
CN105094506A (en) Screen unlocking method for intelligent terminal, intelligent terminal and operating platform
CN110213284A (en) Detection method, system and the relevant apparatus of SSH server weak passwurd loophole
WO2015067036A1 (en) Remote access configuration method, remote access method, apparatus, and system
CN106656998A (en) Server communication method and device
US8725855B2 (en) Device commissioning and replacement
CN110855811A (en) Method for remotely binding mac and ip based on switch
CN107911496A (en) A kind of VPN service terminal acts on behalf of the method and device of DNS
CN106161249B (en) The processing method and processing device of PPPoE message
CN107769952B (en) Remote management system and method thereof
CN109788034B (en) Configuration method for gateway access equipment, electronic equipment and storage medium
WO2018000686A1 (en) Method and system for establishing call
CN103677961A (en) Method for setting host name of virtual machine
CN102761629A (en) Method, device and system for setting DNS (Domain Name System) server address
EP3297254A1 (en) Domain name system (dns) resolution processing method and device
WO2016101424A1 (en) Method and apparatus for realizing terminal service information processing
CN110971716B (en) Address configuration method, device, system 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
RJ01 Rejection of invention patent application after publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20200228