This lesson is part of the Network Configuration with Netmiko Course.
In this lesson, we will cover:
- The different Netmiko methods used for configuring a device.
- How to send a list of configuration commands to a device.
- How to read and send configuration commands from a file.
- How to save/commit the configuration on a device with Netmiko.
The scripts and code for this lesson can be found within the Netmiko repo under the directory: examples/002_device_interaction
.
Config Set
Netmiko provides the method send_config_set()
. This method takes a list()
of commands, and then applies them to the device. Like so:
commands = [
"interface Ethernet8",
"switchport mode trunk",
"switchport trunk allowed vlan 100,200-400",
]
ios_connection.send_config_set(commands)
We can then log in to the device and confirm the changes have been made.