Feature #2391

Add DNS search domain to context packages

Added by Javi Fontan over 7 years ago. Updated over 7 years ago.

Status:ClosedStart date:10/17/2013
Priority:NormalDue date:
Assignee:Javi Fontan% Done:


Target version:Release 4.4
Resolution:fixed Pull request:


Right now the context packages add DNS servers but not search domain.

search_dns_context.patch Magnifier (1.47 KB) Valentin Bud, 10/19/2013 12:25 PM

Associated revisions

Revision 9044b649
Added by Javi Fontan over 7 years ago

feature #2391: changed variable SEARCH to SEARCH_DOMAIN

SEARCH is too generic and could be mistanken with some other ot may be used
in the future for other things.

Revision 113881d9
Added by Javi Fontan over 7 years ago

feature #2391: add SEARCH_DOMAIN to network context


#1 Updated by Valentin Bud over 7 years ago

Hey Javi,

I have modified the context packages to set up search domains in /etc/resolv.conf.

I have chosen SEARCH as the name of the variable to store the search domains mainly to be
consistent with resolv.conf(5) parameters.

I now have a template with the CONTEXT as follows:


I have inserted both SEARCH and ETH0_SEARCH to test the code I have written works.

Maybe you guys can create ETH0_SEARCH if NETWORK="YES" in CONTEXT like
you already do with the other ETH0_* variables.

Reading resolv.conf(5) I thought about also adding DOMAIN. This becomes tricky
when you have VMs with multiple Ethernet cards and each network has a DOMAIN. Which
domain would you choose then ETH0_DOMAIN, ETHX_DOMAIN?

But if you have only "stub" VMs with only one Ethernet card DOMAIN might come in handy.

How about HOSTNAME? How would it be better to set that?

The code has been tested to work on Debian 7.1.0 Wheezy. I think it should work
on all other Linux distributions too.

The patch is done with git format-patch master.

Good Will,

#2 Updated by Ruben S. Montero over 7 years ago

  • Tracker changed from Request to Feature
  • Assignee set to Javi Fontan
  • Target version set to Release 4.4

#3 Updated by Javi Fontan over 7 years ago

Valentin, thanks for the patch. I've just uploaded it.

I'll check with my colleagues the feasibility of adding the search parameter automatically in the core. I also think it will be useful.

The hostname value will need to be changed in different places for debian and redhat. I'll take a look but I don't think this will be for release 4.4.

#4 Updated by Valentin Bud over 7 years ago

Thank you Javier for including the patch in the mainline.

I am going to take a look over the hostname for Debian and RedHat based systems
and come back with some code.

Cheers and Goodwill,

#5 Updated by Andrei Nistor over 7 years ago

In CentOS/RHEL you can set the hostname in /etc/sysconfig/network:


This will set the proper hostname and nis domain after a reboot, however to make the settings available without rebooting you have to set them using

# hostname foo.bar.net
# hostname --nis bar.net

^^^ my way of suggesting to add the NIS domain aswell if we include the hostname


#6 Updated by Javi Fontan over 7 years ago

I'm changing the variable name to SEARCH_DOMAIN as SEARCH is too generic. I'll also change the core to add this variable when using NETWORK=YES.

#7 Updated by Javi Fontan over 7 years ago

  • Status changed from Pending to Closed
  • Resolution set to fixed

I am going to close this ticket as the original fearure is already implemented. A new ticket for hostname is at:


Also available in: Atom PDF