Technical Articles 〡 Tutorials

Network Configuration Automation: 3 Approaches for Routers and Switches

Netodata
December 13, 2025

Table Of Contents

As enterprise networks grow increasingly complex, the need for efficient, scalable, and error-free management becomes critical. One of the most powerful ways network engineering managers can meet this demand is through network configuration automation. Automating router and switch configurations reduces manual labor, minimizes human error, and accelerates deployment times—delivering both operational and business value. In this article, we’ll explore three standard approaches to network configuration automation, the skills required for each, and guidance on choosing the right fit based on your organization’s needs and resources.

1. Scripting-Based Automation: Flexible but Resource-Driven

Overview

Scripting-based automation involves using languages like Python, Bash, or Perl to automate configuration tasks. By leveraging libraries such as Netmiko, NAPALM, or PyATS, engineers can write scripts that log into routers and switches, push configuration changes, and validate results. This method is especially popular among teams that have strong in-house programming capabilities and need a custom, flexible solution. For example, Netmiko is a widely adopted Python library that simplifies SSH connections to network devices.

Practical Implementation: Netmiko with Jinja2 Templating

The following example demonstrates how to combine Netmiko with Jinja2 templating to create a scalable configuration management solution. This approach separates the configuration logic from device-specific data, making scripts more maintainable and reusable across multiple devices.

This implementation shows:

  • How to create dynamic configuration templates using Jinja2
  • SSH connection management with Netmiko’s ConnectHandler
  • Configuration deployment with built-in verification steps
  • Best practices for separating data from configuration logic

Key advantages demonstrated:

  • Template reusability: One template can configure hundreds of interfaces
  • Error reduction: Eliminates manual configuration inconsistencies
  • Validation workflow: Automatic verification ensures changes were applied correctly
  • Maintainability: Updates to templates automatically propagate to all future deployments
Python
#!/usr/bin/env python3
# Import required libraries for network automation
from netmiko import ConnectHandler  # Library for SSH connections to network devices
from jinja2 import Template         # Templating engine for dynamic configuration generation

# Jinja2 template for interface configuration
# Uses {{ variable }} syntax for dynamic content insertion
interface_template = Template("""
interface {{ interface_name }}
 description {{ description }}
 ip address {{ ip_address }} {{ subnet_mask }}
 no shutdown
""")

# Device connection parameters - dictionary containing SSH connection details
device = {
    'device_type': 'cisco_ios',    # Tells Netmiko this is a Cisco IOS device
    'host': '192.168.1.1',         # IP address of the target router/switch
    'username': 'admin',           # SSH username
    'password': 'password123'      # SSH password (use key-based auth in production)
}

# Interface configuration data - variables that will populate the template
interface_data = {
    'interface_name': 'GigabitEthernet0/1',  # Physical interface name
    'description': 'LAN_SEGMENT_A',          # Human-readable interface description
    'ip_address': '10.1.1.1',               # IP address to assign
    'subnet_mask': '255.255.255.0'          # Subnet mask for the IP
}

# Generate configuration commands from template
# render() method substitutes variables with actual values
# strip() removes extra whitespace, split('\n') creates list of commands
config_commands = interface_template.render(**interface_data).strip().split('\n')

# Connect to device and apply configuration
# 'with' statement ensures connection is properly closed after use
with ConnectHandler(**device) as conn:
    # Send configuration commands to device
    output = conn.send_config_set(config_commands)
    print(f"Configuration applied:\n{output}")
    
    # Verify the configuration was applied correctly
    verification = conn.send_command("show ip interface brief")
    print(f"Interface status:\n{verification}")
    
    # Save configuration to device's startup-config (make changes persistent)
    conn.save_config()

Required Skill Set

  • Proficiency in programming (especially Python)
  • Familiarity with CLI structure of vendor devices (e.g., IOS, JunOS)
  • Basic understanding of APIs and command parsing
  • Version control usage (e.g., Git)

Use Case Fit

This approach is ideal for businesses with skilled network engineers who have time for scripting projects and need fine-grained control over device behavior. It’s often favored in DevOps-driven environments or enterprises pursuing full CI/CD pipelines for networking.

Challenges

  • Maintenance overhead as the script library grows
  • Debugging complexity with scale
  • Lack of a unified, vendor-agnostic interface unless standardized libraries are used

Example

A regional healthcare provider used Python scripts with NAPALM to standardize access control lists (ACLs) across 50+ remote clinics. This reduced misconfiguration incidents by 40% within 3 months.

2. Configuration Management Tools: Scalable and Declarative

Overview


Tools like Ansible, Puppet, or SaltStack offer agentless or lightweight agent-based automation models with human-readable configuration files (YAML, Jinja templates). These tools are increasingly adopted for network configuration automation due to their scalability and ease of use. Unlike raw scripting, they provide more structured, declarative approaches to pushing configurations reliably and repeatably. See the official Ansible Network Automation documentation for details. An example of Jinja2 template for Juniper interfaces:

