In the previous video, we already write a script to do network automation using netmiko. 2
The script is to send show command to the router. 3
Now In this video, we are going to learn how to configure the router using netmiko 4
Let’s see the documentation first, here to send show command, we can use send_command, 5
but if we want to send configuration command, we need to use send_config_set. 6
What is the differences between this two method? 7
If we use send_config_set, netmiko will automatically send configure terminal 8
and end command. 9
Here we can see the output, in the first, we have config term command, 10
and then in the end, we have end command. 11
This two command is sent automatically by netmiko. 12
And then here for the send_config_set method, the argument is a list, so we can write the 13
cisco command to do configuration on the list, and then send it to the router using send_config_set. 14
Let’s just try it, go to sublime. 15
Now let’s write a command to create loopback interface on the router. 16
List_config, and then let’s write the cisco command, 17
Interface loopback0, 18
Ip address 10.1.1.1 255.255.255.255 19
Let’s also create loopback1, so here interface loopback1, ip address 10.1.1.2 255.255.255.255 20
Now let’s execute this command, output, conn, this is the connection variable 21
that we already defined before, and then send_config_set list_config. 22
Now let’s print the output. 23
Save, let’s run the script 24
Okay here we can see that we configure loopback0 and loopback1, and then print the interface. 25
And here we can see that now we have loopback0 and loopback1. 26
If we see here, we have configure terminal and end command, once again, 27
this command is sent to the router automatically by netmiko. 28
Okay I think enough for this video, I hope you understand the differences 29
between send_command and send_config_set. 30
Thank you for watching and see you on the next video.