DNS record in ISPCONFIG

Discussion in 'ISPConfig 3 Priority Support' started by pawan, Mar 2, 2021.

Tags:
  1. pawan

    pawan Member

    When DNS is maintained in ISPCONFIG.
    If I add a name server record pointing to name server at ispconfig.
    do I need to add name server record here as well in ISPCONFIG?
    or adding just A record is enough for website alone.
    mail is not required at the moment.
     
  2. Th0m

    Th0m ISPConfig Developer Staff Member ISPConfig Developer

  3. pawan

    pawan Member

    I mean in DNS zones if I set just the A record, should that not be enough. as name server for that domain will anyhow come from the domain registrar DNS.
    [​IMG]
     
  4. till

    till Super Moderator Staff Member ISPConfig Developer

    If the nameservers are the DNS servers of your registrar and not your own DNS servers, then your server is not authoritative for this domain which means that you can not add a DNS record on your system for this zone. Delete the zone that you've added in that case.

    And if your server is the authoritative DNS server, which means you do not use the DNS servers of your registrar, then you must add all records of course incl. NS records as a DNS zone will not work without them. Use the DNS wizard to create the zone.
     
  5. pawan

    pawan Member

    okay Thanks Till.
    I think I didn't communicated correctly.
    yes you are right my name servers are authoritative name servers. example ns1.mywebsolutions.co.in
    and ns1.mywebsolutions.co.in A record points to my ispconfig server.
    and opendomain.net dns records includes
    name server record as ns1.mywebsolutions.co.in
    and in ISPCONFIG I created just A record for opendomain.net
    and it seems to be working, but will it cause any issue?

    not sure If I should created another question for this.
    I need to create dns records for domains using API.
    1. So for example I need to add ns record for the domain as well, can I set template in API.
    2. also the parameters included for adding ns records requires me to add Zone -[number].
    but in web interface I don't need to give any, it is auto assigned.
    so if send request excluding that, will that be okay? or how I can add a number here?
     
  6. Taleman

    Taleman Well-Known Member HowtoForge Supporter

    So you are trying to create the name service entries using ISPConfig API?
    I don't know anything about the API, but you must enter the name service records your setup needs. Read the DNS tutorial, link in my signature, and create a zone using that info, check it works the way you want. Then figure out how to create the same using the API.
     
  7. pawan

    pawan Member

    yes Taleman,
    I want to create the same using API.
    When we are using the web interface, we don't need to add - zone id.
    but If I try to do the same, the parameters mentioned is like this.

    Code:
    Parameters (in $params):
    server_id  (int(11))
    zone  (int(11))
    name  (varchar(64))
    type  (enum('a','aaaa','alias','cname','hinfo','mx','naptr','ns','ptr','rp','srv','txt'))
    data  (varchar(255))
    aux  (int(11))
    ttl  (int(11))
    active  (enum('n','y'))
    stamp  (timestamp)
    serial  (int(10))
    here which parameters is essential and which are optional is not mentioned.
    if I see the database table structure, zone(int(11)) is not null.
     
  8. till

    till Super Moderator Staff Member ISPConfig Developer

    This can't be working, you probably got a DNS answer from a different server. BIND odes not accept such a zone without NS records. Have a look at @Taleman's tutorial to see which records are needed for a DNS zone.
     
    pawan likes this.
  9. pawan

    pawan Member

    okay Taleman
    I think dns_template_add api function should do the trick.
    I will try the same and revert if needed.
    Thanks.
     
  10. pawan

    pawan Member

    Yes Till
    I think you are right. there I can see another Tab as Zone Settings and I also took a look at Taleman's tutorial.
    there I can see two screenshots 1st for DNS ZONE 2nd for DNS RECORDS.
    So I am asking do I need to create name server records in DNS RECORDS as well.
    or the information for name server in DNS Zone is enough?
     
  11. till

    till Super Moderator Staff Member ISPConfig Developer

    Yes, you need DNS.
     
  12. atle

    atle Member HowtoForge Supporter

    I use dns template for this. This is the template I use for the API to use:

    Code:
    [ZONE]
    origin={DOMAIN}.
    ns={NS1}.
    mbox={EMAIL}.
    refresh=7200
    retry=540
    expire=604800
    minimum=3600
    ttl=3600
    
    [DNS_RECORDS]
    A|{DOMAIN}.|{IP}|0|3600
    CNAME|www|{DOMAIN}.|0|3600
    NS|{DOMAIN}.|{NS1}.|0|3600
    NS|{DOMAIN}.|{NS2}.|0|3600
    TXT|{DOMAIN}.|v=spf1 mx a +include:_spf.***.se ~all|0|3600
    TXT|pmg._domainkey|v=DKIM1; h=sha256; k=rsa; p=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAprMqtC20Bgq1IoeA10c5Xys6vvCa2PL0Cn0QTsEVHTmcwJfFkWMHQ8t0aP7A5Viwif4zavVJLHXhJX41GkVng4F4BQZtBU4fsxdUu9NzzSxppi2Di6xpen6/n/N839k9vYJeNyiIShDldWUt/M/pDjyB/RVjB1Eg7Aof/BtYy02sdfjslKLJHWnaxFJjkd9gYAHpKF/TDp1lJsDaOJ9EzPG3nlsyh9/sdfsadfdsIUIU/lvmJ5kyfRVwnfcmi4Kdq95ySh9u4CLOVKJRNHEg4DJUbwOzl9hK9BU58bRaAseSrab9RSnImFyolswuISH/d/vMShe388fnAQIDAQAB|0|3600
    CNAME|autoconfig|autoconfig.ic.******.com.|0|3600
    SRV|_autodiscover._tcp|0 443 autodiscover.ic.******.com.|0|3600
    
    
    and the MX record I enter with the API since the mail server differes from account to account. But if you only use one mail server, you can add the MX here as well.
     
    Last edited: Mar 4, 2021
  13. pawan

    pawan Member

    Hi atle,
    Thanks for posting.
    I have added a template and added the same code as your post.
    but somehow no dns records are created and no response from the server.
    here is my code
    PHP:
    public function AddDns($domain){
       
        
    $result $this->restCall('login', array('username' => $this->remote_user'password' => $this->remote_pass'client_login' => false));
       
    if(
    $result) {
        
    $data json_decode($resulttrue);
        if(!
    $data) die("ERROR!\n");
        
    $this->session_id $data['response'];
    }

        
    $id $this->restCall('dns_templatezone_add',['session_id' => $this->session_id,
        
    'client_id'=>1,
        
    'template_id'=>3,
        
    'domain'=>$domain,
        
    'ip'=>'62.171.141.17',
        
    'ns1' => 'ns1.parkzona.com',
        
    'ns2' => 'ns2.parkzona.com',
        
    'email' => 'info.xyz.com',
        ]);
        if(
    $id){
            
    var_dump($id);
        return 
    "ID: ".$id."<br>";
        }
       
    }
    and for restcall code is like this:
    PHP:
    private function restCall($method$data) {   
        
    $remote_url=self::remote_url;
        if(!
    is_array($data)) return;
        
    $json json_encode($data);
       
        
    $curl curl_init();
        
    curl_setopt($curlCURLOPT_POST1);
        if(
    $datacurl_setopt($curlCURLOPT_POSTFIELDS$json);

        
    // needed for self-signed cert
        
    curl_setopt($curlCURLOPT_SSL_VERIFYPEERfalse);
        
    curl_setopt($curlCURLOPT_SSL_VERIFYHOSTfalse);

        
    // end of needed for self-signed cert
        
    curl_setopt($curlCURLOPT_URL$remote_url '?' $method);
        
    curl_setopt($curlCURLOPT_RETURNTRANSFER1);
       
        
    $result curl_exec($curl);
        
    curl_close($curl);
        return 
    $result;
    }
    anything missing here?
     
    ahrasis likes this.
  14. atle

    atle Member HowtoForge Supporter

    ahrasis likes this.

Share This Page