Reader small image

You're reading from  Mastering Python Networking - Fourth Edition

Product typeBook
Published inJan 2023
Reading LevelIntermediate
PublisherPackt
ISBN-139781803234618
Edition4th Edition
Languages
Concepts
Right arrow
Author (1)
Eric Chou
Eric Chou
author image
Eric Chou

Eric Chou is a seasoned technologist with over 20 years of experience. He has worked on some of the largest networks in the industry while working at Amazon, Azure, and other Fortune 500 companies. Eric is passionate about network automation, Python, DevOps, and helping companies build better security postures. In addition to being the author of Mastering Python Networking (Packt), he is the author or co-author of other top-selling books and highly-rated online classes. Eric is the primary inventor or co-inventor for three U.S. patents in IP telephony and networking. He shares his deep interest in technology through his books, classes, blog, and contributes to some of the popular Python open source projects.
Read more about Eric Chou

Right arrow

Mastering Python Networking, Fourth Edition: Utilize Python packages and frameworks for network automation, monitoring, cloud, and management

Welcome to Packt Early Access. We’re giving you an exclusive preview of this book before it goes on sale. It can take many months to write a book, but our authors have cutting-edge information to share with you today. Early Access gives you an insight into the latest developments by making chapter drafts available. The chapters may be a little rough around the edges right now, but our authors will update them over time.

You can dip in and out of this book or follow along from start to finish; Early Access is designed to be flexible. We hope you enjoy getting to know more about the process of writing a Packt book.

  1. Chapter 1: Review of TCP/IP Protocol Suite and Python
  2. Chapter 2: Low-Level Network Device Interactions
  3. Chapter 3: API and Intent-Driven Networking
  4. Chapter 4: The Python Automation Framework – Ansible...

An overview of the Internet

What is the Internet? This seemingly easy question might receive different answers depending on each of our backgrounds. The Internet means different things to different people; the young, the old, students, teachers, business people, and poets could all give different answers to the same question.

To a network engineer, the Internet is a global computer network consisting of a web of inter-networks connecting large and small networks together. In other words, it is a network of networks without a centralized owner. Take your home network as an example. It might consist of a device that integrates the functions of routing, Ethernet switching, and wireless access points connecting your smartphones, tablets, computers, and internet-enabled TVs together for the devices to communicate with each other. This is your Local Area Network (LAN).

When your home network needs to communicate with the outside world, it passes information from your LAN to a larger...

The OSI model

No network book is complete without first going over the OSI model. The model is a conceptual model that componentizes the telecommunication functions into different layers. The model defines seven layers, and each layer sits independently on top of another one with defined structures and characteristics.

For example, in the network layer, IP is located on top of the different data link layers, such as Ethernet or frame relay. The OSI reference model is a good way to normalize different and diverse technologies into a set of common languages that people can agree on. This greatly reduces the scope for parties working on individual layers and allows them to look at specific tasks in depth without worrying too much about compatibility:

Table  Description automatically generated with medium confidence

Figure 1.3: OSI model

The OSI model was initially worked on in the late 1970s and was later published jointly by the International Organization for Standardization (ISO), what is now known as the Telecommunication Standardization...

The client-server model

The client-server reference models demonstrated a standard way for data to communicate between two nodes. Of course, by now, we all know that not all nodes are created equal. Even in the earliest Advanced Research Projects Agency Network (ARPANET) days, there were workstation nodes, and there were server nodes with the purpose of providing content to other workstation nodes.

These server nodes typically have higher hardware specifications and are managed more closely by engineers. Since these nodes provide resources and services to others, they are appropriately referred to as servers. Servers typically sit idle, waiting for clients to initiate requests for their resources. This model of distributed resources that are requested by the client request is referred to as the client-server model.

Why is this important? If you think about it for a minute, the importance of networking is greatly highlighted by this client-server model. Without the need to...

Network protocol suites

In the early days of computer networking, protocols were proprietary and closely controlled by the company that designed the connection method. If you were using Novell’s IPX/SPX protocol in your hosts, the same hosts would not be able to communicate with Apple’s AppleTalk hosts, and vice versa. These proprietary protocol suites generally have analogous layers to the OSI reference model and follow the client-server communication method but are not compatible with each other. The proprietary protocols generally only work in LANs that are closed, without the need to communicate with the outside world. When traffic does need to move beyond the local LAN, typically a protocol translation device, such as a router, is used to translate from one protocol to another. For example, to connect an AppleTalk-based network to the Internet, a router would be used to connect and translate the AppleTalk protocol to an IP-based network. The additional translation...

Python language overview

In a nutshell, this book is about making our network engineering lives easier with Python. But what is Python and why is it the language of choice of many DevOps engineers? In the words of the Python Foundation Executive Summary (https://www.python.org/doc/essays/blurb/):

”Python is an interpreted, object-oriented, high-level programming language with dynamic semantics. Its high-level, built-in data structure, combined with dynamic typing and dynamic binding, makes it very attractive for Rapid Application Development, as well as for use as a scripting or glue language to connect existing components together. Python’s simple, easy-to-learn syntax emphasizes readability and therefore reduces the cost of program maintenance.”

If you are somewhat new to programming, the “object-oriented,” and “dynamic semantics” mentioned in the summary probably do not mean much to you. But I think we can all...

Summary

In this chapter, we covered the OSI model and reviewed network protocol suites, such as TCP, UDP, and IP. They work as the layers that handle the addressing and communication negotiation between any two hosts. The protocols were designed with extensibility in mind and have largely been unchanged from their original design. Considering the explosive growth of the internet, that is quite an accomplishment.

We also quickly reviewed the Python language, including built-in types, operators, control flows, functions, classes, modules, and packages. Python is a powerful, production-ready language that is also easy to read. This makes the language an ideal choice when it comes to network automation. Network engineers can leverage Python to start with simple scripts and gradually move on to other advanced features.

In Chapter 2, Low-Level Network Device Interactions, we will start to look at using Python to programmatically interact with network equipment.

Join our book...

lock icon
The rest of the chapter is locked
You have been reading a chapter from
Mastering Python Networking - Fourth Edition
Published in: Jan 2023Publisher: PacktISBN-13: 9781803234618
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
undefined
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime

Author (1)

author image
Eric Chou

Eric Chou is a seasoned technologist with over 20 years of experience. He has worked on some of the largest networks in the industry while working at Amazon, Azure, and other Fortune 500 companies. Eric is passionate about network automation, Python, DevOps, and helping companies build better security postures. In addition to being the author of Mastering Python Networking (Packt), he is the author or co-author of other top-selling books and highly-rated online classes. Eric is the primary inventor or co-inventor for three U.S. patents in IP telephony and networking. He shares his deep interest in technology through his books, classes, blog, and contributes to some of the popular Python open source projects.
Read more about Eric Chou