Smart proxy for MS DHCP not working

Problem: when I try to import a subnet I get this error:

“uninitialized constant DhcpsApi::Win2008::Subnet. Did you mean? DhcpsApi::Subnet”

Expected outcome: The subnet will be imported.

Foreman and Proxy versions: 1.18

Foreman and Proxy plugin versions: 1.18 and dhcpsapi version 0.0.11

Other relevant data: MS DHCP on Windows Server 2012R2.

I already ask on github at dhcpsapi : https://github.com/dmitri-d/ruby-dhcpsapi/issues/6 but unfortunately with no luck.
When I try to get a free ip address, the message is:

29 Jul 12:25 WARN The specified subnet 172.24.20.0 does not exist on the DHCP server
29 Jul 12:25 INFO 172.30.110.11 - - [29/Jul/2019:12:25:58 +0200] “GET /dhcp/172.24.20.0/unused_ip HTTP/1.1” 200 11 0.0013

But the subnet exists on the DHCP Server.

Have anyone an idea ?

Best regards
Martin

I don’t have Windows Server too so I can hardly comment on that one. Dmitri moved on and he is no longer involved in Foreman. Anyone has a working Windows DHCP setup?

What is the future of this feature @Marek_Hulan?

Any updates on this? Running into same issue on 1.21.3 and same MS DHCP Windows Server 2012. Would appreciate any help.

I am currently researching how to get MSDN license, our team currently don’t have any MS Server available :wink:

It would be great to fix it, I can manage a reproducing env if that helps.

I have a Windows Server installed in libvirt. The only issue is time now :slight_smile:

Just sharing my latest tests where things were working

Note: no issues to import subnets from the Windows Smart Proxy

Satellite 6.6 (1.22.0.3)
Windows: MS DHCP on Windows Server 2012R2 with (1.22.0)

Using the DNS and DHCP features on the Windows box.

Configuration applied on smart-proxy on the Windows system:

# grep -v "#" settings.yml
---
:ssl_ca_file: C:\smart-proxy\ssl\katello-server-ca.crt
:ssl_certificate: C:\smart-proxy\ssl\win-fqdn-foreman-proxy.crt
:ssl_private_key: C:\smart-proxy\ssl\win-fqdn-foreman-proxy.key

:trusted_hosts:
- satellite-fqdn

:forward_verify: false

:bind_host: '0.0.0.0'
:http_port: 8000
:https_port: 9090

:log_file: 'C:\smart-proxy\smart-proxy.log'
:log_level: DEBUG

:log_buffer: 2000
:log_buffer_errors: 1000
# grep -v "#" dhcp.yml
---

:enabled: https

:use_provider: dhcp_native_ms
:server: 192.168.1.5

# grep -v "#" dns.yml

---
:enabled: https

:use_provider: dns_dnscmd
:dns_ttl: 86400
1 Like

Can you share your installation steps as well.

I believe I took the following steps for the installation:

  1. Install https://github.com/oneclick/rubyinstaller2/releases/download/RubyInstaller-2.4.9-1/rubyinstaller-devkit-2.4.9-1-x64.exe

  2. Download your required smart-proxy version https://github.com/theforeman/smart-proxy/releases

  3. On the Windows machine open “Start Command Prompt with Ruby”

  4. Run the following commands

# gem install --no-ri --no-rdoc bundler
# cd <smart-proxy location>
# bundle install --without development test krb5 puppet_proxy_legacy bmc libvirt
1 Like

I wish there was an Ansible Playbook we could link from here, so many users struggle and our documentation is sparse on this topic. Thanks a bunch for sharing your experience!

Hi,

I have the same issue as described above in foreman 1.23.1.
I have a domain controller on one site that still runs 2008.
Foreman proxy 1.23.1 is installed and works fine.
I have installed the same proxy version on a 2012R2 version with similar settings and no IP is returned to the foreman on request.

The logs of the proxy show a warning while manually suggesting for an IP upon host creation;

|Jan 29, 11:57:43 AM|WARN|The specified subnet 172.22.13.0 does not exist on the DHCP server|

But the subnet does exist on my DHCP Domain controller.
And the dhcp.yml contains the correct content;

image

In the domain controller the cmd prompt shows;

172.22.0.2 - - [29/Jan/2020:12:55:09 Romance Standard Time] “GET /dhcp/172.22.13
.0/unused_ip?from=172.22.13.2&to=172.22.13.100 HTTP/1.1” 200 11

  • → /dhcp/172.22.13.0/unused_ip?from=172.22.13.2&to=172.22.13.100
    172.22.0.2 - - [29/Jan/2020:12:55:23 Romance Standard Time] “GET /dhcp/172.22.13
    .0/unused_ip?from=172.22.13.2&to=172.22.13.100 HTTP/1.1” 200 11
  • → /dhcp/172.22.13.0/unused_ip?from=172.22.13.2&to=172.22.13.100
    172.22.0.2 - - [29/Jan/2020:14:40:18 Romance Standard Time] “GET /version HTTP/1
    .1” 200 79

On my old foreman 1.12.4 this works without issues while using an older proxy version 1.11 , I can’t figure out how to resolve it for the new proxy.
Is there a fix for this issue of some other things I can try ?
Kinda blocked right now to proceed further.

Also is there some workaround ?
Because when I set IPAM to “none” in the subnet that I need to create a machine in, and set boot mode to static instead of DHCP it still returns an error on creation of the machine;

Hey, can you try to checkout this Ruby library and run the integration tests against your DHCP server?

Hi,

Thanks for your quick reply.
However I believe I’m already using that one;
Here is how I installed the new proxy;

I can only upload one screenshot per reply so here is some more info;

2020-01-31 09_36_03-Window

Can you run those tests? See the project README on how to do that.

Ok we found the solution.
We modified the test scripts you asked to run to this simple code:

image

We executed the ruby scripts and it provided this error:

https://serverfault.com/questions/856333/foreman-smart-proxy-microsoft-dhcp-unknown-error-5

Turns out I either didn’t start the smart-proxy previously as local Administrator like I used to with the old version.
I did add my own user to the DHCP administrators group now and it’s working both with and without elevated Administrator rights.

So for anyone having the same issue, please check under what user the smart-proxy runs and if this user is either a local admin on the DHCP controller or a user in the DHCP administrators group.

1 Like