
Python Networking Solutions Guide: Leverage the Power of Python to Automate and Maintain your Network Environment
- Length: 456 pages
- Edition: 1
- Language: English
- Publisher: BPB Publications
- Publication Date: 2023-01-21
- ISBN-10: 9355513577
- ISBN-13: 9789355513571
- Sales Rank: #0 (See Top 100 Books)
Automate Your Network Configuration, Management, and Operation Tasks with Python
Key Features
- Get familiar with the basics of network automation.
- Understand how to automate various network devices like Routers, Switches, Servers, and Firewalls.
- Learn how to create customized scripts to manage multiple devices using Python.
Description
Python is the de-facto standard for automated network operations nowadays. With the power of Python, network devices can be automated easily with basic scripts. Written in direct and intuitive language, this practical guide will help you to automate your network with Python.
In this book, you will understand what network automation is precisely. The book will help you get familiar with the basics of the Python language. It will also help you learn how to monitor, maintain, and deploy configurations in network and system devices such as routers, switches, servers, and storage. The book will explain how to automate cloud infrastructures like AWS (Amazon Web Services) with Python.
By the end of the book, you will be able to decrease your routine workload and improve productivity by automating your networking tasks.
What you will learn
- Get familiar and work with Python libraries like Paramiko and Netmiko.
- Write and deploy scripts to configure network devices such as Firewalls, Routers, and Switches.
- Understand how to use Python scripts for network security.
- Learn how to combine all micro scripts in the main Python script.
- Create, configure, operate, and maintain AWS services through Python scripts using Boto3.
Who this book is for
This book is specially designed for system administrators, infrastructure automation engineers, IT engineers, and network engineers to leverage Python’s potential as an automation tool to centrally manage routers, servers, and cloud infrastructures in an organizational network and beyond.
Cover Page Title Page Copyright Page Dedication Page About the Author About the Reviewer Acknowledgement Preface Errata Table of Contents 1. Introduction to Network Automation Structure Objectives Introduction to network automation Benefits of network automation Future of networking Introduction to Python Python usage area Python installation Python for Windows Python for Linux Python for MAC Running Python codes Pycharm installation for Windows Install and import Python modules Conclusion Multiple choice questions Answer Questions 2. Python Basics Structure Objectives Print and ınput functions Print() Input ( ) Data types String and integer String methods List List methods Dictionary Dictionary methods Statements and conditions If condition For statement While statement Break and continue statement Range statement For else statement and nested loops Try…except statement Conclusion Multiple choice questions Answers Questions 3. Python Networking Modules Structure Objectives File handling Open function OS module Word files Excel files RE modules RE module functions Special sequences Sets in the RE module Advanced topics of Python Functions Functions with parameters Functions with default parameters Call variables from functions Creating modules Classes Conclusion Multiple choice questions Answers Questions 4. Collecting and Monitoring Logs Structure Objectives Connection modules SSH connection Paramiko module For SSH Connect 1 device with Paramiko Running configuration commands with Paramiko Connect to multiple devices with Paramiko Netmiko module for SSH Connect a single device with Netmiko Connect to multiple devices with Netmiko Telnet connection Telnetlib module for telnet Connect to multiple devices with telnetlib Netmiko module for telnet Collecting logs Collecting version and device information Collecting CPU levels Finding duplicated IP address Collecting logs with multithreading Tools and calculators IP address validator Subnet calculator Conclusion Multiple choice questions Answers Questions 5. Deploy Configurations in Network Devices Structure Objectives Configure network devices Configuration of interfaces Replacing configurations on files Configure devices with Jinja2 template Introduction to Jinja2 template Introduction to YAML language Rendering Jinja template with a YAML file Configure devices with Jinja If statement in Jinja Configure devices with Napalm module Collect logs from devices with NAPALM Configure devices with NAPALM Configure devices with Nornir module Configure inventory in Nornir Connection to devices with Nornir-Netmiko Connection to devices with Nornir-NAPALM Configure devices by Nornir and Jinja template Conclusion Multiple choice questions Answers Questions 6. File Transfer and Plotting Structure Objectives File transfers Backup configuration file with SSH File transfer with FTP connection File transfer with SFTP connection File transfer with Netmiko SCP connection Netmiko SCP connection with concurrent module File transfer with Nornir SCP connection Backup configuration file with SCP Plotting data Plotting CPU levels Plotting interface bandwidth Conclusion Multiple choice questions Answers Questions 7. Maintain and Troubleshoot Network Issues Structure Objectives Upgrade network devices Alert alarms in devices Collect logs with SNMP Send logs via email Reachability test to network devices Ping test script Traceroute test script Conclusion Multiple choice questions Answers Questions 8. Monitor and Manage Servers Structure Objectives Implement server environment Download VMware player and Ubuntu Install Ubuntu on VMware Activate SSH connection Maintain Linux servers Collect logs via syslog Login servers with secure password Collect CPU and memory levels Collect interface information Collect type and permission of files Server configurations Create users in servers Install packages Transfer files with Paramiko Reboot servers concurrently Stop running processes by script Conclusion Multiple choice questions Answers Questions 9. Network Security with Python Structure Objectives Activate security services Install and activate the “Firewalld” service on servers Configure firewall settings on servers Create access lists in network devices Manipulate network packets with scapy Check logs and configurations Check CPU levels periodically with Crontab Check router configuration for insecure passwords Check port security configuration in routers Collect packets from ports with Pyshark Conclusion Multiple choice questions Answers Questions 10. Deploying Automation Software Structure Objectives Introduction to InquirerPy module Automation tool design Create main tool script Create subtask scripts Network device scripts Server scripts Other remaining scripts Conclusion Multiple choice questions Answers Questions 11. Automate Cloud Infrastructures with Python Structure Objectives Cloud environment deployment Introduction to AWS Installation of Boto3 and AWS CLI EC2 instance management Manage EC2 instances with Python Connection to EC2 instances S3 bucket management EBS volume management Manage EBS volumes Create snapshots of EBS volumes Attach EBS volume to EC2 instance IAM user management Conclusion Multiple choice questions Answers Questions Index
1. Disable the AdBlock plugin. Otherwise, you may not get any links.
2. Solve the CAPTCHA.
3. Click download link.
4. Lead to download server to download.