0

I'm setting VPS infrastructure for a shared script project using HAproxy with three nodes. What I want is when clients point their domains to my nameservers like ns1.abcd.com and ns2.abcd.com, the domains will be hosted on my servers.

I've searched for the solution on the internet and I found something related to DNS configuration and reverse proxy. I'm not so clear about the solution so could any please kindly direct to the place.

Dave M
  • 4,514
  • 22
  • 31
  • 30

1 Answers1

0

Your clients just need to add an A record pointing their domain to the IP address of your HAproxy.

I would advise against asking them to change the authoritative name servers for their zone: they will contact you every time they want to add a new record. However, if this is what you want to provide, let's assume 1.2.3.3 is the address of your HAproxy, 1.2.1.1 of the master DNS server (ns1.abcd.com) and 1.2.2.2 that of the slave server. Create a zone file like this (let's say in /etc/bind/zones/db.default:

$TTL 10800  ; 3 hours
@       IN SOA  ns1.abcd.com. admin.abcd.com. (
                2019120900 ; serial
                10800      ; refresh (3 hours)
                3600       ; retry (1 hour)
                2419200    ; expire (4 weeks)
                3600       ; minimum (1 hour)
                )
        NS  ns1.abcd.com.
        NS  ns2.abcd.com.
        A   1.2.3.3

For every client you'll have to add a snippet to bind9 config (assuming that's what you are using) on your master DNS server:

zone "clients.domain.com" {
    type master;
    notify yes;
    allow-transfer { 1.2.2.2; }
    file "/etc/bind/zones/db.default";
};

and a similar snippet on the slave:

zone "clients.domain.com" {
    type slave;
    masters { 1.2.1.1; }
    file "/etc/bind/zones/db.clients.domain.com";
}
Piotr P. Karwasz
  • 5,748
  • 2
  • 11
  • 21
  • @piotr-p-karwasz Thanks for your answer!... This is almost what I want. However, I need to add the snippet to the `bind9` for every client. I plan to add over 100 clients to the shared script project. Is there any way that client just add the A record or NameServers and no more configuration? – Kimsea Sok Dec 10 '19 at 04:26
  • If he adds an `A` record on his name servers you don't have to do nothing. Your script just needs to discriminate between clients based on the domain name. If you want to administer the DNS for them, you can write a script to generate `bind9` configuration. – Piotr P. Karwasz Dec 10 '19 at 04:37
  • @piotr-p-karwasz, awesome! This is awesome. I don't want to manage any DNS for clients. This solution should be what I want. – Kimsea Sok Dec 10 '19 at 05:39