cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
16151
Views
0
Helpful
5
Replies

Forcing a DHCP release and renewal

pingduck
Level 1
Level 1

I have a switch running classic IOS 15.7. One function that I am trying depends on knowing if it is disconnected from DHCP server. The switch port is connected to another switch and it gets its IP using DHCP. e.g.

 

int Vlan 1

 ip dhcp client lease 0 0 1

 ip address dhcp

 

I found that "ip dhcp client lease" will sometime be overrode by the server's lease duration. If the server specified a longer duration, the client will obey.

 

I know about "release dhcp" and "renew dhcp" commands. However, I found that "renew dhcp" only renews but does not release and it also cannot renew while the release is in progress. 

 

The only workaround I found is shut and no shut the vlan interface. I am trying to avoid any config change. Any other ideas?

5 Replies 5

Hi,

 

You said "I found that "renew dhcp" only renews but does not release and it also cannot renew while the release is in progress. " When you renew dhcp, do you want to receive a different IP address than it was assigned before? Also, if dhcp release is in progress, I believe it should wait to renew; I do not see any problem with that. 

 

HTH,

Meheretab

HTH,
Meheretab

I want to give up the current DHCP IP and obtain a new one. That way, I know if the DHCP server is reachable or not. The issue with renew not happening when release is in progress is that "release dhcp" will not perform renew after address is released. Therefore, I cannot tell if DHCP server is alive or not.

Thank you for the additional information!

When you do renew dhcp you are asking the DHCP server to renew your current lease; as a result, you will get the same IP address again and again unless you clear it on the DHCP server (eg. clear ip dhcp binding x.x.x.x). You still have the chance of getting the same IP address if it is the first device requesting for IP address after releasing it. 

 

On the other hand, when you do release dhcp you are asking the DHCP server to release the IP address leased to your device; it will not ask for new IP address unless you initiate a separate dhcp request. So, one of the solution is to bounce the SVI (shut/ no shut) as you did. The other alternative is to use renew dhcp command.

 

One way to know whether DHCP server is reachable is using IP SLA.

 

HTH,

Meheretab

HTH,
Meheretab

Unless I am missing something, "renew dhcp" does not work. When DHCP server is not available, renew dhcp does not give any errors. Interface still has an IP. It is business as usual.

 

As for IP SLA. There is no guarantee that the DHCP server will answer to ping. In fact, DHCP server could just be a proxy and the real one is not even on the same LAN. On the other hand, answering pings does not mean the DHCP service is still functional.


@pingduck wrote:

Unless I am missing something, "renew dhcp" does not work. When DHCP server is not available, renew dhcp does not give any errors. Interface still has an IP. It is business as usual.

 


Please run debug dhcp detail, then run renew dhcp while the DHCP server is not available and post the output here.

 


@pingduck wrote:

 

As for IP SLA. There is no guarantee that the DHCP server will answer to ping. In fact, DHCP server could just be a proxy and the real one is not even on the same LAN. On the other hand, answering pings does not mean the DHCP service is still functional.


Since DHCP server is listening on UDP port 67, you can use udp-echo in IP SLA. For example, if your server is 1.1.1.1, you can add something like udp-echo 1.1.1.1 67 inside your ip sla operation. There is also dhcp operation to track ip addresses inside IP SLA (I, personally, never used it).

 

SW1(config-ip-sla)#?
IP SLAs Entry configuration commands:
dhcp DHCP Operation
dns DNS Query Operation
exit Exit Operation Configuration
ftp FTP Operation
http HTTP Operation
icmp-echo ICMP Echo Operation
path-echo Path Discovered ICMP Echo Operation
path-jitter Path Discovered ICMP Jitter Operation
tcp-connect TCP Connect Operation
udp-echo UDP Echo Operation
udp-jitter UDP Jitter Operation

 

 

 

HTH,

Meheretab

HTH,
Meheretab
Review Cisco Networking products for a $25 gift card