How can I set a search domain (and other resolv.conf parameters) in Ubuntu?

Solution 1:

Assuming you are using Ubuntu and a connection named "Wired connection"

edit /etc/NetworkManager/system-connections/Wired connection and add the following:

[ipv4]
method=auto
dns-search=a1.domain.com;a2.domain.com;a3.domain.com;

Solution 2:

I think you can set your "search domain" right in Network Manager.

  1. Right-click on nm-applet
  2. Select Edit Connections
  3. Click on auto eth0 and select Edit
  4. click on the ipv4 Settings tab, and fill in the search domsins line (may have to select automatic (DHCP) addresses only from the dropdown list.)

Hope that helps.

Solution 3:

If you add the proper parameters to your dhclient.conf, they will get put into the resolv.conf when it is rewritten

supersede domain-name "mydomain.com"

might be what you're looking for. Check the man page or online documentation for dhclient for more details.