USD ($)
$
United States Dollar
India Rupee

Network Automation is Essential for Engineers

Created by Deepak Sharma in Articles 6 Jan 2024
Share

In today's rapidly growing the world of technology, network automation has emerged as a critical skill for network engineers to succeed in their careers. Network automation can be defined as performing any network task like configuring network devices automatically using some kind of scripts or software tools. There are several other aspects of network automation includes the configuration, management, and monitoring of networks.

Why is network automation important for network engineers?

Increased Efficiency and Productivity
Among several uncounted benefits of automation one of the main benefit of network automation is to increase efficiency hence productivity which it brings to network engineer's tasks. By automating routine tasks, network engineers can free up time to focus on more complex and strategic projects. Automation also reduces the likelihood of human error, improving the accuracy and reliability of network configurations.

Faster Troubleshooting
There are several network automation tools can help network engineers quickly identify and diagnose problems that reducing the time it takes to troubleshoot network issues. In real time network monitoring can performed to detect anomalies and alert network engineers for any potential issues before they become critical.

Improved Scalability
When a network continues to grow and become more complex, scalability and becomes an increasingly critical consideration for network engineers. Network automation tools can help network engineers manage larger and more complex networks more efficiently, reducing the workload required to manage them manually.

Enhanced Security
Network automation can also help improve network security. The real time security threats can be detected using automation security tools available in the market that reduces the risk of security breach. Additionally, automated security policies and configurations can help ensure consistent security practices across the network.

Here is an example of a Python script that can be used to remotely log in to a Cisco router using SSH and take a configuration backup. This is just an example there would be almost everything can be done using scrips which reducing the implementation time and efforts. This is the reason organizations are now moving more and more towards automation and reduce their overall cost for network tasks like configuration and change management.

import paramiko

# Define the SSH parameters
ssh = paramiko.SSHClient()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
ssh.connect('192.168.1.1', username='admin', password='password')

# Create a new SSH session and save the configuration to a file
session = ssh.invoke_shell()
session.send('terminal length 0\n')
session.send('show running-config\n')
output = session.recv(65535)
with open('router_config.txt', 'w') as f:
    f.write(output.decode())

# Close the SSH session and connection
session.close()
ssh.close()

In this script, we use the Paramiko library to establish an SSH connection to the router. We then create a new SSH session and send the commands to save the configuration to a file. Finally, we close the SSH session and connection.

I like to give you another example of simplifying the configuration for devices using scripts (in our case we are using python. In this example we will configure BGP on a remote router. This router's IP address is 192.168.1.1 and in AS 65000 needs to advertise 10.0.0.0/8 network and its neighbor IP address is 192.168.2.1 and in AS 65001.


from netmiko import ConnectHandler

# Define device information
device = {
    'device_type': 'cisco_ios',
    'ip': '192.168.1.1',
    'username': 'admin',
    'password': 'password',
}

# Connect to device
with ConnectHandler(**device) as net_connect:
    # Enter configuration mode
    net_connect.send_command('configure terminal')

    # Configure BGP
    net_connect.send_command('router bgp 65000')
    net_connect.send_command('neighbor 192.168.2.1 remote-as 65001')
    net_connect.send_command('network 10.0.0.0 mask 255.0.0.0')

    # Save configuration changes
    net_connect.send_command('end')
    net_connect.send_command('write memory')

In this example, we first import the ConnectHandler class from the Netmiko library. We then define the device information, including the device type, IP address, and login credentials. We use the with statement to establish an SSH connection to the device and enter configuration mode using the send_command() method to send the CLI command configure terminal. We then configure BGP using the send_command() method to send the CLI commands to create a BGP neighbor with remote AS number, and to advertise a network with its subnet mask.

Finally, we exit configuration mode using the send_command() method to send the CLI commands end and write memory to save the configuration changes.

Note that this is just a simple example, and the actual configuration commands may vary depending on the specific requirements of your network.


Conclusion

Network automation can certainly be considered as a critical skill for network engineers to succeed in their careers. As organizations are looking to bring efficiency, productivity, faster troubleshooting, improved scalability, and enhanced security in day today networking activities and tasks and best way to achieve all of these is by using network automation. By learning network automation skills and using tools like Python, network engineers can improve their effectiveness and provide better service to their organizations.

Comments (2)

Ankit verma Student
13 Oct 2023 | 10:30 am

Yes, I have started learning it. In my company, we have started automation very often now. Thanks for a heads up with this writeup.

Malik Sheikh Student
14 Oct 2023 | 01:43 pm

Automation does not only mean you should be having programming knowledge on python, ansible etc. but even if you are using solutions such as Cisco SD-WAN, Cisco ACI, etc they also automate networking tasks but they do provide GUI for the same and you hardly realize that you are already working on automation.



At the same time, it is good to know what is happening behind the scene to have better understanding.

Share

Share this post with others