How to convert a list of IP addresses to DNS names

In Linux, you can convert a list of IP addresses into DNS names, for example, by a simple script.

To do this, create an empty file with the extension .sh, make it executable and add the content to it:

#!/bin/sh
while read ip traf ; do
    name=`host $ip|awk '{print $NF}'`
    echo -e "$name\t$ip\t$traf"
done >name_ip_traf.lst <ip_traf.lst

Where ip_traf.lst is a file with a list of IP addresses that need to be converted to DNS names.

You can make it executable by the command:

chmod +rwx file.sh

Run the script in the directory where it is located by the command:

./file.sh

Or run by specifying the full path:

/dir/file.sh

After the startup, you must wait for a while or interrupt the execution by pressing CTRL+C.

Change the default value in MySQL columns

I’ll give an example of specifying or changing the default value in the MySQL column.
Let’s see the list of tables in the database:

SHOW TABLES;

Let’s see the structure of the table we are interested in:

DESCRIBE internet_main;

Let’s say the activate column has the type date and the default value is 0000-00-00, and we want to make 3000-01-01, then we will execute sql query:

ALTER TABLE internet_main ALTER activate SET DEFAULT '3000-01-01';

You can also delete the default value:

ALTER TABLE internet_main ALTER activate DROP DEFAULT;

Or return it as it was:

ALTER TABLE internet_main ALTER activate SET DEFAULT '0000-00-00';

In strict mode MySQL can not set the value 0000-00-00, so you can temporarily disable the strict mode:

SET sql_mode = '';

Ip-up and ip-down scripts with ipset for Accel-ppp

I’ll give an example of the scripts I used before, in the allowip list IP addresses were added to which the Internet is allowed, and in denyip those were redirected to the http page with information about the negative deposit.

Continue reading “Ip-up and ip-down scripts with ipset for Accel-ppp”