How does Foreman import a subnet via the smart proxy

When installing foreman, I've used the installer to setup a dhcp service on
the same host. I define a network, a subnet range, name server, router, dns
search domain, etc everything you'd expect in a dhcp service, and it works
just fine.

When going into the smart proxy and clicking "import IPV4 subnets" the dhcp
configuration I've defined by the installer is detected and displayed in
the menu ready for import.

However there are fields / parameters missing from the foreman page that
are defined in the dhcp configuration on the file system.
As I'm having a seperate dhcp issue on this host where foreman offers IP's
that are already in the lease file, I thought trying to understand how the
smart proxy builds the settings it imports into foreman.

For example, I have the following dhcp config (that was generated by the
foreman installer) this is all private data on a test machine that gets
auto rebuilt most nights, so please don't worry about it being shared.

dhcpd.conf

omapi-port 7911;

key jarvis_omapi.key {

algorithm HMAC-MD5;

secret
"FFgje7gnbnsZZMBg72cYgdAGsUl6GTAdXZ+3SmwtTA13cgmHOY/UqSErvXnPppL3qwh35Ya0y7ZNrTTghQw4kbAQ==";

}

omapi-key swallow_omapi.key;

default-lease-time 43200;

max-lease-time 86400;

ddns-update-style none;

option domain-name "no-dns.local";

option domain-name-servers 192.168.10.1;

option ntp-servers none;

allow booting;

allow bootp;

option fqdn.no-client-update on; # set the "O" and "S" flag bits

option fqdn.rcode2 255;

option pxegrub code 150 = text ;

Bootfile Handoff

next-server 192.168.10.4;

option architecture code 93 = unsigned integer 16 ;

if option architecture = 00:06 {

filename "grub2/shim.efi";

} elsif option architecture = 00:07 {

filename "grub2/shim.efi";

} elsif option architecture = 00:09 {

filename "grub2/shim.efi";

} else {

filename "pxelinux.0";

}

log-facility local7;

include "/etc/dhcp/dhcpd.hosts";

no-dns.local

subnet 192.168.10.0 netmask 255.255.255.0 {

pool

{

range 192.168.10.30 192.168.10.254;

}

option subnet-mask 255.255.255.0;

option routers 192.168.10.1;

option domain-search "no-dns.local";

}

As you can see there is a range defined and there are name servers
defined.when I import the subnet, the name servers are missing. (see screen
shot attached).

I'm trying to understand how this import is worked out, does it just take
the IP details of the host it's running on, or does it try to do something
a bit smarter, such as parse the dhcpd.config it's generated / answer file
that was used to install foreman ?

I suspect it's nothing as advanced as that (I've not found it properly in
the code yet) as when I set the IP management to dhcp in the subnet menu,
it doens't auto fill in the range for me, I have to manually put it in,
suggesting it's not really parsed the dhcpd.conf or take it in from the
foreman installer options.

understanding this may assist with working through why my 1.15 install is
offering new host with IP's that are already defined in the dhcp lease file.

thanks,

Matt

> forgot to add the image
>

Hello,

this feature is very limited, we used to import only subnet address
and netmask, we slightly improved this and can now import range but
that's it.

But this is not important feature, simply define everything manually
and you are good to go. You do not need to do this very often. In case
you have many subnets, you need to use our CLI/API to define them
programatically.

··· On Sat, May 13, 2017 at 11:52 AM, Matt Darcy wrote: > >> forgot to add the image > > > > -- > You received this message because you are subscribed to the Google Groups > "Foreman users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to foreman-users+unsubscribe@googlegroups.com. > To post to this group, send email to foreman-users@googlegroups.com. > Visit this group at https://groups.google.com/group/foreman-users. > For more options, visit https://groups.google.com/d/optout.


Later,
Lukas @lzap Zapletal

Thank you for the response, I was more trying to understand how this works,
I've had a few DHCP issues with the 1.15 install and was curious how much
direct interaction with dhcpd or the dhcpd.conf file to work out
information.