
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.
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.
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:
Key advantages demonstrated:
#!/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()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.
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.
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:
{# 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:
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;
}
}
}
}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.
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.
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.
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.
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.
| 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 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.
Ready to explore automation strategies that match your business needs? Contact Netodata’s experts to design the right network automation roadmap for your enterprise.