Persistent DHCP bindings stored in NVRAM

If you'd like to implement persistent DHCP bindings on Cisco IOS, but cannot store them on an external server, you could always use the on-board NVRAM. Simply configure ip dhcp database nvram:dhcp.txt. Later on, you can examine the contents of the dhcp.txt file with more nvram:dhcp.txt command.

9 comments:

Vaidotas Dilys said...

Would it be more wise to put file in flash?

Ivan Pepelnjak said...

You might have a problem with flash file if you don't have disk-like flash memory (the show file systems should display your flash: as a disk filesystem).

John Coke said...

Can you elaborate on the use of non-disk-like flash types?

Ivan Pepelnjak said...

If you have a “traditional” flash file system, the files never disappear, they are just marked as deleted (and you have to squeeze it manually). As you have to store the DHCP bindings in a file whenever something changes (after a short delay, of course), you could have a lot of old versions left in the flash after a while … not something I would want to have in a production network.

John Coke said...

Makes sense. On that note if you're running DHCP on an ISR you shouldn't have that issue since the flash is formatted Class C, correct?

Ivan Pepelnjak said...

Well, new ISR routers come with class-C formatted flash, older ones are still formatted as class-B (but can be reformatted into class-C).

DCDenT said...

how can I format a flash in C format?

Ivan Pepelnjak said...

It's described here. I knew I've been writing about it already, so I've entered "format flash" into the "Search blog" input field (top left) :))

Lalufu said...

I noticed today that writing the DHCP binding to nvram has one drawback (at least on the 2801): writing to NVRAM seems to be a very CPU intensive operation, for whatever reason, so, using the default values and some DHCP activity your CPU usage will spike to 100% every 5 minutes.

Writing to flash seems to be much better in this regard.

Ivan Pepelnjak, CCIE#1354, is the chief technology advisor for NIL Data Communications. He has been designing and implementing large-scale data communications networks as well as teaching and writing books about advanced technologies since 1990. See his full profile, contact him or follow @ioshints on Twitter.