TL;DR
Netmiko, NAPALM and Nornir are layers, not rivals. Start with Netmiko for SSH and CLI work, use NAPALM when you want vendor-neutral getters and config changes you can diff, and reach for Nornir when you need inventory and parallel runs across more than a handful of boxes.
Every few weeks somebody in a network engineering forum asks some flavor of the same question: “Should I learn Netmiko, NAPALM or Nornir?” The thread fills up with strong opinions, half of them arguing past each other, because the question itself has a bug in it. These three tools don’t really compete. They stack, like a transmission, a diagnostic port and a dispatcher, and once you see how they layer, the “which one” question mostly answers itself.
I’ve been turning wrenches on networks for over 20 years, and I came up through the analog ’80s and the tech ’90s (a Tandy 286, a BBS on the family phone line, and a grounding to show for it). I came to Python after years of PHP, so I remember exactly what it feels like to stare at three library names and not know where to start. This is the post I wish somebody had handed me.
Versions here were checked against PyPI and the official docs on November 17, 2026: Netmiko 4.8.0, NAPALM 5.2.0, Nornir 3.6.1, nornir-netmiko 1.0.1, nornir-napalm 0.6.0 and nornir-utils 0.3.0. If you’re reading this a year from now, check again. (Don’t take my word for it; take PyPI’s.)
They’re Not Rivals; They’re a Stack
Here’s the mental model. Netmiko sits closest to the metal: it opens an SSH session, finds the prompt, sends a command, and figures out when the device is done talking. NAPALM sits on top of a transport (on Cisco IOS and NX-OS over SSH, that transport is literally Netmiko) and gives you the same method names across vendors, so get_facts() means the same thing on Arista as it does on Juniper. Nornir sits above both of them. It doesn’t talk to devices at all on its own; it holds your inventory, runs tasks across many hosts in parallel, and hands the actual device work to plugins.
| Netmiko | NAPALM | Nornir | |
|---|---|---|---|
| What it is | Multi-vendor SSH/CLI library | Vendor-neutral abstraction layer | Inventory + task runner framework |
| You give it | A command string | A getter name or a candidate config | A task function and a filtered inventory |
| You get back | Raw text, or parsed lists/dicts via TextFSM, TTP or Genie | Normalized Python dicts and a config diff | Per-host results, failures and diffs |
| Config changes | send_config_set(), line by line | Merge or replace, compare, commit, rollback | Whatever the plugin does (dry run built in) |
| Concurrency | One session per object; you bring the threads | One device per object | Threaded runner, default 20 workers |
| Best first job | Pulling show output from one odd box | Facts, inventory and diffable config pushes | Doing either of those across the fleet |
One more time for the folks in the back: you don’t pick one forever. Don’t be surprised when your requirements file ends up listing all three.
Netmiko: The Manual Transmission
When my family moved from Ohio to Georgia, I drove a 26-foot moving truck with a manual transmission the whole way down I-75, blasting Whitesnake. Was it fancy? No. Did I feel every gear change, every hill and every time I got it wrong? Absolutely. Netmiko is that truck. You’re close to the road, you send the exact CLI you would have typed, and you get back exactly what the device printed.
Kirk Byers built Netmiko on top of Paramiko to take the misery out of SSH to network gear: handling prompts, paging, enable mode, config mode and the endless little quirks of each platform. The platform list is long, which is the whole point; if it has a CLI and an SSH server, there’s a decent chance Netmiko already knows how to drive it.
A small Netmiko example
This connects to one IOS router, grabs show ip interface brief as parsed data, and prints anything that isn’t up. Credentials come from environment variables, not from the script (more on that later).
import os
from netmiko import ConnectHandler
device = {
"device_type": "cisco_ios",
"host": "10.0.0.11",
"username": os.environ["NET_USER"],
"password": os.environ["NET_PASS"],
"secret": os.environ.get("NET_ENABLE", ""),
"session_log": "rtr1-session.log",
}
with ConnectHandler(**device) as conn:
conn.enable()
rows = conn.send_command("show ip interface brief", use_textfsm=True)
for row in rows:
if row["status"] != "up":
print(f'{row["interface"]:<24} {row["status"]}/{row["proto"]}')
# A slow command gets more time, not a magic delay_factor
tech = conn.send_command("show tech-support", read_timeout=300)
A few things worth pointing out. The with block guarantees the session gets closed even if a command blows up. The use_textfsm=True flag runs the output through the ntc-templates TextFSM library, which Netmiko installs as a dependency, so instead of a wall of text you get a list of dicts with keys like interface, ip_address, status and proto. If you prefer Cisco’s parsers, use_genie=True does the same job through Genie, but you have to install pyATS and Genie yourself first. Netmiko will tell you so, politely, the first time you forget.
The last line is the one that saves people the most grief. In Netmiko 4.x the old delay_factor knob is deprecated (the source says it’s slated for removal in Netmiko 5), and the replacement is read_timeout, which is just “how many seconds am I willing to wait for this command to finish.” The default for send_command() is 10 seconds. A show tech on a busy chassis will blow right past that, so tell it the truth up front.
NAPALM: Same Question, Every Vendor
If Netmiko is the manual transmission, NAPALM is the OBD-II port. Every car built for the US market since 1996 has one in roughly the same spot, and any scan tool can ask it the same questions no matter who built the engine. NAPALM does that for network gear. You ask get_interfaces() or get_bgp_neighbors() and you get back the same dictionary shape whether the box runs EOS, Junos, IOS-XR or IOS.
Under the hood, each driver uses whatever transport the platform does best. Per the NAPALM support matrix, EOS uses pyeapi, Junos uses junos-eznc, IOS-XR has a NETCONF driver built on ncclient, NX-OS can use NX-API, and both IOS and NX-OS over SSH ride on Netmiko. The core drivers that ship with NAPALM 5.2.0 are eos, ios, iosxr, iosxr_netconf, junos, nxos and nxos_ssh; other platforms live in community drivers.
The getters are handy, but the real reason I’d steer a team toward NAPALM is the configuration workflow. You load a candidate (merge it into the running config, or replace the whole thing), ask the device what would change, and only then decide whether to commit or throw it away. After a commit you can roll back to what was there before. On platforms that support it (EOS, Junos and IOS, per the matrix), commit_config(revert_in=300) gives you a commit-confirm: if you don’t call confirm_commit() in five minutes, the device puts it back on its own.
A small NAPALM example
This pulls facts, stages an NTP change as a merge, and shows the diff before anything goes live. If the diff is empty, the device already matches and nothing happens.
# configs/ntp.cfg
ntp server 10.0.0.123
ntp server 10.0.0.124
import os
from napalm import get_network_driver
driver = get_network_driver("ios")
device = driver(
hostname="10.0.0.11",
username=os.environ["NET_USER"],
password=os.environ["NET_PASS"],
optional_args={"secret": os.environ.get("NET_ENABLE", "")},
)
with device:
facts = device.get_facts()
print(facts["hostname"], facts["os_version"])
device.load_merge_candidate(filename="configs/ntp.cfg")
diff = device.compare_config()
if not diff:
print("Already compliant. Nothing to do.")
device.discard_config()
else:
print(diff)
if input("Commit this? [y/N] ").lower() == "y":
device.commit_config()
else:
device.discard_config()
Notice the input() prompt. A human looks at the diff before the commit, every time, until you trust the pipeline enough to replace that human with a test. That gate is the whole game.
Before you point the IOS driver at production, read its caveats page. Go on, read it. I’ll wait. The short version: config replace and the diff depend on the IOS archive feature and SCP (ip scp server enable), the replace file has to look like a real IOS config down to the indentation, banners need the actual ETX character instead of a caret and a C, and self-signed certificates hide a tab character that will make a replace fail in ways that feel personal. None of that is NAPALM being difficult; it’s IOS being IOS.
Nornir: The Dispatcher With the Clipboard
Nornir is the dispatcher at the trucking company. It doesn’t drive anything. It knows every truck in the fleet, which ones are in Atlanta, which ones run IOS, and how many it can send out at once, and it hands each driver the same set of instructions. The drivers are plugins.
That distinction matters because of how Nornir 3 is packaged. The core package gives you the inventory, filtering, the runners and the result objects. The device work lives in separate plugin packages: nornir_netmiko for Netmiko tasks like netmiko_send_command, nornir_napalm for napalm_get and napalm_configure, and nornir_utils for helpers like print_result. If an old tutorial tells you to from nornir.plugins.tasks.networking import ..., that’s Nornir 2 talking, and it won’t work on 3.x.
The default runner is threaded with 20 workers, which you can tune in the config file. One nice touch: if you set platform: ios on a host, nornir_netmiko maps it to Netmiko’s cisco_ios automatically, so one inventory serves both plugins without duplicating platform names.
A small Nornir example
Here’s the whole thing, inventory included. Three routers, two of them in Atlanta, one in Charleston.
inventory:
plugin: SimpleInventory
options:
host_file: inventory/hosts.yaml
group_file: inventory/groups.yaml
defaults_file: inventory/defaults.yaml
runner:
plugin: threaded
options:
num_workers: 10
# inventory/hosts.yaml
rtr1:
hostname: 10.0.0.11
groups: [cisco_ios]
data:
site: atl
rtr2:
hostname: 10.0.0.12
groups: [cisco_ios]
data:
site: atl
rtr3:
hostname: 10.0.1.11
groups: [cisco_ios]
data:
site: chs
# inventory/groups.yaml
cisco_ios:
platform: ios
# inventory/defaults.yaml is just {}
import os
import sys
from nornir import InitNornir
from nornir.core.filter import F
from nornir_napalm.plugins.tasks import napalm_configure
from nornir_netmiko.tasks import netmiko_send_command
from nornir_utils.plugins.functions import print_result
nr = InitNornir(config_file="config.yaml")
nr.inventory.defaults.username = os.environ["NET_USER"]
nr.inventory.defaults.password = os.environ["NET_PASS"]
atl = nr.filter(F(site="atl"))
# 1. Look before you leap: Netmiko plugin, parsed output
check = atl.run(task=netmiko_send_command,
command_string="show ntp associations",
use_textfsm=True)
print_result(check)
# 2. Dry run: NAPALM loads the candidate, diffs it, then discards it
plan = atl.run(task=napalm_configure,
filename="configs/ntp.cfg",
dry_run=True)
print_result(plan)
if plan.failed:
sys.exit(f"Failed hosts: {list(plan.failed_hosts)}")
changes = [h for h, r in plan.items() if r[0].changed]
if not changes:
sys.exit("Every host is already compliant.")
# 3. Commit only on the hosts that actually showed a diff
if input(f"Commit on {changes}? [y/N] ").lower() == "y":
push = atl.filter(filter_func=lambda h: h.name in changes).run(
task=napalm_configure, filename="configs/ntp.cfg", dry_run=False)
print_result(push)
Walk through what that does. It filters to the Atlanta hosts, reads NTP associations with the Netmiko plugin, then runs napalm_configure with dry_run=True, which loads the candidate, computes the diff and discards it. Only hosts that actually showed a diff get offered for the real commit. This exact script was tested against NAPALM’s mock driver with one compliant router and one that wasn’t: the filter dropped the Charleston box, the compliant router reported changed: False, and the commit only went to the router that needed it.
Also notice plan.failed. Nornir doesn’t stop the world when one device times out; it records the exception on that host and keeps going. That’s a feature, right up until you forget to check it and assume all 200 boxes took the change.
So Which One Should You Use?
Here’s how I’d break it down, with the caveat that “it depends” is always lurking (sorry, I’m a network engineer; it’s in the contract).
[One weird box, one question] Use Netmiko. If you need show inventory from a platform NAPALM doesn’t cover, or you need a command NAPALM doesn’t have a getter for, Netmiko plus TextFSM is the shortest path from “I wonder” to a CSV.
[Same question across vendors] Use NAPALM getters. Facts, interfaces, LLDP neighbors, BGP state and the rest come back normalized, so your reporting code doesn’t need an if-statement per vendor.
[Config changes you want to see before they happen] Use NAPALM’s merge or replace with compare_config(). If your platform supports commit-confirm, use that too.
[More than a handful of devices] Wrap either one in Nornir. The moment you catch yourself writing a for-loop over a CSV of IPs, and then a ThreadPoolExecutor around that loop, and then a dictionary to track which ones failed, you’ve started building a worse Nornir by hand.
If you’re brand new, start with Netmiko and read-only commands. It teaches you what the device is actually doing, and that knowledge doesn’t go to waste when you move up the stack.
The Pitfalls That Bite
Prompt detection and timing
Netmiko figures out when a command is finished by watching for the prompt. Most of the time that just works. It gets weird with commands that ask a question (“Destination filename [startup-config]?”), commands that change the prompt (hostname changes, entering a different context), and banners or login messages that look prompt-ish. The fixes are in the API: expect_string tells send_command() exactly what pattern to wait for, send_command_timing() waits for output to go quiet instead of waiting for a prompt, and read_timeout covers the slow stuff. Turn on session_log while you’re debugging; it shows you the conversation from the device’s side.
Resist the urge to sprinkle time.sleep() calls around until it works. That’s not a fix; that’s a timing bug with a nap scheduled in it.
Idempotency
Run a Netmiko config push twice and it sends the commands twice. Some lines are harmless when repeated; others (ACL entries without sequence numbers, anything that appends) are not. The nornir_netmiko netmiko_send_config task reports changed=True every single time because it has no way to know better, and it raises an error if you ask it for a dry run. NAPALM is different: napalm_configure sets changed based on whether the diff is empty, and when there’s nothing to change, it discards the candidate. That’s what makes a scheduled compliance job safe to run every night.
Secrets handling
Keep passwords out of the script and out of hosts.yaml. Environment variables (as in the examples), a vault lookup, or SSH keys are all better than a plaintext password in a Git repo that somebody will eventually make public by accident. Netmiko’s session log masks the login password and enable secret with asterisks, which is good, but it does not know that your show run output contains SNMP communities and keys, so treat those log files like the config backups they basically are. And check host key behavior: both Netmiko and NAPALM’s SSH-based drivers default ssh_strict to False, which means unknown host keys get accepted. In a lab, fine. In production, think about it.
Dry run and compare before commit
I have personally caused a midnight outage in a hospital IDF, and the lesson I took from it (and from my mentor’s blunt feedback afterward) was about humility, not tooling. The tooling lesson came later: make the change prove itself before it goes live. With NAPALM that means compare_config() every time, a human or a test reviewing the diff, and discard_config() as the default when anything looks off. With Nornir it means running the whole play with dry_run=True first. Slow is smooth, smooth is fast.
One more gotcha from the docs: on IOS, the diff only lines up properly if your candidate’s indentation exactly matches the running config, and on NX-OS, merge diffs are described as very simplistic. An ugly diff doesn’t always mean a bad change, and a clean diff doesn’t guarantee a good one. Read it like you mean it. And when an automation run does go sideways anyway (it will, eventually), run a blameless postmortem on the pipeline, not the person who pressed Enter.
Where Ansible, Scrapli and pyATS Fit
Ansible plays in the same space as Nornir, just from the other direction: YAML playbooks and vendor collections instead of plain Python. If your team doesn’t write Python and wants guardrails, it’s a fine choice. If you do write Python, Nornir lets you debug with the same tools you use for everything else, which I find a lot less painful than reverse-engineering why a Jinja filter did something creative.
Scrapli is the modern alternative to Netmiko: a screen-scraping client for network devices with sync and async support over Telnet, SSH or NETCONF. It has its own Nornir plugin (nornir_scrapli). If you’re building something that leans on asyncio to talk to a lot of devices at once, it’s worth a look.
pyATS and its Genie library are Cisco’s test framework and parser collection. They shine at “learn the state of this network, change something, and prove nothing else broke.” You’ll bump into Genie early, because it’s what Netmiko’s use_genie=True calls.
And yes, if you’re letting agentic AI draft some of this code for you (I’ve written about why that train is already moving), the compare-before-commit gate matters twice as much. A script you didn’t type is still a script you’re responsible for.
Pick One Box and Start Reading
If you’re still running everything through a terminal window and a notepad full of commands, here’s your homework. Pick one lab device (or one boring production switch you trust), install Netmiko in a virtual environment, and write a script that pulls one show command as parsed data. That’s it. Next week, point NAPALM at the same box and run get_facts() and a dry-run merge. The week after, put both behind a three-host Nornir inventory.
If you’re setting up a fresh Python for this, my Python 3.15 notes for network engineers cover what changed in the interpreter and how lazy imports speed up Netmiko-heavy CLI tools.
Nobody figured this stuff out by reading about it. You figure it out by breaking a lab router at 11 PM and finding out why. Go break something (in the lab).
73, and happy automating.

No responses yet