Round Robin DNS

Round robin DNS is a technique in which load balancing is performed by a DNS server instead of a strictly dedicated machine. A DNS record has more than one value IP address.

When a request is made to the DNS server which serves this record, the answer it gives alternates for each request. For instance, if you had a three webserver that you wished to distribute requests between, you could setup your DNS zone as follows:

# vi /var/named/domain.com.db

Append/modfiy www entry:

www   IN   A   1.2.3.4
IN   A   2.3.4.5

IN   A   3.4.5.6
IN   A   4.5.6.7

# /etc/init.d/named restart
When a query is made to the DNS server it will first give the IP of 1.2.3.4 for the www host. The next time a request is made for the IP of www, it will serve 2.3.4.5 and so on.

Change Mail Server IP

Sometimes your server’s IP address may get black listed by most of RBLs. In such situation a quick solution is to route the emails through a secondary IP address on the same server which is not black listed. There are two options to switch the mail server IP.

1. In Cpanel:

Login to WHM

Click Exim Configuration Editor

Check the box next to:
“Send outgoing mail from the ip that matches the domain name in /etc/mailips (*: IP can be added to the file to change the main outgoing interface)”

Save Changes

Then edit the file /etc/mailips
vi /etc/mailips

and add:

*: newIP

Restart exim

or

2. Through Shell

vi /etc/exim.conf

Locate remote_smtp

Change as per below:

remote_smtp:

driver = smtp

#interface = ${if exists {/etc/mailips}{${lookup{$sender_address_domain}lsearch{/etc/mailips}{$value}{}}}{}}
#helo_data = ${if exists {/etc/mailhelo}{${lookup{$sender_address_domain}lsearch{/etc/mailhelo}{$value}{$primary_hostname}}}{$primary_ho stname}}

interface = 111.222.333.444 # Change to your server IP address.

Save changes and exit.

Restart Exim

Remote access to mysql database

Step 1 : vi  /etc/my.cnf
———————————————
pid-file        = /var/run/mysqld/mysqld.pid

socket          = /var/run/mysqld/mysqld.sock

port            = 3306

basedir         = /usr

datadir         = /var/lib/mysql

tmpdir          = /tmp

language        = /usr/share/mysql/English

bind-address    = mysql server ip

# skip-networking
———————————————

bind-address : IP address to bind to.

skip-networking : Don’t listen for TCP/IP connections at all. All interaction with mysqld must be made via Unix sockets. This option is highly recommended for systems where only local requests are allowed. Since you need to allow remote connection this line should removed from file or put it in comment state.

Step 2 : /etc/init.d/mysql restart

Step 3 : Grant access to remote IP address

mysql -u root -p mysqlGrant access to new database

Step 4 : If you want to add new database aaa for user bbb and remote IP xxx.xxx.xxx.xxx then type following commands at mysql prompt:

mysql> CREATE DATABASE aaa;
mysql> GRANT ALL ON aaa.* TO bbb@’xxx.xxx.xxx.xxx’ IDENTIFIED BY ‘PASSWORD’;

Step 5 : Grant access to existing database

mysql> update db set Host=’xxx.xxx.xxx.xxx’ where Db=’webdb’;
mysql> update user set Host=’xxx.xxx.xxx.xxx’ where user=’webadmin’;

mysql> exit

Step 6 : Test it From remote system

mysql -u webadmin –h 65.55.55.2 –p