A kind of ARP message management method of equipment Network Based
Technical field
The present invention relates to a kind of management method of ARP message, especially a kind of ARP message management method of equipment Network Based.
Background technology
ARP (Address Resolution Protocol, address resolution protocol) basic function be IP address by target device, MAC (Media Access Control, the media interviews control) address of query aim equipment, to ensure carrying out smoothly of communication.It is the requisite agreement of network layer in IPv4.
Specify in Ethernet protocol, a main frame in same local area network (LAN) will carry out direct communication with another main frame, must know the MAC Address of destination host.And in ICP/IP protocol, network layer and transport layer are only concerned about the IP address of destination host.When this just causes using IP agreement in ethernet networks, only comprise the IP address of destination host.So, need a kind of mode, according to the IP address of destination host, its MAC Address will be obtained.The thing that ARP agreement that Here it is will be done.So-called address resolution is exactly the process that target ip address is converted to destination-mac address by main frame before sending Frame.
Under normal circumstances, the process of network service is as follows:
If there is a network switching equipment network equipment and three host PC 1, PC2, PC3 in network, the IP address of main frame is respectively 192.168.1.1,192.168.1.2,192.168.1.3, and MAC Address is respectively 11-11-11-11-11-11,22-22-22-22-22-22,33-33-33-33-33-33.
If PC1 will send data to PC2, then need through following steps:
(1) PC1 inquires about in local arp cache the IP-MAC corresponding relation that whether there is PC2 (192.168.1.2), if existed, goes to step (6).
(2) ARP request message is sent to network, the MAC Address of inquiry PC2 (192.168.1.2).
(3) network equipment is to the ARP request message in All hosts (port) distributing step (2).
(4) PC2 receives the ARP request message that PC1 sends, and judges it oneself is return the arp reply information with MAC Address (22-22-22-22-22-22) to PC1 after 192.168.1.2; PC3 judges it oneself is not abandon this message after 192.168.1.2 after receiving the ARP request message that PC1 sends.
(5) network equipment forwards the arp reply information of PC2 transmission to PC1
(6) PC1 sends information to PC2 (22-22-22-22-22-22).
(7) network equipment forwards the information of PC1 to PC2.
Because in ARP consensus standard, network host can unconditional reception and response arp reply information.Under this scheme, the attack of the modes such as ARP deception can be realized easily, cause the situation of the instability of the network such as leakage or suspension of transmitted data on network.
The leakage performing step of network data transmission is as follows:
(1) PC3 sends an arp response message to PC1, cheats PC1 and say that the MAC Address of PC2 is 33-33-33-33-33-33 in message.
(2) network equipment forwards the false arp reply message that PC3 forwards to PC1.
(3) PC1 sends data to PC2, determine the information that there is PC2 (192.168.1.2)-> 33-33-33-33-33-33 in the IP-MAC buffer memory of oneself, so send information to the PC2 (33-33-33-33-33-33) of vacation.
(4) network equipment forwards PC1 and is sent to the information of false PC2 to PC3.
(5) PC3 receives the information that PC1 sends.Cause data leak that PC1 sends to PC2 to PC3 main frame.
Network cheating mode causes the performing step of suspension as follows:
(1) PC3 sends an arp response message to PC1, cheats PC1 and say that the MAC Address of PC2 is AA-AA-AA-AA-AA-AA in message.
(2) network equipment forwards the false arp reply message that PC3 forwards to PC1.
(3) PC1 sends data to PC2, determine in the IP-MAC buffer memory of oneself information that there is PC2 (192.168.1.2) > > AA-AA-AA-AA-AA-AA, so send information to the PC2 (AA-AA-AA-AA-AA-AA) of vacation.
(4) there is not the main frame that MAC Address is AA-AA-AA-AA-AA-AA in the network equipment, so this message is dropped.
The performing step of the unstable networks that network broadcasting windstorm causes is as follows:
(1) PC3 sends any ARP request message in network.
(2) network equipment distributes the ARP request message of PC3 transmission to All hosts (port).
(3) go to step (1).
Because ARP request message can be distributed to all main frames (port) through the network equipment.When ARP request message ceaselessly sends from PC3, when the whole network bandwidth is exhausted, the All hosts on network all can cause unstable networks because of plunder bandwidth.
Current, the most effective solution is exactly do the binding of IP-MAC address on network devices.But in the application of reality, a large amount of previous work amounts and final-period management complexity can be brought to network manager like this.
Summary of the invention
The invention provides a kind of ARP message management method solving the equipment Network Based of the network attacks such as ARP deception, ARP storm.
Realize the ARP message management method of the equipment a kind of Network Based of the object of the invention, comprise the steps:
(1) judge whether message is ARP message; If go to step (3), otherwise go to step (13);
(2) judge that whether network layer MAC is consistent with the MAC Address of ARP; If go to step (3); Otherwise go to step (15);
(3) judge whether source IP address exists in IP-MAC correspondence table; If go to step (4), otherwise go to step (6);
(4) judge whether source IP address, source MAC exist in IP-MAC correspondence table; If go to step (5), otherwise go to step (7);
(5) upgrade the life cycle of source IP address and the respective items of source MAC in IP-MAC correspondence table, go to step (8);
(6) increase source IP address and source MAC are to IP-MAC correspondence table, go to step (8);
(7) send the ARP message of IP conflict to source device, go to step (15);
(8) judge it is ARP request message or response message; If request message goes to step (9), otherwise go to step (12);
(9) the IP information whether IP-MAC correspondence table exists inquiry is inquired about; Go to step (10) if existed, otherwise go to step (11);
(10) return arp reply data message, go to step (15);
(11) sent on network by the network equipment or forward corresponding A RP request message, and being recorded to " sending request message Host List ", going to step (15);
(12) whether inquiry exists " sending request message Host List ", if existed, sends or forwards arp reply message, go to step (15) to the equipment in record;
(13) judge that whether message source IP address, source MAC and target ip address, destination-mac address exist in IP-MAC correspondence table; Go to step (14) if existed, otherwise, abandon current Ethernet message and go to step (15);
(14) network equipment forwards Ethernet message;
(15) Ethernet Message processing is terminated.
The beneficial effect of the ARP message management method of a kind of equipment Network Based of the present invention is as follows:
The ARP message management method of a kind of equipment Network Based of the present invention, the network equipment by no longer forward any come the ARP message (comprising ARP request message and arp reply message) of from host.All ARP information and message are all safeguarded by the network equipment itself and are replied; Greatly reduce the network attacks such as ARP deception, ARP storm.
Accompanying drawing explanation
Fig. 1 is the flow chart of the ARP message management method of a kind of equipment Network Based of the present invention.
Embodiment
As shown in Figure 1, the ARP message management method of a kind of equipment Network Based of the present invention is as follows:
(1) judge whether message is ARP message; If go to step (3), otherwise go to step (13);
(2) judge that whether network layer MAC is consistent with the MAC Address of ARP; If go to step (3); Otherwise go to step (15);
(3) judge whether source IP address exists in IP-MAC correspondence table; If go to step (4), otherwise go to step (6);
(4) judge whether source IP address, source MAC exist in IP-MAC correspondence table; If go to step (5), otherwise go to step (7);
(5) upgrade the life cycle of source IP address and the respective items of source MAC in IP-MAC correspondence table, go to step (8);
(6) increase source IP address and source MAC are to IP-MAC correspondence table, go to step (8);
(7) send the ARP message of IP conflict to source device, go to step (15);
(8) judge it is ARP request message or response message; If request message goes to step (9), otherwise go to step (12);
(9) the IP information whether IP-MAC correspondence table exists inquiry is inquired about; Go to step (10) if existed, otherwise go to step (11);
(10) return arp reply data message, go to step (15);
(11) sent on network by the network equipment or forward corresponding A RP request message, and being recorded to " sending request message Host List ", going to step (15);
(12) whether inquiry exists " sending request message Host List ", if existed, sends or forwards arp reply message, go to step (15) to the equipment in record;
(13) judge that whether message source IP address, source MAC and target ip address, destination-mac address exist in IP-MAC correspondence table; Go to step (14) if existed, otherwise, abandon current Ethernet message and go to step (15);
(14) network equipment forwards Ethernet message;
(15) Ethernet Message processing is terminated.
Embodiment 1
The present embodiment sends datagram to PC2 for simulating PC1, and handling process is as follows:
(1) PC1 (192.168.1.1) is to the ARP request message of network transmission to PC2 (192.168.1.2).
(2) legitimacy of network equipment checking PC1.The network equipment searches the IP-MAC corresponding relation of PC1 from the IP-MAC correspondence table of this locality: 192.168.1.1 > > 11-11-11-11-11-11.Because do not find the IP-MAC respective items of PC1, so the network equipment adds corresponding corresponding relation in IP-MAC correspondence table.
(3) network equipment response ARP request message.The network equipment searches the respective items of PC2 (192.168.1.2) from the IP-MAC correspondence table of this locality.
(4) because the network equipment fails to find the respective items of PC2 in IP-MAC correspondence table, so the network equipment sends an ARP request bag to network.
(5) PC2 sends arp reply message to the network equipment.
(6) legitimacy of network equipment checking PC2.The network equipment finds the IP-MAC corresponding relation of PC2 from the IP-MAC correspondence table of this locality: 192.168.1.2 > > 22-22-22-22-22-22.Because do not find the IP-MAC respective items of PC2, so the network equipment adds corresponding respective items in IP-MAC correspondence table.
(7) network equipment response arp reply message, sends arp reply message to PC1.
(8) PC1 sends datagram to PC2.
(9) legitimacy of PC1 and PC2 in network equipment verification msg message.
(10) network equipment is to PC2 forwarding data packets.
Embodiment 2
The present embodiment sends datagram to PC1 for simulating PC3, and handling process is as follows:
(1) PC3 (192.168.1.3) is to the ARP request message of network transmission to PC1 (192.168.1.1).
(2) legitimacy of network equipment checking PC3.The network equipment searches the IP-MAC corresponding relation of PC3 from the corresponding table table of the IP-MAC of this locality: 192.168.1.3 > > 33-33-33-33-33-33.Because do not find the IP-MAC respective items of PC3, so the network equipment adds corresponding corresponding relation in IP-MAC correspondence table.
(3) network equipment response ARP request.The network equipment finds out the respective items of PC1 from the IP-MAC correspondence table of this locality.
(4) network equipment returns arp reply message to PC3.
(5) PC3 sends datagram to PC1.
(6) legitimacy of PC3, PC1 in network equipment verification msg message.
(7) network equipment is to PC1 forwarding data packets.
Embodiment 3
The present embodiment cheats message for simulation PC3 sends ARP to PC1, and PC3 is disguised oneself as PC2, and process is as follows:
(1) PC3 sends an arp reply message to PC1, indicates the MAC Address of PC2 to be 33-33-33-33-33-33 in message
(2) legitimacy of the network equipment checking PC3, PC2.Judge that the MAC Address sent in MAC Address and ARP bag is inconsistent, so the network equipment abandons this arp reply message.
Embodiment 4
The present embodiment is after the IP address of simulation PC3 changes 192.168.1.2 into, the process of IP conflict, and process is as follows:
(1) after PC3 changes IP=192.168.1.2, to Web broadcast ARP message.
(2) legitimacy of network equipment checking PC3.The network equipment finds the respective items that there is 192.168.1.2 from the IP-MAC correspondence table of this locality, finds to there is IP conflict.
(3) network equipment sends IP conflict ARP message to PC3.
Embodiment recited above is only be described the preferred embodiment of the present invention; not scope of the present invention is limited; do not departing under the present invention designs spiritual prerequisite; the various distortion that the common engineers and technicians in this area make technical solution of the present invention and improvement, all should fall in protection range that claims of the present invention determine.