# Register lxcs from proxmox into dnsmasq

**URL:** <https://discourse.pi-hole.net/t/register-lxcs-from-proxmox-into-dnsmasq/80063>\
**Category:** Customizing Pi-hole\
**Created:** [May 23, 2025, 7:25pm UTC](https://discourse.pi-hole.net/t/register-lxcs-from-proxmox-into-dnsmasq/80063 "2025-05-23T19:25:35Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Martin\_Cleaver](https://discourse-cdn.pi-hole.net/user_avatar/discourse.pi-hole.net/martin_cleaver/32/43459_2.png) [@Martin\_Cleaver](https://discourse.pi-hole.net/u/Martin_Cleaver)\
**Post date:** [May 23, 2025, 7:25pm UTC](https://discourse.pi-hole.net/t/register-lxcs-from-proxmox-into-dnsmasq/80063/1 "2025-05-23T19:25:35Z")

</div>

Hi all,

I run proxmox, and give the machines names that I want to appear in the local DNS.

I've searched the docs and forums, but don't see an official solution.

ChatGPT sats, **Pi-hole's official API** doesn't yet support adding _Local DNS Records_ directly. But if you're using **Pi-hole v5.0+** , you can directly modify `/etc/pihole/custom.list` and then reload DN

So, I was thinking of the following.. what do you think?

```auto
#!/bin/bash

# Config
PIHOLE_HOST="pi.hole.local" # or IP of your Pi-hole
PIHOLE_USER="pi" # SSH user on Pi-hole
PIHOLE_CUSTOM_LIST="/etc/pihole/custom.list"
TMPFILE="/tmp/custom.list"

# Create a temp file with updated DNS entries
> "$TMPFILE"
for cid in $(pct list | awk 'NR>1 {print $1}'); do
  name=$(pct config "$cid" | grep ^hostname | awk '{print $2}')
  ip=$(pct exec "$cid" -- hostname -I | awk '{print $1}')
  echo "$ip $name.lan" >> "$TMPFILE"
done

# Send to Pi-hole and reload DNS
scp "$TMPFILE" "$PIHOLE_USER@$PIHOLE_HOST:/tmp/custom.list"
ssh "$PIHOLE_USER@$PIHOLE_HOST" "sudo mv /tmp/custom.list $PIHOLE_CUSTOM_LIST && sudo pihole restartdns"

echo "✔️ Updated Pi-hole DNS with LXC entries."

```

Thanks, Martin

---

<div class="post-metadata">

**Author:** ![Martin\_Cleaver](https://discourse-cdn.pi-hole.net/user_avatar/discourse.pi-hole.net/martin_cleaver/32/43459_2.png) [@Martin\_Cleaver](https://discourse.pi-hole.net/u/Martin_Cleaver)\
**Post date:** [May 23, 2025, 7:45pm UTC](https://discourse.pi-hole.net/t/register-lxcs-from-proxmox-into-dnsmasq/80063/2 "2025-05-23T19:45:07Z")

</div>

ChatGPT just suggested also:

### 🧪 Want to Try Another Approach?

If you're interested in making it even more dynamic:

- Use `dnsmasq` on Proxmox directly and point Pi-hole to it as upstream.
- Or run `avahi-daemon` in LXCs for `.local` mDNS resolution without static DNS.
