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/sending.

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 FastEthernet0/1",
    "switchport mode trunk",
    "switchport trunk allowed vlan 100,200-400",
]
net_connect_ios.send_config_set(commands)

We can then log in to the device and confirm the changes have been made.

Members Only Content
Join today and get access to:
  • Full deep-dive course library (inc. Batfish, pyATS, Netmiko)
  • Code repositories inc. full course code, scripts and examples
  • 24x7 Multi-vendor labs (Arista, Cisco, Juniper)
  • Private online community
  • Monthly online meetups

100% Satisfaction Guaranteed!
Cancel your membership at any time.


Join Today
Close You've successfully subscribed to Packet Coders.
Close Success! Your account is fully activated, you now have access to all content.
Close Welcome back! You've successfully signed in.
Close Nearly there! To activate your account, please click the link in the email we just sent you.