Block and kill illegal IP addresses in Linux

Source: Internet
Author: User
Block and kill illegal IP addresses in a Linux system-Linux Enterprise Application-Linux server application information. For details, refer to the following section. Concept

After deciding to use ARP binding, we should consider the implementation of ARP. ARP (Address Resolution Protocol) is used to notify the recipient's computer and network device of the MAC Address corresponding to their IP Address. If all illegal users are assigned an incorrect MAC address, they cannot access the Internet through this server. Therefore, ARP binding requires that all possible IP addresses be bound to MAC addresses to prevent unauthorized users (except for modifying MAC addresses ).

After some thought, I have determined the preliminary idea. First, generate an invalid MAC address matching table from 10.0.0.1 to 10.0.3.254 using the Linux Shell loop method, which is called a global table. Then, a table of valid user IP addresses and MAC addresses is obtained based on the DHCP server data. Then, read the IP addresses of each user in the valid table and search for matched IP addresses in the global table. If yes, replace the original invalid MAC address with the MAC address of the valid user. Finally, valid users in the global table match the correct MAC address, while invalid users match invalid MAC addresses. As long as the user writes this table to the system ARP cache, illegal users cannot use the Gateway by simply stealing IP addresses.

Implementation

First, an initial global table is generated. It contains all IP addresses, and each IP address matches an invalid MAC address. The format must be recognized by arp commands. The script for initializing the global table is init. The content is as follows:
QUOTE:
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.