In the previous video, we already learn how to configure multiple router at once. 2
Here we can see that we looping from 1 until 5. And then here we connect to 10.10.10.1 3
until 10.10.10.5 using looping. 4
Looping like this actually is not best practice. 5
Now the ip address of all router is in sequence. But how if the ip address 6
of all router is not in sequence, let’s say we have 1, and then 11, and then 20, 35, and others, 7
Or, how if the ip address of all router is not similar like this? 8
For now the first 3 number is same, which is 10.10.10, 9
How if the ip address of all router is totally different? 10
So we can not configure multiple router at once using this way. 11
The solution is, we can save the ip address of all router in the list, 12
and then we do looping on the list. 13
Let’s just try, let’s just copy this, create new file, the name is paramiko_looping_list.py, 14
And then paste the script. 15
First we need to create the list of ip address, 16
so here list_ip and then let’s put the ip address of router 1 until router 5 here. 17
Let’s start with router 1, 10.10.10.1, 10.10.10.2 for router 2, 10.10.10.3 for router 3, 18
10.10.10.4 for router 4, and last 10.10.10.5 for router 5. 19
Here the script is to long, we can enter it after the comma, 20
let’s say after 3 router, we can enter like this. 21
Okay now the script is look good. 22
now we have the list of ip address, next we can looping to this list. 23
Let’s change this variable to ip, you are free to use anything here, 24
because this is just a variable. 25
And then let’s change this become the name of the list. 26
Here for the connect, we don’t need f string anymore, we can just put the ip variable. 27
Because the value of ip variable is 10.10.10.1, so we don’t need f string anymore. 28
Here for the print, let’s also change this become ip variable. 29
Okay and then here configure terminal, interface loopback 3, let’s change this become loopback4, 30
and the ip address will be same on all router. Let’s say 10.5.1.1, 31
so the ip address of loopback4 for all router will be same, which is 10.5.1.1 32
We will learn how to configure different ip address for each router later in the next video. 33
And then do write here to save the configuration, last here we send command to see the interface. 34
Okay, save, let’s execute this script, 35
Let’s login to ubuntu server using ssh, ssh ubuntu@192.168.56.2 ls, 36
Let’s cd to lab_paramiko, ls again, here we can see that we have paramiko_looping_list.py, 37
let’s execute this script, 38
Just enter enter here, 39
Okay success login to router 1, create loopback4, save the configuration, 40
and here we can see that we have loopback4, the ip address is 10.5.1.1, 41
Router 2 also success, we have loopback4, the ip address is same, which is 10.5.1.1 42
Router 3 also success, router 4 also success, and last, router 5 also success. 43
Okay so now we are success configure all router at once 44
using list. 45
I think enough for this video 46
Thank you for watching and see you on the next video.