0

I want to setup a cisco router to be a DHCP relay but i want to answer dhcp requests locally if the DHCP Relay request won't answer.

In the other word, I want to setup a dhcp relay with fail safe(Which assign ip from its own DHCP pool)

Ali
  • 111
  • 6

1 Answers1

1

You can do that with an event and an ip sla to remove the commands on the failover detection. From there I'd configure conflict detection on your primary DHCP, and possibly split scope as defined in the article below.

The below example would probably need to be modified slightly but should work simply enough.

ip sla 10

icmp-echo DHCP-SERVER-IP

timeout 200

frequency 5

ip sla schedule 10 life forever start-time now

track 1 rtr 10 reachability

event manager applet PRIMARY-DHCP-OFFLINE

event track 1 state down

action 5.0 cli command "enable"

action 5.1 cli command "conf t"

action 5.3 cli command "ip dhcp excluded-address 10.10.10.1"

action 5.4 cli command "ip dhcp pool backup"

action 5.5 cli command "network 10.10.10.1 255.255.255.0"

action 5.6 cli command "default-router 10.10.10.1"

action 5.7 cli command "lease 0 12"

action 5.8 cli command "exit"

action 5.9 cli command "end"


event manager applet PRIMARY-DHCP-ONLINE

event track 1 state up

action 6.0 cli command "enable"

action 6.1 cli command "conf t"

action 6.2 cli command "no ip dhcp pool backup"

action 6.3 cli command "no ip dhcp excluded-address 10.10.10.1"

action 6.4 cli command "end"

If your primary DHCP server is windows the below article for configuring split scope which would ensure the server doesn't tromp over any IPs the DHCP

https://blogs.technet.microsoft.com/teamdhcp/2009/01/22/how-to-configure-split-scope-using-wizard/

You would also want to configure duplicate IP detection on windows just in case as well.

https://technet.microsoft.com/en-us/library/dd183587(v=ws.10).aspx

PHELMS
  • 92
  • 1
  • 9
  • Is there any better solution? It is a tricky solution. but i want cisco to do this for each request. Some other router link mikrotik has such config. – Ali Feb 26 '17 at 14:30
  • You could try configure dhcp like normal and on the cisco router add a delay so the server responds first. Make sure you have conflict detection on both – PHELMS Feb 26 '17 at 16:28
  • Thanks for your report. But when i setup the dhcp server on cisco, The dhcp relay wont work. My question is how to use both of them on cisco. – Ali Feb 27 '17 at 07:28
  • Are you using an ip-helper on the router? Do you have an output of your sh ip dhcp relay to see if it sees the server as a trusted source and is relaying the information? – PHELMS Feb 28 '17 at 02:56
  • The "sh ip dhcp relay information trusted-sources" command has empty result. – Ali Feb 28 '17 at 08:00
  • Could you post the config, at least the relevant dhcp parts? – PHELMS Feb 28 '17 at 08:05