Setting DNS search domain with Connection Manager

I’m currently running OSMC 2024.10-1 on a Vero 4K+, and would like to set the DNS search domain (.lan) in order to resolve names on my local network (e.g. vero4k.lan).

Looking at /etc/resolv.conf, I can see it’s managed by Connection Manager.

osmc@osmc:~$ cat /etc/resolv.conf
# Generated by Connection Manager
nameserver ::1
nameserver 127.0.0.1

I’ve configured a static IP via the My OSMC GUI, which is reflected by the connmanctl output.

osmc@osmc:~$ connmanctl services ethernet_c44eac28xxxx_cable
/net/connman/service/ethernet_c44eac28xxxx_cable
  Type = ethernet
  Security = [  ]
  State = online
  Favorite = True
  Immutable = False
  AutoConnect = True
  Name = Wired
  Ethernet = [ Method=auto, Interface=eth0, Address=C4:4E:AC:28:xx:xx, MTU=1500 ]
  IPv4 = [ Method=manual, Address=10.0.1.252, Netmask=255.255.255.0, Gateway=10.0.1.1 ]
  IPv4.Configuration = [ Method=manual, Address=10.0.1.252, Netmask=255.255.255.0, Gateway=10.0.1.1 ]
  IPv6 = [  ]
  IPv6.Configuration = [ Method=off ]
  Nameservers = [ 10.0.1.249 ]
  Nameservers.Configuration = [ 10.0.1.249 ]
  Timeservers = [  ]
  Timeservers.Configuration = [  ]
  Domains = [  ]
  Domains.Configuration = [  ]
  Proxy = [ Method=direct ]
  Proxy.Configuration = [  ]
  mDNS = False
  mDNS.Configuration = False
  Provider = [  ]

Based on the man page, I should be able to set the search domain using the --domains argument (“Set the list of search domains, separated by spaces.”).

osmc@osmc:~$ connmanctl config ethernet_c44eac28xxxx_cable --domains 'lan'
osmc@osmc:~$ connmanctl services ethernet_c44eac28xxxx_cable
/net/connman/service/ethernet_c44eac28xxxx_cable
  Type = ethernet
  Security = [  ]
  State = online
  Favorite = True
  Immutable = False
  AutoConnect = True
  Name = Wired
  Ethernet = [ Method=auto, Interface=eth0, Address=C4:4E:AC:28:xx:xx, MTU=1500 ]
  IPv4 = [ Method=manual, Address=10.0.1.252, Netmask=255.255.255.0, Gateway=10.0.1.1 ]
  IPv4.Configuration = [ Method=manual, Address=10.0.1.252, Netmask=255.255.255.0, Gateway=10.0.1.1 ]
  IPv6 = [  ]
  IPv6.Configuration = [ Method=off ]
  Nameservers = [ 10.0.1.249 ]
  Nameservers.Configuration = [ 10.0.1.249 ]
  Timeservers = [  ]
  Timeservers.Configuration = [  ]
  Domains = [ lan ]
  Domains.Configuration = [ lan ]
  Proxy = [ Method=direct ]
  Proxy.Configuration = [  ]
  mDNS = False
  mDNS.Configuration = False
  Provider = [  ]

However, the setting doesn’t seem to have any effect (even after restarting connman.service) as resolv.conf doesn’t include the search directive, and I can only query names with the local domain suffixed:

osmc@osmc:~$ host vero4k.lan
vero4k.lan has address 10.0.1.252
osmc@osmc:~$ host vero4k
Host vero4k not found: 3(NXDOMAIN)

I’ve also set the search domain as a DHCP option (119) on my DHCP server, but it doesn’t seem to get picked up by Connection Manager either if I switch to a dynamic IP address. The search domain seems to be set OK by other Linux and Mac clients on the network.

Are search domains not supported on OSMC, or is there some setting and/or mechanism I’m not aware of? Thanks!

Here is the output in my AVM fritz box environment:

connmanctl> services ethernet_900eb3350d6f_cable
/net/connman/service/ethernet_900eb3350d6f_cable
...
IPv4.Configuration = [ Method=dhcp ]
...
Domains = [fritz.box ]
Domains.Configuration = [  ]
...

This domain concept of top-level and second-level should generally work.

As far as I could research, a simple name like “lan” would be called a ‘dotless domain’. The ICANN board decided 2013 that such domains are prohibited, see New gTLD Dotless Domain Names Prohibited.
So, this is the first time that I heard that someone tries to use such exotic domain name (domain without a second-level part). I’m not wondering that this is not working with connman.

I have search domains working on my OSMC setups here with UniFi.

But my domain is set to nazarko.co.uk which is a valid TLD. I’ve never tested on a suffix like .foo

ConnMan definitely doesn’t have code to check validity of domains, but something else may be getting in the way. Maybe your DHCP is discarding it?

Turns out you were right. Setting the domain to home.arpa (which is the recommended name for residential networks) seemed to do the trick.

  Domains = [ home.arpa ]
  Domains.Configuration = [ home.arpa ]

Now Connection Manager is able to resolve the names, too:

osmc@osmc:~$ host vero4k
vero4k has address 10.0.1.252
osmc@osmc:~$ host vero4k.home.arpa
vero4k.home.arpa has address 10.0.1.252

I kind of expected it to update /etc/resolv.conf as well, but I guess it’s using an internal DNS proxy instead.

1 Like

ConnMan behaved the same regardless whether I was using a dynamic or a static IP, so I don’t think DHCP was to blame here.

What’s puzzling is that all my other clients were happily resolving names with the .lan domain, while OSMC and ConnMan steadfastly refused to play ball. But as you said, something else could well be getting in the way.

I suppose starting ConnMan with the -r/--nodnsproxy argument could’ve been another option, but setting up another resolver would probably end up being more trouble than it’s worth.

Do not act as a DNS proxy or support external DNS resolving. Depending on how ConnMan is compiled, it will by default direct all DNS traffic to itself by setting nameserver to 127.0.0.1 in resolv.conf(5) file or leave DNS management to an external entity, such as systemd-resolved.

If you want to disable the internal proxy then you can do so via /etc/osmc/prefs.d. Then we will directly write to resolv.conf.