Networking configuration

Hi,

I have a question regarding network config for servers built by Foreman.
I'm running Foreman 1.8.

We use a separate VLAN for building servers, so when we build a new server,
it will typically have two nics, one for the build VLAN, which will be
removed some time after the build is complete and one for the primary
interface.

On a CentOS 7 server that has been built by Foreman, the resolv.conf
contains a "search buildnetwork.local" line rather than an entry for the
primary interface domain.

This is interfering with Puppet as facter uses the search/domain line in
resolv.conf to determine the host FQDN.

I've had a look at the kickstart_networking_setup snippet as I presume this
is what is being used to configure all aspects of networking. There seems
to be no mention of domain or (an aside) DNS servers. And as expected, the
ifcfg-<nic> files don't have any entries for DNS1,DNS2 or DOMAIN.

Am I missing a trick here?

J

I should probably also clarify that the build network uses DHCP, but we use
static network config for every other interface.

You're right, we don't touch resolv.conf and do not even configure hostname in
the network configuration snippet and we rely on DHCP for this. In another
email you mention you use static networking config so it doesn't work in you
case. But this should be handled by the provisioning template itself, see [1]
the network parameters for the case when subnet is static (Boot mode attribute
set to Static). So the hostname is determined by the primary interface of the
host, DNS servers by the subnet to which this interface is attached to. I
suppose in your case you'd need DNS to be based on provisioning interface. You
could modify the provisioning template accordingly, to access provisioning
interface, you can use @host.provision_interface, for more details see [2].

Hope this helps a bit

[1] https://github.com/theforeman/community-templates/blob/develop/kickstart/provision.erb#L56
[2]
TemplateWriting - Foreman

··· On Monday 03 of August 2015 04:45:24 jamese wrote: > Hi, > > I have a question regarding network config for servers built by Foreman. > I'm running Foreman 1.8. > > We use a separate VLAN for building servers, so when we build a new server, > it will typically have two nics, one for the build VLAN, which will be > removed some time after the build is complete and one for the primary > interface. > > On a CentOS 7 server that has been built by Foreman, the resolv.conf > contains a "search buildnetwork.local" line rather than an entry for the > primary interface domain. > > This is interfering with Puppet as facter uses the search/domain line in > resolv.conf to determine the host FQDN. > > I've had a look at the kickstart_networking_setup snippet as I presume this > is what is being used to configure all aspects of networking. There seems > to be no mention of domain or (an aside) DNS servers. And as expected, the > ifcfg- files don't have any entries for DNS1,DNS2 or DOMAIN. > > Am I missing a trick here? > > J


Marek

Hi,

Thanks for the reply.

To clarify, the hostname is definitely set correctly, but facter does not
find the domain. It could be argued either way whether facter is using the
right method to determine the domain. I personally think it's flawed and
it shouldn't use the domain entry in resolv.conf, but the actual domain
from the fqdn (hostname or hostnamectl command).

In the end, I modified the provisioning template to add DOMAIN=<%=
@host.domain %> to the ifcfg-<nic> file for the primary interface.
That means that NetworkManager correctly sets the "domain x.com" in
/etc/resolv.conf when the server boots up.

So that solves my problem.