Interpreting config backup file

Discussion in 'Tomato Firmware' started by haarp, May 26, 2009.

  1. haarp

    haarp LI Guru Member

    My old router more or less died due to to a lightning strike, so I got a new one (WRT54GL).
    In the meantime, 1.24 and 1.25 came out, so I installed 1.25 straight on the new router. Of course, the old config backup file can't be read back into the new firmware, as it was for 1.23. I could configure the new router by hand, but I can't remember all settings I made, which MAC address belonged to what, stuff like that.
    So my question is: How can I interpret the config file? I can unpack it and open it in a text editor and see a few useful strings, but that's about it. Is there a way to get all info in a human-readable format?
  2. averylinden

    averylinden LI Guru Member

    The .cfg backup file is a gzip'd list of null terminated name/value pairs. If you were on Linux or another unix-like system, you could do this to see all the settings:

    gzip -dc tomato_v119_m1F749D.cfg | tr '\0' '\n' | sort

    Someone else will have to chime in for how to do it in Windows.

    Edit: just realized tomato itself has those tools so you should be able to upload the cfg file to tomato and check it there :thumbup:
  3. nvtweak

    nvtweak LI Guru Member

    The same exact way as you pointed out. using Cygwin.
  4. SgtPepperKSU

    SgtPepperKSU Network Guru Member

    Those commands also work on Windows if you install a couple of GNUWin32 packages(Gzip and CoreUtils). However, you might want to modify it a bit to
    gzip -dc tomato_v119_m1F749D.cfg | tr '\n' '¿' | sort | tr '¿\0' '\n\n'
    (I used ¿ under the assumption that it isn't used anywhere in the settings. If you do, you'll have to pick something else). This allows for nvram variables that have line breaks in them (I know the VPN certificate/key variables from TomatoVPN typically have line breaks, but I'm not sure if anything in vanilla Tomato can have line breaks).

    EDIT: It looks like at there is at least one NVRAM variable with line breaks in it, so the command with the two "tr" operations in it is probably safer.
  5. haarp

    haarp LI Guru Member

    Thanks guys. As I'm using Linux, I don't have to fiddle around with Cygwin :)

    Yes, the custom scripts (WAN up, Firewall, etc.) for instance may contain newlines.
  6. SgtPepperKSU

    SgtPepperKSU Network Guru Member

    Good deal, but the GNUWin32 packages are separate from Cygwin and work from the windows command prompt... They're the only thing that makes being stuck on Windows at work bearable :wink:
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice