Skip to content
LinkState
Go back

Canarying a live trunk into containerlab safely

Designing a Staged Procedure for Connecting an Isolated Lab Fabric to a Real VLAN Trunk

Introduction

Connecting an isolated lab fabric to a real VLAN trunk is a critical task that requires careful planning and execution. The lab fabric is typically used for testing and development purposes, and connecting it to a production VLAN trunk can introduce risks such as configuration errors, security breaches, and performance issues. A staged procedure is essential to ensure a smooth and safe connection, minimizing the risk of errors and downtime.

Pre-Connection Prechecks

Before connecting the lab fabric to the VLAN trunk, it is essential to verify the network configuration of both environments. This includes checking the IP addressing, subnet masks, default gateways, and DNS settings. The following CLI command can be used to verify the network configuration:

show ip int brief

This command displays a brief summary of the IP interfaces, including the IP address, subnet mask, and default gateway.

A security policy review is also necessary to ensure that the lab fabric and VLAN trunk have compatible security policies. This includes reviewing firewall rules, access control lists (ACLs), and intrusion prevention system (IPS) settings. The following code example demonstrates how to review firewall rules using a Python script:

import paramiko

# Establish SSH connection to firewall
ssh = paramiko.SSHClient()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
ssh.connect('firewall_ip', username='username', password='password')

# Review firewall rules
stdin, stdout, stderr = ssh.exec_command('show firewall rules')
firewall_rules = stdout.readlines()
print(firewall_rules)

This script connects to the firewall using SSH and retrieves the firewall rules using the show firewall rules command.

Establishing a Staged Connection Procedure

The initial connection setup involves configuring the lab fabric and VLAN trunk to communicate with each other. This includes configuring the IP addressing, subnet masks, and default gateways. The following code example demonstrates how to configure the IP addressing using a Python script:

import paramiko

# Establish SSH connection to lab fabric
ssh = paramiko.SSHClient()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
ssh.connect('lab_fabric_ip', username='username', password='password')

# Configure IP addressing
stdin, stdout, stderr = ssh.exec_command('configure terminal')
stdin, stdout, stderr = ssh.exec_command('interface vlan 10')
stdin, stdout, stderr = ssh.exec_command('ip address 10.10.10.1 255.255.255.0')

This script connects to the lab fabric using SSH and configures the IP addressing using the configure terminal command.

Traffic filtering and monitoring are essential to ensure that only authorized traffic is allowed between the lab fabric and the VLAN trunk. The following CLI command can be used to configure traffic filtering:

ip access-list extended lab_fabric_acl
10 permit ip 10.10.10.0 0.0.0.255 any
20 deny ip any any

This command configures an extended ACL to allow IP traffic from the lab fabric subnet (10.10.10.0/24) to any destination.

Rollback Thresholds and Triggers

Defining rollback criteria is crucial to ensure that the connection between the lab fabric and the VLAN trunk can be reversed in case of errors or issues. The following code example demonstrates how to define rollback criteria using a Python script:

import paramiko

# Establish SSH connection to lab fabric
ssh = paramiko.SSHClient()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
ssh.connect('lab_fabric_ip', username='username', password='password')

# Define rollback criteria
stdin, stdout, stderr = ssh.exec_command('configure terminal')
stdin, stdout, stderr = ssh.exec_command('rollback criteria error')

This script connects to the lab fabric using SSH and defines the rollback criteria using the configure terminal command.

Implementing automated rollback mechanisms involves configuring the lab fabric and VLAN trunk to automatically reverse the connection in case of errors or issues. The following CLI command can be used to implement automated rollback mechanisms:

rollback automatic

This command enables automated rollback mechanisms, which reverse the connection in case of errors or issues.

Post-Change Gates and Verification

Network stability verification involves verifying that the network is stable and functioning properly after the connection between the lab fabric and the VLAN trunk. The following CLI command can be used to verify network stability:

show ip int brief

This command displays a brief summary of the IP interfaces, including the IP address, subnet mask, and default gateway.

A security policy compliance check involves verifying that the security policies are properly enforced and compliant with organizational policies. The following code example demonstrates how to verify security policy compliance using a Python script:

import paramiko

# Establish SSH connection to firewall
ssh = paramiko.SSHClient()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
ssh.connect('firewall_ip', username='username', password='password')

# Verify security policy compliance
stdin, stdout, stderr = ssh.exec_command('show policy')
security_policies = stdout.readlines()
print(security_policies)

This script connects to the firewall using SSH and retrieves the security policies using the show policy command.

Evidence-Based Cutover Decision

Defining key performance indicators (KPIs) is essential to evaluate the network performance and stability. The following code example demonstrates how to define KPIs using a Python script:

