My current local domain is lan
.
Context: Newbie in networking. I dynamically create LXC containers in Proxmox. I want to configure the containers with Ansible, but I need an IP address or hostname for that. Proxmox can't tell me what IP addresses the DHCP server assigns to containers without ugly workarounds, but I can choose a hostname.
Suppose I give a container the hostname subdomain.mydomain.com
. The following domains resolve:
subdomain
subdomain.lan
The following domains don't resolve:
subdomain.mydomain
subdomain.mydomain.com
subdomain.mydomain.lan
Since there are different deployment environments, I expect to be able to resolve FQDNs, such as subdomain.mydomain.com
, to avoid conflicts with domains starting with the same label, such as app.dev.mydomain.com
and app.prod.mydomain.com
.
I could rely on one domain level; flatten the DNS structures, and prepend a unique deployment identifier to hostnames, but I want to stay as close as possible to what the production environment looks like, and keep project porting work as close to zero as possible.
I may link to the resources I tried to apply after I slept over my hours long shotgun debugging session. I think, unsure on the details and outcomes, I tried to do the following:
- Lua cgi script to resolve mac addresses to IP addresses since I know container mac addresses. I didn't use the script because I would've needed to patch several libraries. Probably also not future-proof, I would need to port the script to other distros, such as pfSense, I assume.
- Develop a python web API for Proxmox to get IP addresses by VM ids using shell commands inside containers, which didn't work well due to different distros and poor performance.
- Use some sort of script,
/etc/hotplug.d/dhcp/00-custom.???
, which should've enabled subdomain support, but didn't. - Selective DNS forwarding with
uci add_list dhcp.@dnsmasq[0].server="/mydomain.com/192.168.0.1"
- Replace
/lan/
with/lan/mydomain.com/
.