1 00:00:03,780 --> 00:00:06,190 Okay, Snake, we don't need you. 2 00:00:10,830 --> 00:00:16,140 I don't mind Python as in the programming language, but I don't particularly like snakes. 3 00:00:16,170 --> 00:00:22,400 You can watch this video as an example where I had a encounter with a black mamba in Africa. 4 00:00:22,410 --> 00:00:27,420 When that snake bites you, you've got about 30 minutes to live or 60 minutes, and then you're dead. 5 00:00:59,850 --> 00:01:04,019 So fortunately nothing happened, but it was a very close encounter. 6 00:01:04,530 --> 00:01:08,130 In this video, I'm going to show you how to back up iOS configurations. 7 00:01:08,130 --> 00:01:10,490 I'm going to show you two methods to do that. 8 00:01:10,500 --> 00:01:14,760 The first method is using cron, which is very similar to Cron on Linux. 9 00:01:14,760 --> 00:01:17,070 It basically allows you to schedule things. 10 00:01:17,070 --> 00:01:21,810 So we're going to schedule automated backups of Cisco routers and switches. 11 00:01:22,290 --> 00:01:25,020 You can back up the configurations, you can do other things. 12 00:01:25,200 --> 00:01:31,140 In a previous video, which I've linked here, I showed you how to use TCL scripts to do things, but 13 00:01:31,140 --> 00:01:34,560 you can use Cron to schedule TCL scripts. 14 00:01:34,560 --> 00:01:37,230 The second method is to use archiving. 15 00:01:37,680 --> 00:01:42,000 Both these methods have been available in the Cisco iOS for a while. 16 00:01:42,270 --> 00:01:46,830 I don't need Mr. Python here because we are not going to be using Python. 17 00:01:47,130 --> 00:01:53,220 In other videos, I have shown you how to use Python to backup configuration, so have a look at this 18 00:01:53,220 --> 00:01:53,700 video. 19 00:01:53,730 --> 00:01:54,990 If you're interested in doing that. 20 00:01:54,990 --> 00:02:00,540 I'll also create some updated videos because my Python videos on YouTube are quite old at this point. 21 00:02:00,840 --> 00:02:05,790 But again, Cron has been available in the Cisco iOS for a while. 22 00:02:06,920 --> 00:02:15,050 As you can see here, it's been available since 12.2 on some versions of iOS, so it's been available 23 00:02:15,050 --> 00:02:16,040 for a while. 24 00:02:16,430 --> 00:02:18,620 Archiving provides you with many features. 25 00:02:18,620 --> 00:02:21,500 It's also been available in the Cisco iOS for a while. 26 00:02:21,650 --> 00:02:26,060 So as you can see here, 12 to 12.3. 27 00:02:26,420 --> 00:02:28,970 It's also available in Cisco, ICSI. 28 00:02:29,710 --> 00:02:32,200 Okay, as always, because this is YouTube. 29 00:02:32,200 --> 00:02:35,450 I need to ask you, please subscribe to my YouTube channel. 30 00:02:35,470 --> 00:02:40,780 Please like this video if you find it useful and please click on the bell to get notifications when 31 00:02:40,780 --> 00:02:42,250 I post a new video. 32 00:02:43,110 --> 00:02:44,500 Okay, so I've spoken enough now. 33 00:02:44,530 --> 00:02:45,610 Let's get started. 34 00:02:45,640 --> 00:02:47,770 I'm using a Janus three topology here. 35 00:02:48,580 --> 00:02:51,340 I've got three Cisco routers. 36 00:02:51,340 --> 00:02:57,380 These are just traditional Cisco routers in my example and router two show version. 37 00:02:57,400 --> 00:03:03,010 Notice we're using the iOS version 15.6 to T. 38 00:03:03,400 --> 00:03:06,030 So this is just standard Cisco iOS. 39 00:03:06,040 --> 00:03:07,180 It's not iSCSI. 40 00:03:08,100 --> 00:03:10,920 I've also got a ubuntu server here. 41 00:03:11,280 --> 00:03:15,270 The server is actually the toolbox server available in genius three. 42 00:03:15,570 --> 00:03:22,250 And what's nice about this docker container engine is three is we have tftp. 43 00:03:23,160 --> 00:03:25,470 So if I go to the ftp boot directory. 44 00:03:27,100 --> 00:03:34,600 There are a bunch of files already here, but what I'll do is I'll remove all the files in this directory. 45 00:03:34,930 --> 00:03:40,900 So Liz now shows us that there are no directories in this TFTP boot directory. 46 00:03:41,590 --> 00:03:44,440 No files currently exist in this directory. 47 00:03:44,650 --> 00:03:51,130 But what's nice about this docker container is that it runs a FTP server. 48 00:03:51,280 --> 00:03:55,720 Now if you've got a Windows PC, you could use different FTP servers. 49 00:03:56,260 --> 00:04:00,610 You could use SolarWinds, which is a free FTP server, and I've linked that below. 50 00:04:00,610 --> 00:04:03,190 Or you could use TFTP 32 as an example. 51 00:04:03,190 --> 00:04:05,920 There are multiple or 64 if you prefer. 52 00:04:05,950 --> 00:04:13,150 There are multiple TFTP server options available for free so you don't have to pay for a TFTP server 53 00:04:13,150 --> 00:04:13,720 today. 54 00:04:14,900 --> 00:04:15,120 Okay. 55 00:04:15,160 --> 00:04:21,550 So this ubuntu host has a IP address of ten .1.322. 56 00:04:21,880 --> 00:04:24,790 That's the IP address that we're going to back up configs to. 57 00:04:25,180 --> 00:04:30,130 Now on router two, that's the router here in our topology. 58 00:04:30,580 --> 00:04:34,540 You could do this on multiple routers, but I'll just do this on router two. 59 00:04:35,110 --> 00:04:36,700 I'm going to use the command cron. 60 00:04:36,700 --> 00:04:38,650 So kr0n. 61 00:04:38,650 --> 00:04:44,470 In this example, I need to specify a policy list and an occurrence. 62 00:04:45,130 --> 00:04:51,190 So basically what are we going to do and how often are we going to run the commands? 63 00:04:51,690 --> 00:04:54,670 Okay, so cron, let's say policy list. 64 00:04:54,700 --> 00:04:55,570 Give it a name. 65 00:04:55,570 --> 00:04:59,050 So let's say backup config, whatever name you like. 66 00:04:59,050 --> 00:05:00,790 So just give it some kind of name. 67 00:05:01,210 --> 00:05:08,710 And then what we're going to do is run a CLI command and in this example I'm going to type show run 68 00:05:09,400 --> 00:05:13,180 type redirect to FTP. 69 00:05:13,480 --> 00:05:16,960 And again, you could use CEP or something else if you want. 70 00:05:17,290 --> 00:05:21,400 The Ubuntu host has this IP address once again. 71 00:05:21,400 --> 00:05:24,130 So ten one three, two. 72 00:05:25,240 --> 00:05:26,560 So I'll paste that in. 73 00:05:27,290 --> 00:05:34,430 And give it a name, let's say r to show run cfg. 74 00:05:34,730 --> 00:05:38,240 So that's the file name where we're going to save the configuration. 75 00:05:39,260 --> 00:05:41,680 Okay, cron occurrence. 76 00:05:41,690 --> 00:05:43,190 So give it a name. 77 00:05:43,190 --> 00:05:47,480 Let's say backup every minute, whatever you want to use. 78 00:05:47,600 --> 00:05:51,590 Notice here we have two options in how often are we going to run this? 79 00:05:51,590 --> 00:05:55,940 So in one minute, in my example or at a specific time. 80 00:05:56,330 --> 00:06:03,650 So I'm going to say in one minute we can specify minute or hour, minutes or days, hours and minutes. 81 00:06:03,650 --> 00:06:11,900 So in one minute recurring, what I'm going to do is run the policy list of backup config. 82 00:06:11,900 --> 00:06:13,520 So scrolling up. 83 00:06:14,400 --> 00:06:17,970 That's the policy that we created back up config. 84 00:06:18,090 --> 00:06:19,740 So that's the one that we're going to run. 85 00:06:20,910 --> 00:06:23,430 So end and that's all you need to do really. 86 00:06:23,430 --> 00:06:24,480 So show. 87 00:06:24,510 --> 00:06:32,520 Cron schedule shows us that our backup will run in 38 seconds, 35 seconds, 34 seconds. 88 00:06:32,850 --> 00:06:35,400 Going back onto the TFTP server. 89 00:06:36,300 --> 00:06:44,250 Notice we don't have a configuration on the TFTP server because it's going to run in 23 seconds. 90 00:06:44,880 --> 00:06:46,440 Before that runs, let's do a debug. 91 00:06:46,440 --> 00:06:49,890 So debug cron all so that we can see what's going on. 92 00:06:50,460 --> 00:06:52,230 Show Cron schedule once again. 93 00:06:52,230 --> 00:06:53,760 14 seconds to go. 94 00:06:53,790 --> 00:06:56,340 No config on the TFTP server. 95 00:06:56,790 --> 00:06:59,550 9 seconds 7 seconds. 96 00:06:59,550 --> 00:07:00,900 Sorry about this delay. 97 00:07:00,930 --> 00:07:03,120 I'll speed this up if you like in future. 98 00:07:03,600 --> 00:07:05,550 Now, one of the things I want you to see is notice. 99 00:07:05,550 --> 00:07:10,910 Before it ran it was inactive, but as soon as it ran, it became active. 100 00:07:10,920 --> 00:07:12,840 So it's active while it's running. 101 00:07:12,840 --> 00:07:16,140 And you can see here, this is what happened. 102 00:07:16,260 --> 00:07:21,180 The command was called show run redirect config to the TFTP server. 103 00:07:21,330 --> 00:07:27,660 So that command has run, it'll run again in 56 seconds or 16 seconds in this example. 104 00:07:28,020 --> 00:07:29,850 Notice the config is there. 105 00:07:29,850 --> 00:07:33,600 If I type more are to config. 106 00:07:33,630 --> 00:07:38,630 Notice there is the running configuration of my router. 107 00:07:38,640 --> 00:07:43,170 It's been backed up to the TFTP server. 108 00:07:43,410 --> 00:07:45,210 Now it's actually just run again. 109 00:07:46,230 --> 00:07:49,830 So the config has been backed up once again. 110 00:07:50,340 --> 00:08:00,600 So I could remove this or in this example, let's just move it to our 2v1 config. 111 00:08:01,080 --> 00:08:04,980 So Liz now shows us that we've got the old config here. 112 00:08:05,340 --> 00:08:13,200 When this runs again in 31 seconds, we'll get to the new configuration on the TFTP server. 113 00:08:13,500 --> 00:08:20,010 Now one of the questions people often ask is, okay, how do I get a timestamp and I'll show you that 114 00:08:20,010 --> 00:08:21,780 using the archive method. 115 00:08:22,110 --> 00:08:26,030 Okay, so it's just run list again. 116 00:08:26,100 --> 00:08:28,200 Notice there's our configuration. 117 00:08:28,560 --> 00:08:39,240 So once again more are to see if there's a running configuration backed up to the TFTP server. 118 00:08:40,140 --> 00:08:40,270 Okay. 119 00:08:40,380 --> 00:08:41,940 So that's the first method cron. 120 00:08:42,539 --> 00:08:45,660 You can get this to do many types of things. 121 00:08:46,800 --> 00:08:49,890 They've got some examples on the Cisco website. 122 00:08:49,890 --> 00:08:52,690 You can find a lot of examples of this online as well. 123 00:08:52,710 --> 00:08:55,980 You can get it to run TCL or tickle scripts. 124 00:08:55,980 --> 00:08:57,840 You can get it to do all kinds of things. 125 00:08:57,870 --> 00:09:02,190 It's basically a scheduler, just like you have in Unix or Linux. 126 00:09:02,980 --> 00:09:05,520 Okay, next one is archiving. 127 00:09:06,620 --> 00:09:06,890 Okay. 128 00:09:06,980 --> 00:09:10,370 Archiving allows you to do a lot more than just back up configs. 129 00:09:10,370 --> 00:09:14,780 You can restore configurations, you can have a history of configurations. 130 00:09:14,900 --> 00:09:17,960 Very nice feature available on Cisco iOS. 131 00:09:19,630 --> 00:09:22,660 So in global config mode archive. 132 00:09:26,240 --> 00:09:27,530 What option are we going to use? 133 00:09:27,530 --> 00:09:29,990 We're going to use log config. 134 00:09:30,290 --> 00:09:33,170 So we're going to log our configuration. 135 00:09:33,440 --> 00:09:38,000 And actually you can see here, cron has just run. 136 00:09:38,000 --> 00:09:46,910 So what I'll do actually is turn off the debug so do an all basically disable debugging that's not part 137 00:09:46,910 --> 00:09:48,050 of the archive command. 138 00:09:48,050 --> 00:09:51,560 So just so that doesn't get confusing, I'll do that again. 139 00:09:52,490 --> 00:10:03,140 I typed archive and then I typed a log config pressed enter and now what I'm going to do here is enable 140 00:10:03,140 --> 00:10:04,100 logging. 141 00:10:04,520 --> 00:10:15,620 So logging enable I'm going to hide keys which basically suppresses output e.g. passwords when displaying 142 00:10:15,620 --> 00:10:16,880 logged commands. 143 00:10:16,880 --> 00:10:19,700 We don't particularly want our passwords displayed. 144 00:10:19,700 --> 00:10:20,900 So hide keys. 145 00:10:21,500 --> 00:10:23,840 The next step is exit. 146 00:10:23,840 --> 00:10:28,400 And what we want to do here is specify a path. 147 00:10:29,410 --> 00:10:30,460 Notice the options. 148 00:10:30,460 --> 00:10:31,660 There are many options here. 149 00:10:31,660 --> 00:10:33,370 We could use flash. 150 00:10:33,370 --> 00:10:36,760 So a right to the configurations, to the flash or the router. 151 00:10:37,120 --> 00:10:42,580 We can send it to a TFTP server, we can send it to a secure copy server. 152 00:10:42,580 --> 00:10:51,070 But in our example I'm simply going to use tftp so tftp forward slash forward slash ip address of the 153 00:10:51,070 --> 00:10:56,800 TFTP server is this ten 132 154 00:10:59,500 --> 00:11:00,340 and. 155 00:11:01,100 --> 00:11:08,630 What I'm going to do here is specify a date, so notice dollar H, hyphen or dash. 156 00:11:09,080 --> 00:11:15,590 What I also want to do is back up the configuration whenever the configuration is saved. 157 00:11:15,740 --> 00:11:21,950 So as soon as I save the configuration, I want to write it to the archive. 158 00:11:22,920 --> 00:11:25,650 You can also specify time period now. 159 00:11:25,680 --> 00:11:28,110 Typically you don't want to do it as I'm doing it. 160 00:11:28,110 --> 00:11:34,200 You have one minute you might use a value like this, which is once a week, but in my example, I'm 161 00:11:34,200 --> 00:11:41,580 just going to specify one minute because I want it to back up continuously now to show archive. 162 00:11:43,220 --> 00:11:49,040 This is the most recent configuration so it's actually backed it up a ready to the. 163 00:11:49,890 --> 00:11:52,800 TFTP server show clock. 164 00:11:52,830 --> 00:12:00,990 Notice the date 12 September the time 11 4958 so this got backed up at 232. 165 00:12:01,350 --> 00:12:06,120 That is the most recent configuration and that's what I'm seeing here. 166 00:12:06,630 --> 00:12:08,280 Now clear the screen, Ellis. 167 00:12:08,730 --> 00:12:15,720 L Notice we can see another configuration has been backed up, so we now have two configurations on 168 00:12:15,720 --> 00:12:16,860 the TFTP server. 169 00:12:17,070 --> 00:12:22,800 And if I type show archive on the router notice we can see most recent configuration is there. 170 00:12:23,370 --> 00:12:23,640 Okay. 171 00:12:23,640 --> 00:12:24,780 So let's do that again. 172 00:12:25,110 --> 00:12:30,450 As soon as I type w or so, write my configuration and then type show archive. 173 00:12:30,510 --> 00:12:36,080 Notice an archive was made back on the Ubuntu server. 174 00:12:36,090 --> 00:12:40,020 There's our newest archive show archive. 175 00:12:41,100 --> 00:12:41,630 Right. 176 00:12:41,670 --> 00:12:42,870 The configuration. 177 00:12:44,370 --> 00:12:45,540 Show Archive. 178 00:12:45,570 --> 00:12:46,860 This is the most recent one. 179 00:12:46,860 --> 00:12:49,950 Now back on the TFTP server. 180 00:12:49,980 --> 00:12:51,330 Originally we had two. 181 00:12:51,360 --> 00:12:57,600 Now we've got three and it's actually done another archive because I'm making it archive every minute. 182 00:12:58,800 --> 00:13:07,220 So copy, run, start, save the configuration back on the TFTP server. 183 00:13:07,230 --> 00:13:10,740 Notice we've got another backup of configuration. 184 00:13:11,900 --> 00:13:12,040 Okay. 185 00:13:12,200 --> 00:13:13,580 So that was fairly simple. 186 00:13:14,060 --> 00:13:23,300 I've shown you how to archive the router's configuration and point it to a TFTP path. 187 00:13:23,840 --> 00:13:26,050 It's going to run every minute in my example. 188 00:13:26,060 --> 00:13:32,060 Now that's probably way too much, but just for this demonstration that works. 189 00:13:32,270 --> 00:13:37,670 It's also going to archive the configuration when I save the configuration. 190 00:13:38,090 --> 00:13:39,190 Show Archive. 191 00:13:39,200 --> 00:13:42,800 Notice we can have up to ten displayed on the router. 192 00:13:42,800 --> 00:13:47,990 So what I'll do is I'll simply do a bunch more. 193 00:13:48,020 --> 00:13:50,450 So do another one. 194 00:13:52,360 --> 00:13:55,240 Notice we are at nine as a number here. 195 00:13:55,420 --> 00:13:56,560 Do another one. 196 00:13:58,850 --> 00:14:01,940 Show Archive Notice ten is the most recent. 197 00:14:03,240 --> 00:14:05,130 Notice we lost zero there. 198 00:14:06,570 --> 00:14:07,890 Say that again. 199 00:14:09,060 --> 00:14:10,320 Notice we're at 11. 200 00:14:10,320 --> 00:14:12,180 We lost one. 201 00:14:12,510 --> 00:14:15,420 But those configs still exist on my TFTP server. 202 00:14:15,420 --> 00:14:17,420 So there's the original config. 203 00:14:17,430 --> 00:14:19,200 Notice where all the way to 11. 204 00:14:19,410 --> 00:14:24,390 So these are two great ways to automate the backup of router configurations. 205 00:14:25,530 --> 00:14:26,850 Once again, show run. 206 00:14:27,390 --> 00:14:30,120 I'll use forward slash here to search for archive. 207 00:14:31,320 --> 00:14:39,570 There's our archive configuration and as always, I'll put this below the video and here is the cron 208 00:14:39,570 --> 00:14:40,680 configuration. 209 00:14:41,400 --> 00:14:42,090 Now with KRON. 210 00:14:42,090 --> 00:14:44,850 One thing I forgot to show you is the option. 211 00:14:44,970 --> 00:14:47,880 So I'll just paste that configuration in here. 212 00:14:48,090 --> 00:14:54,870 Notice with KRON you can get it to run at a certain time. 213 00:14:54,870 --> 00:15:01,380 So notice at 11 p.m. sunday reoccurring and the policy that's going to run is this one. 214 00:15:01,530 --> 00:15:04,830 So show run forward slash kron. 215 00:15:06,060 --> 00:15:08,520 I've got it running every minute. 216 00:15:08,790 --> 00:15:10,200 Probably want to remove that. 217 00:15:10,350 --> 00:15:13,260 And then I've got it running every Sunday evening. 218 00:15:13,680 --> 00:15:17,790 The issue here is it's going to overwrite the config on the TFTP server. 219 00:15:18,150 --> 00:15:20,260 Archiving makes this a lot easier. 220 00:15:20,280 --> 00:15:28,980 Very simple configuration to archive your config to a TFTP server or FTP server or secure copy server 221 00:15:28,980 --> 00:15:33,150 every week, every minute, whatever you decide to do. 222 00:15:34,340 --> 00:15:34,570 Okay. 223 00:15:34,620 --> 00:15:36,750 So hopefully you found this video useful. 224 00:15:36,750 --> 00:15:38,100 If you have, please. 225 00:15:38,100 --> 00:15:39,180 Would you like it please? 226 00:15:39,180 --> 00:15:44,070 Would you subscribe to my YouTube channel and please click on the bell to receive notifications when 227 00:15:44,070 --> 00:15:45,540 I upload a new video.