# DNS

# Introduction

Our primary domain is [bksp.in](http://bksp.in). The domain is registered with Porkbun, and the primary name server is Cloudflare. DNSSEC is enabled.

# Internal Zone ([int.bksp.in](http://int.bksp.in))

We have a special zone called `int.bksp.in` which is delegated to our NS1 located on-site. This zone updates automatically using the [@bksp/hibiscus](https://github.com/b4ck5p4c3/hibiscus) daemon, which pulls data from the gateway’s DHCP.

If your device is connected to our internal network segment, you can reach it using:

**Hostname-based resolve**

```
$ host timekeeper.int.bksp.in
timekeeper.int.bksp.in has address 10.0.2.123
```

**MAC-based resolve**

```
$ host d4-94-a1-53-b6-ef.int.bksp.in
d4-94-a1-53-b6-ef.int.bksp.in has address 10.0.2.123
```

## Collisions

There are some important considerations when collisions are detected:

* If both **Static** and **Dynamic** leases exist for the same hostname, we will prioritize the IP from the **Static** lease.
* If multiple **Dynamic** leases are present for the same hostname, all of them will be ignored.
* If multiple **Static** leases are found for the same hostname or MAC address, all of them will also be ignored.
* A single MAC address can resolve to multiple IPs, provided all its leases are **Dynamic**.

## Reverse DNS

NS1 also acts as a reverse DNS (rDNS) resolver for the internal network segment, pointing to the hostname .int.bksp.in.

**Example:**

```none
$ host "10.0.2.123"
123.2.0.10.in-addr.arpa domain name pointer timekeeper.int.bksp.in.
```

## Best Practices

To avoid complications, we recommend the following best practices:

* Create a static DHCP lease for your device with a designated hostname.
* Avoid creating multiple leases for the same MAC address.
* Avoid creating multiple leases for the same hostname.
* If your device is mission-critical, consider assigning a static address directly on the device, and also manually create a corresponding static DHCP lease to prevent overlaps.

## Known Issues

### The device has multiple network interfaces using the same hostname.

This can result in multiple Dynamic DHCP leases being created, which may cause hostname-based resolution to fail. **You can avoid it by:**

* Creating a Static DHCP lease for only one preferred interface.
* Using MAC-based resolution instead.

---

**Documents**

- [BKSP 101](https://wiki.bksp.in/s/public/doc/bksp-101-HvrtlzB32F)
- [Проекты](https://wiki.bksp.in/s/public/doc/proekty-yjWZscgTvo)
- [Infrastructure](https://wiki.bksp.in/s/public/doc/infrastructure-VPKsJwVSVh)
- [Пространство](https://wiki.bksp.in/s/public/doc/prostranstvo-UF1eSbQDi5)
- [Equipment](https://wiki.bksp.in/s/public/doc/equipment-t5MYAVJ8l0)
- [Other](https://wiki.bksp.in/s/public/doc/other-uPW1YJQaRt)