DNS Resource Record : How to redirect the www entry to external ip

  • Hello guys,

    How can I redirect just the www record to an external IP, but keep the server managing the rest.

    I tried to add a www entry (www as name) and added the external ip at "record data". Then I always get the error Servers::named::bind::compileZone: Couldn't compile the xxx.xyz zone. Unknow error.

  • If I'm not wrong, this is not possible for now.

    "www" entry is static in the DNS zone template file, so this is added for every kind of domains you manage by default through i-MSCP.

    However, I read somewhere that all the DNS thing is being reworked (at least on the todo) so that all DNS entries would be stored into DB and make all those available for modification by end-user.

    In the meantime, maybe some kind of listener file could be use, but as this is only for one domain, honestly, I don't know how to handle that case.

  • Thanks for your answer.

    It's weird, because it was working until yesterday when I had to reconfigure i-mscp to switch to php 7.1. There was no i-mscp upgrade or any other change.

  • Well, when looking into the template file :


    We can see that the "www" is static and is there by default.
    Creating another entry from the panel would lead to issues for sure (if the panel let do this, on compile of the zone, it will see the entry twice and will not like it, in theory, not tested)

  • The zone (and template also) is not encrypted in any way !

    But keep in mind this :

    - Manually change the value on the working zone will be undone when you make any changes through the web interface (which imply the DNS rebuild process)

    - To get this change permanent "easily", you have to change the template directly, but this change will then apply to all customers.

    (- Like I said, some kind of listener file might work, but for this, I'm unsure of the way doing that, and only for a specific domain)

    - Lastly, god Nuxwin may have a better solution :D

    After this, the choice is up to you.

    Also, remind you that when doing any i-MSCP upgrade, templates files will get back to their initial state unless you change it prior the upgrade process.

  • The zone (and template also) is not encrypted in any way !

    In latest version production zone files are not plaintext ;) This depend on the value of the BIND_DB_FORMAT for which default value is raw=0 in the /etc/imscp/bind/bind.data configuration file.

    1. # Format for compiled zone files
    2. # Possible values: text, raw or raw=N where N can be 0 or 1
    3. # See NAMED-CHECKZONE(8)
    4. BIND_DB_FORMAT = raw=0

    You need differentiate 3 things here:

    1. The template files which of course are always plaintext
    2. The intermediate zone files located at /etc/imscp/bind/working, and which are always plaintext
    3. The production zone files located at /var/cache/bind, and which are plaintext or not, depending on the BIND_DB_FORMAT parameter value.

    The way to go to override the default www DNS RR is to use the appropriate listener file which is https://github.com/i-MSCP/imsc…ed_override_default_rr.pl for the latest released version. When this listener is in place, you can normally override the default www DNS rr through the custom DNS record interface.