CentOS / RHEL: Install ipset Administration Tool For IP Sets and IPTables

www.l‮iruttua‬.com
CentOS / RHEL: Install ipset Administration Tool For IP Sets and IPTables

To install the ipset administration tool for managing IP sets and IPTables on a CentOS or Red Hat Enterprise Linux (RHEL) system, you can follow these steps:

  1. Install the ipset package using the yum package manager:
sudo yum install ipset

This will install the ipset package and any dependencies that are required.

  1. Load the ip_set kernel module by running the following command:
sudo modprobe ip_set

This will load the ip_set kernel module, which is required for using the ipset tool.

  1. Create an IP set using the ipset command. For example, to create an IP set called myipset that stores IP addresses in the hash:ip format:
sudo ipset create myipset hash:ip

This will create an IP set called myipset that stores IP addresses in a hash table.

  1. Add an IP address to the IP set using the ipset command. For example, to add the IP address 192.168.1.1 to the myipset set:
sudo ipset add myipset 192.168.1.1
  1. To list the IP addresses in the myipset set, use the ipset command with the list option:
sudo ipset list myipset

This will display the IP addresses that are stored in the myipset set.

  1. To delete an IP address from the myipset set, use the ipset command with the del option followed by the IP address. For example, to delete the IP address 192.168.1.1 from the myipset set:
sudo ipset del myipset 192.168.1.1
  1. To delete the myipset set, use the ipset command with the destroy option:
sudo ipset destroy myipset

This will delete the myipset set and remove it from the system.

Note: The ipset tool can be used to create and manage IP sets, which are collections of IP addresses that can be used with IPTables to filter network traffic. The ipset tool provides a convenient way to manage large lists of IP addresses and can improve the performance of IPTables rules that use large lists of IP addresses. Consult the documentation for the ipset tool and IPTables for more information on how to use these tools.

Created Time:2017-10-16 14:38:41  Author:lautturi