TransWikia.com

How do I (correctly) manage/update search domains with systemd?

Unix & Linux Asked on December 26, 2021

I have a system (running Ubuntu 20.04) with multiple network interfaces and I realized that the search domains (I’m looking at /etc/resolv.conf, which I know is just a symlink to a systemd-resolved managed file) are getting added automatically as soon as I plug in a new cable. That’s nice!

Unfortunately, when doing the reverse (i.e., disconnecting a cable), the search domain entries are left untouched, creating all sorts of unwanted side-effects.

Example:

  • Plug cable into eno1:
    #$> cat /etc/resolv.conf
    nameserver 127.0.0.53
    options edns0
    search mydomain.com
    #$>
    
  • Plug cable into eno2:
    #$> cat /etc/resolv.conf
    nameserver 127.0.0.53
    options edns0
    search mydomain.com additionaldomain.com
    #$>
    
  • Unplug cable out of eno2:
    #$> cat /etc/resolv.conf
    nameserver 127.0.0.53
    options edns0
    search mydomain.com additionaldomain.com
    #$>
    

As far as I understand, I could reboot the system or edit the appropriate files manually; but as soon as I plug a cable back in, I’m back to square one.

What program manages the search domain entries in resolv.conf, and how do I "force" an update of those entries?

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP