Reader small image

You're reading from  The Linux DevOps Handbook

Product typeBook
Published inNov 2023
PublisherPackt
ISBN-139781803245669
Edition1st Edition
Concepts
Right arrow
Authors (2):
Damian Wojsław
Damian Wojsław
author image
Damian Wojsław

Damian Wojsław has been working in the IT industry since 2001. He specializes in administration and troubleshooting of Linux servers. Being a system operator and support engineer he has found DevOps philosophy a natural evolution of the way sysops work with developers and other members of the software team.
Read more about Damian Wojsław

Grzegorz Adamowicz
Grzegorz Adamowicz
author image
Grzegorz Adamowicz

Grzegorz Adamowicz has been working in the IT industry since 2006 in a number of positions, including Systems Administrator, Backend Developer (PHP, Python), Systems Architect and Site Reliability Engineer. Professionally was focused on building tools and automations inside projects he is involved in. He's also engaged with the professional community by organizing events like conferences and workshops. Grzegorz worked in many industries including Oil & Gas, Hotel, Fintech, DeFI, Automotive, Space and many more.
Read more about Grzegorz Adamowicz

View More author details
Right arrow

Networking in Linux

Networking is a complex topic no matter the operating system. Linux, in terms of its flexibility, can be very overwhelming regarding the multitude of possibilities of configuration, kernel features, and command-line tools that can help us configure those options. In this chapter, we will lay the foundation for this topic so that you can search for more information on a specific topic in other publications. In this chapter, we are going to cover the following topics:

  • Networking in Linux
  • ISO/OSI as a networking standard
  • Firewalls
  • Advanced topics

Networking in Linux

In Linux, networking is implemented in the kernel, which means that it is a part of the operating system. The kernel includes several components that work together to enable networking, including device drivers, protocol implementations, and system calls.

When a user wants to send or receive data over a network, they can do so using any of the networking applications available in Linux, such as ping, traceroute, telnet, or ssh. These applications use system calls to communicate with the kernel and request that data be sent or received over the network.

The kernel communicates with the network hardware using device drivers, which are software programs that allow the kernel to access and control the hardware. Different drivers are needed for different types of network hardware, such as Ethernet or Wi-Fi.

The kernel also implements several networking protocols, which are rules and standards that define how data is formatted and transmitted over the network...

ISO/OSI as a networking standard

The starting point of any discussion about networks always starts with the reference model defined by the International Organization for Standardization/Open Systems Interconnection (ISO/OSI). The ISO/OSI reference model is a conceptual model that defines a networking framework to implement protocols in seven layers. It is a framework that allows us to view communications between systems (computer or otherwise) as separate from the actual physical and software structure underlying it.

In Linux, the OSI model is implemented through a series of software components that are responsible for performing the functions of each layer. These components work together to enable networking capabilities in Linux.

The seven layers of the OSI model that are implemented in Linux are as follows:

  • Physical
  • Data link
  • Network
  • Transport
  • Session
  • Presentation
  • Application

In a system running in the cloud, you will have access to all...

Firewalls

A firewall is a security measure that controls incoming and outgoing network traffic based on predefined rules and policies. It is typically placed between a protected network and the internet, and its main purpose is to block unauthorized access while allowing authorized communication. Firewalls can be hardware-based or software-based, and they can use a variety of techniques, such as packet filtering, stateful inspection, and application-level filtering, to control network traffic. In this section, we’re going to look into a firewall available on Linux systems.

To control a Linux firewall, you will need to use iptables, ufw, nftables, or firewalld. Packet filtering is built into the Linux kernel, so those CLI tools will interact with it.

iptables

iptables is the most verbose tool for controlling a firewall, meaning it does not have much abstraction built into it, but it’s important to understand the basic concepts so that we can move on to more user...

Advanced topics

In this section, we will cover more advanced uses of network features. Some are very common (such as port forwarding or NAT), while some are less known. Let’s start with well-known features you will most likely encounter very often and then make our way down to more advanced and less-known features.

NAT

Network Address Translation (NAT) is a technique that involves mapping one network to another. The original reason for this was to simplify routing whole network segments without changing the address of every host in the packets.

Source NAT (SNAT) is a type of NAT that changes the source IP address of a packet. It is used to allow hosts on a private network to access the internet using a single public IP address.

Destination NAT (DNAT) is a type of NAT that changes the destination IP address of a packet. It is used to forward incoming traffic to a specific internal host based on the destination IP address. This is often used to allow external clients...

Summary

In this chapter, we covered basic networking topics that you will probably encounter during your work in a DevOps team. This is a starting point and a base to help you understand network-related topics when dealing with services running inside a container. You will probably also want to expand your knowledge on this topic by reading about the IPv6 protocol, which is yet to replace IPv4.

In the next chapter, we will switch focus to a version control system (VCS) that is mainly used in modern organizations: Git.

lock icon
The rest of the chapter is locked
You have been reading a chapter from
The Linux DevOps Handbook
Published in: Nov 2023Publisher: PacktISBN-13: 9781803245669
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

Authors (2)

author image
Damian Wojsław

Damian Wojsław has been working in the IT industry since 2001. He specializes in administration and troubleshooting of Linux servers. Being a system operator and support engineer he has found DevOps philosophy a natural evolution of the way sysops work with developers and other members of the software team.
Read more about Damian Wojsław

author image
Grzegorz Adamowicz

Grzegorz Adamowicz has been working in the IT industry since 2006 in a number of positions, including Systems Administrator, Backend Developer (PHP, Python), Systems Architect and Site Reliability Engineer. Professionally was focused on building tools and automations inside projects he is involved in. He's also engaged with the professional community by organizing events like conferences and workshops. Grzegorz worked in many industries including Oil & Gas, Hotel, Fintech, DeFI, Automotive, Space and many more.
Read more about Grzegorz Adamowicz