---
title: "Domain DNS"
description: "Configure DNS records for custom domains that route to Freestyle VMs."
url: "/docs/vms/domain-dns"
---

After you [verify ownership](https://www.freestyle.sh/docs/vms/domain-verification), point the domain at Freestyle so public traffic can reach your VM mapping.


## Apex Domain

For an apex domain such as `example.com`, add an A record:

```text
Type: A
Name: @
Value: 35.235.84.134
```


## Subdomain

For a subdomain such as `app.example.com`, add an A record for the subdomain:

```text
Type: A
Name: app
Value: 35.235.84.134
```


## Wildcard Subdomain

For all subdomains under a domain, add a wildcard A record:

```text
Type: A
Name: *
Value: 35.235.84.134
```


## Check DNS

DNS changes can take time to propagate. Use `dig` to verify the record resolves to Freestyle:

```bash
dig app.example.com
```

Expected answer:

```text
;; ANSWER SECTION:
app.example.com.       60      IN      A       35.235.84.134
```

If the answer shows a name such as `app.example.com.example.com`, your DNS provider probably appended the zone name. Change the record name to the relative name, such as `app`, instead of the full hostname.


## Route Traffic

DNS only sends traffic to Freestyle. To send traffic to a VM, create a domain mapping:

```ts
await freestyle.domains.mappings.create({
  domain: "app.example.com",
  vmId: "your-vm-id",
  vmPort: 3000,
});
```

See [Domain Mappings](https://www.freestyle.sh/docs/vms/domain-mappings) for mapping and cleanup examples.
