5.1.2 How to change IP for a mail domain, PTR and Hostname for dedicated IP

Banner Proper configuration of the IP address and DNS records is a necessary condition for the stable operation of the mail server and ensuring uninterrupted delivery of emails. The IP address is a unique identifier that allows servers and clients to find each other on the Internet. The mail server must have a correctly configured IP address associated with your mail domain.

In addition to configuring the IP address, it is also important to properly configure the DNS records for your mail domain. This includes MX records, which point to the mail server, A records that bind the domain to the IP address, and SPF records that help prevent spam. Proper configuration of these records allows other servers to find your mail server and deliver mail without delays.

Proper configuration of the IP address, Hostname, and DNS records is a key step to ensuring stable and efficient operation of the mail server.

Changing the IP address for the mail domain

If you have ordered an additional IP address, you can assign it to your mail domain. Depending on the type of service, this can be done in different ways:

1. For virtual hosting services, this can be done via the graphical interface of the control panel, in the E-MailMail Domains section.

Control Panel

2. For virtual/dedicated server services with the ISPManager4 Lite control panel, you need to make the change via SSH. You need to connect to the server and execute the following commands:

  1. echo "domain.com:91.234.38.14;" >> /etc/exim4/domainips
  2. update-exim4.conf
  3. /etc/init.d/exim4 restart

Note: you need to substitute your domain and your IP address. We use the domain domain.com and IP 91.234.38.14 as an example only.

These commands will change the IP address for the mail domain domain.com to 91.234.38.14, since by default, the server’s main IP is used if the exim4 mail server is installed.

If you are using the postfix mail server, add a similar line to /etc/postfix/domainips and restart postfix with the command:

  1. /etc/init.d/postfix restart

Note: If you have previously changed the IP address for the mail domain using the above method, be sure to go to the /etc/exim4/domainips file and delete the old line binding the mail domain to the additional IP.

When changing the IP address of the mail domain, you should follow the recommendations for setting up DNS records.

Example: correct configuration of DNS records
Record Type Value
mail A Main_server_ip
pop A Main_server_ip
smtp A Main_server_ip
Main_domain. MX mail
Main_domain. MX mail
Main_domain. TXT v=spf1 ip4:main_server_ip ip4:additional_mail_domain_ip a mx ~all

It is important to include the periods, as in our example.

Below is an example where the main server IP 91.234.33.250 and the additional IP for mail 91.234.33.213 are used. DNS records should be configured following this principle.

Changing the PTR for a dedicated IP

The way to change the PTR record (Reverse DNS) for a dedicated IP address may differ depending on the type of service you are using. Below are instructions for changing the PTR for different types of hosting and servers:

1. For virtual hosting, the PTR change is made in the control panel, in the IP Address List section. Select the desired IP from the list and click the Change button. Enter the desired value in the Reverse Zone field, and be sure to include a period at the end, for example, yourdomain.com.

Changing PTR

Important: When setting up the PTR (Reverse DNS) for an IP address, it is recommended to specify the domain name that physically works with this IP address. The best option would be to use the primary domain name, for example, yourdomain.com.

Although some email service providers may also accept PTR records with subdomains like mail.yourdomain.com, there are certain risks that such records may be filtered as potential spam on some mail servers. Therefore, to avoid any problems with mail delivery, it is recommended to simply use the primary domain name without a subdomain. [/warning]

2. For virtual servers, if the ISPManager control panel is used, the PTR record can be changed similarly to hosting. You can also make the change using the VM-Cloud server control panel, following the instructions.

3. For dedicated servers, to change the PTR, you need to contact the Support Service and provide the IP address for which you need to set a new PTR value.

Changing the Hostname for a server

Changing the Hostname is only available for virtual and dedicated server services, and you must have root access.

You can change the Hostname value in the ISPManager control panel, in the Server Settings → Server Parameters section, in the Server Name field.

Changing Hostname

You can also change the Hostname via SSH. Connect to the server and execute the following command:

  1. sudo hostname your_hostname.com

Replace your_hostname.com with your domain.

Important: For stable operation of the domain mail, specify your mail domain or any domain pointing to this IP as the PTR and Hostname, on which you will create mailboxes. The PTR and Hostname updates take place within 6-24 hours.