import paramiko

# Establish SSH connection to lab fabric
ssh = paramiko.SSHClient()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
ssh.connect('lab_fabric_ip', username='username', password='password')

# Define KPIs
stdin, stdout, stderr = ssh.exec_command('configure terminal')
stdin, stdout, stderr = ssh.exec_command('kpi define')

This script connects to the lab fabric using SSH and defines the KPIs using the configure terminal command.

Real-time monitoring and alerting involve monitoring the network performance and stability in real-time and generating alerts in case of errors or issues. The following CLI command can be used to enable real-time monitoring and alerting:

monitoring enable

This command enables real-time monitoring and alerting, which generates alerts in case of errors or issues.

Troubleshooting and Debugging

Common connection issues include errors, security breaches, and performance issues. The following code example demonstrates how to troubleshoot connection issues using a Python script:

import paramiko

# Establish SSH connection to lab fabric
ssh = paramiko.SSHClient()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
ssh.connect('lab_fabric_ip', username='username', password='password')

# Troubleshoot connection issues
stdin, stdout, stderr = ssh.exec_command('show interface')
interface_info = stdout.readlines()
print(interface_info)

This script connects to the lab fabric using SSH and retrieves the interface information using the show interface command.

Code and CLI Examples

Configuring a VLAN trunk using CLI involves configuring the VLAN trunk on an interface. The following CLI command can be used to configure a VLAN trunk:

interface vlan 10
switchport mode trunk
switchport trunk allowed vlan 10

This command configures a VLAN trunk on interface VLAN 10, allowing VLAN 10 to pass through the trunk.

Implementing traffic filtering using code involves configuring an extended ACL to allow or deny traffic. The following code example demonstrates how to implement traffic filtering using a Python script:

import paramiko

# Establish SSH connection to lab fabric
ssh = paramiko.SSHClient()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
ssh.connect('lab_fabric_ip', username='username', password='password')

# Implement traffic filtering
stdin, stdout, stderr = ssh.exec_command('configure terminal')
stdin, stdout, stderr = ssh.exec_command('ip access-list extended lab_fabric_acl')
stdin, stdout, stderr = ssh.exec_command('10 permit ip 10.10.10.0 0.0.0.255 any')

This script connects to the lab fabric using SSH and implements traffic filtering using the configure terminal command.

Scaling Limitations and Considerations

The scalability of the lab fabric and VLAN trunk connection depends on the number of devices, interfaces, and VLANs involved. The following code example demonstrates how to scale the lab fabric and VLAN trunk connection using a Python script:

import paramiko

# Establish SSH connection to lab fabric
ssh = paramiko.SSHClient()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
ssh.connect('lab_fabric_ip', username='username', password='password')

# Scale lab fabric and VLAN trunk connection
stdin, stdout, stderr = ssh.exec_command('configure terminal')
stdin, stdout, stderr = ssh.exec_command('interface vlan 10')
stdin, stdout, stderr = ssh.exec_command('switchport mode trunk')

This script connects to the lab fabric using SSH and scales the lab fabric and VLAN trunk connection using the configure terminal command.

Security Considerations and Best Practices

Securing the lab fabric and VLAN trunk connection involves implementing security policies, access controls, and encryption. The following code example demonstrates how to secure the lab fabric and VLAN trunk connection using a Python script:

import paramiko

# Establish SSH connection to lab fabric
ssh = paramiko.SSHClient()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
ssh.connect('lab_fabric_ip', username='username', password='password')

# Secure lab fabric and VLAN trunk connection
stdin, stdout, stderr = ssh.exec_command('configure terminal')
stdin, stdout, stderr = ssh.exec_command('ip access-list extended lab_fabric_acl')
stdin, stdout, stderr = ssh.exec_command('10 permit ip 10.10.10.0 0.0.0.255 any')

This script connects to the lab fabric using SSH and secures the lab fabric and VLAN trunk connection using the configure terminal command.

Change Management and Documentation

Documenting the connection procedure and configurations involves maintaining accurate and up-to-date documentation of the lab fabric and VLAN trunk connection. The following code example demonstrates how to document the connection procedure and configurations using a Python script:

import paramiko

# Establish SSH connection to lab fabric
ssh = paramiko.SSHClient()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
ssh.connect('lab_fabric_ip', username='username', password='password')

# Document connection procedure and configurations
stdin, stdout, stderr = ssh.exec_command('show running-config')
running_config = stdout.readlines()
print(running_config)

This script connects to the lab fabric using SSH and retrieves the running configuration using the show running-config command.


Share this post on:

Previous Post
High Confidence Is Not a Remediation Gate
Next Post
Measuring safe pause intervals between change batches