ShellScript
{# Juniper interface configuration template #}
{% for interface in interfaces %}
interfaces {
    {{ interface.name }} {
        description "{{ interface.description }}";
        unit {{ interface.unit | default(0) }} {
            family inet {
                address {{ interface.ip }}/{{ interface.mask }};
            }
        }
    }
}
{% if not loop.last %}
{# Add spacing between interfaces, but not after the last one #}

{% endif %}
{% endfor %}

The outcome, based on input variables can look similar to:

ShellScript
interfaces {
    ge-0/0/1 {
        description "LAN Interface";
        unit 0 {
            family inet {
                address 192.168.1.1/24;
            }
        }
    }
}

interfaces {
    ge-0/0/2 {
        description "WAN Interface";
        unit 0 {
            family inet {
                address 10.0.0.1/30;
            }
        }
    }
}

Required Skill Set

  • Understanding of tool-specific syntax (e.g., Ansible playbooks)
  • Familiarity with templating engines (e.g., Jinja2)
  • Basic YAML/JSON data structuring
  • Integration know-how for CI/CD pipelines (e.g., GitLab CI, Jenkins)

Use Case Fit

Suited for medium to large enterprises looking for consistent multi-device configurations across environments. Especially valuable when managing configurations across various sites with shared templates. Low barrier to entry compared to custom scripting.

Challenges

  • Learning curve around templates and syntax
  • Handling complex conditional logic across different vendors
  • May require additional tooling for inventory and state management

Example

A financial services firm deployed Ansible to automate switch port provisioning for onboarding new employees. By using standardized playbooks, the IT team reduced provisioning time per employee from 2 hours to under 10 minutes.

3. Vendor-Specific Automation Platforms: Integrated and Supported

Overview

Major networking vendors like Cisco (Cisco DNA Center), Juniper (Junos Space), and Arista (CloudVision) offer automation platforms that integrate tightly with their device ecosystem. These platforms provide GUI interfaces, REST APIs, and predefined workflows—allowing network managers to push configurations without writing code. Learn more about Cisco DNA Center as a widely used vendor-specific solution.

Required Skill Set

  • Familiarity with the vendor platform’s UI and API features
  • Basic understanding of network topology and device roles
  • Moderate knowledge of RESTful APIs (for advanced use)

Use Case Fit

Ideal for networks that are standardized on a specific vendor. These platforms support rapid onboarding, troubleshooting, and configuration enforcement with minimal setup. Particularly effective for organizations with limited internal coding skills but sufficient budget for licensing.

Challenges

  • Locked into a specific hardware vendor ecosystem
  • Licensing and subscription costs
  • Limited freedom for fully customized automation workflows

Example

An enterprise university system with a 100% Cisco switching infrastructure adopted Cisco DNA Center to automate QoS policy deployment across multiple campuses. The implementation cut deployment time from weeks to days and offered better visibility via the platform’s centralized dashboard.

Key Considerations for Choosing the Right Approach

Markdown
| Criteria                   | Scripting-Based        | Config Mgmt Tools    | Vendor Platforms      
|----------------------------|------------------------|----------------------|------------------|
| Flexibility                | High                   | Medium               | Low                   
| Vendor Independence        | High                   | Medium               | Low             
| Time to Deployment         | Medium/High            | Medium               | Low                   
| Engineer Skill Level.      | High                   | Medium               | Low/Medium            
| Cost of Tools              | Low (Open-Source)      | Low-Medium           | Medium-High                
| Scalability                | Medium                 | High                 | High                  

Conclusion: Align Automation Strategy with Capability and Goals

Network configuration automation offers significant benefits in speed, accuracy, and operational efficiency. However, the most effective approach depends heavily on your internal capabilities, existing infrastructure, and long-term network strategy.

For organizations with deep technical expertise and a variety of device vendors, scripting offers unmatched customization. If your team prefers reusable, scalable templates with minimal coding, configuration management tools like Ansible offer a sweet spot. Where vendor standardization and ease of adoption take priority, proprietary platforms may provide immediate ROI despite their long-term lock-in.

Each organization’s needs are unique—but the strategic alignment of automation with both business objectives and in-house capabilities is key. At Netodata, we help enterprises choose and implement the right network automation approach, tailored to their environment and growth plans.

Takeaway Points

  • Scripting-based automation offers high flexibility but requires advanced skill sets.
  • Configuration management tools strike a balance between structure and scalability.
  • Vendor-specific platforms provide rapid deployment but involve tradeoffs in cost and flexibility.
  • Choose automation strategies based on internal technical capabilities, budget, and infrastructure complexity.

Ready to explore automation strategies that match your business needs? Contact Netodata’s experts to design the right network automation roadmap for your enterprise.

NETWORK AUTOMATION INSIGHTS
Stay informed about the latest in network automation:
Technical deep dives - Implementation guides -
Industry best practices
Netodata official logo featuring a stylized green geometric icon and the brand name "NETODATA" in white and green typography on a transparent background.
From initial consulting to seamless implementation, we manage your network automation journey every step of the way. Our comprehensive suite of professional services caters to diverse enterprises, ranging from startups to established players.
Contact
1-234-1234
info@netodata.io
Address
Nové sady 988/2
602 00, Brno
Czech Republic
ICO: 23213035
GET IN TOUCH
Address
Netodata Labs, s.r.o. © 2026 All Rights Reserved
Nautobot icon

Nautobot

The central Source of Truth for network infrastructure data. Nautobot serves as:
Authoritative inventory database
IP address components tracking
Configuration template repository
Automation platform

Nornir

A Python automation framework specifically designed for network automation. Nornir provides:
High-performance concurrent task execution
Deep Python integration
Flexible inventory management
Fine-grained control over network operations
CI/CD

Orchestration & CD/CI

We integrate industry-standard orchestration tools to ensure reliable automation delivery:
Git-based version control
Automated pipelines
Controlled deployment workflows
Continuous integration practices

Ansible

An industry-standard automation platform that excels at network configuration management. We utilize Ansible for:
Network device configuration deployment
State validation and compliance checking
Integration with custom Python modules
Standardized workflow automation

Netbox

The central Source of Truth for network infrastructure data. NetBox serves as:
Authoritative inventory database
IP address components tracking
Configuration template repository
REST API provider for automation workflows

Python

The foundation of our automation framework, Python enables us to create modular, maintainable, and efficient network automation solutions. We leverage Python's extensive standard library and carefully selected packages to build:
Reusable automation components
Custom network management tools
API integrations
Data processing pipelines