Table of Contents

TCP/IP is the most commonly used communications protocol suite in the world. It powers the Internet, home networks, and everything in between. So it's an important topic for computer technicians and anyone who uses a computer. It's the basis for most of what we perform on today's computer networks.

♾️
Install Linux somewhere! One Linux system is good. Two or more is better. If you don't have an extra physical system, virtual machines are perfectly acceptable. A good starting point when it comes to virtualization is the VirtualBox program. See this link for information about how to use VirtualBox.

Check out the video below and read on for more about TCP/IP and Linux.

VIDEO

🖥️
In the video, I show two virtual machines—a Debian server and a Debian client. They exist in the same NAT network (10.0.2.0) within KVM. For step-by-step installations of Debian, see the following links:
- Debian Server
- Debian Client

Linux Networking - Basics and Beyond
Over 10 Hours of Video Instruction Learn hands-on how Linux systems communicate and how they are networked together in real-life environments. Overview: Linux Networking - Basics and Beyond focuses on … - Selection from Linux Networking - Basics and Beyond [Video]

Also available on InformIT (use PROWSE70 at checkout to save 70%!)


What is a Computer Network?

Before getting into TCP/IP, let's step back and discuss what a computer network is. We'll keep it simple.

A computer network is two or more computers that communicate with each other.

Pretty simple definition, huh? We could go into much more depth, but for the purposes of this article, I'm attempting to keep it concise. Want more blunt, to-the-point statements? Try this:

Computers that are part of a network communicate data.

Mind-blowing! But true. From a computer networking perspective, all of our desktop computers, laptops, smartphones, tablets, IoT devices, and everything else, are just moving data back and forth. That's it. Whether for business or pleasure, it's the data that we are concerned with—always.

💾
Long live DATA!

Let's give an example of a basic computer network. Take a look at the following figure.

Diagram

Description automatically generated
Figure 1 — A local area network

In Figure 1-1 you see a typical local area network (LAN). In the center is a switch. This connects everything: PCs, laptops, printers, mobile devices (indirectly via a wireless access point), and whatever else the network needs. As you can see, the term "computers" is something I use loosely. More accurately, it could be any system or device that has an IP address associated with it and can communicate on the network. Any host, per se.

TCP/IP Introduction

Transmission Control Protocol/Internet Protocol (TCP/IP) is a suite of protocols used by computers to communicate with each other. It includes the protocols TCP, and IP, but also many others, such as ICMP, ARP, HTTP, FTP, POP, SMTP, DNS, DHCP, and so on. IP addresses are used by each computer that runs TCP/IP to identify them and to facilitate the communication of packets of data.

🗒️
The TCP/IP Suite is also known as the Internet Protocol suite.

A typical example of an IP network is 192.168.1.0. In a network such as this, you might have a system that uses the IP address 192.168.1.58. In this case, the network portion of the address is 192.168.1. The host portion is .58. It's the host portion that differentiates between systems on the same network. Take a look at the following figure where we revisit our Local Area Network but this time, we add some IP addresses.

Figure 2 — LAN with IP addresses

For example, one computer might have the IP address 192.168.1.73. Another might have 192.168.1.142. And the gateway might use 192.168.1.1. It's that last octet, that last number that sets each system apart. Other IP networks can have a larger host portion. For example, in the 172.17.0.0 network, the network portion is 172.17, and the host portion is 0.0. So, a system on the 172.17 network might have an address such as 172.17.51.3. "51.3" would be the host portion of the IP address.

It's also important to understand the difference between static and dynamic IP addresses. A static IP address is one that has been typed into the system manually. A dynamic IP address is one that has been obtained automatically by a computer.

The great bulk of computer systems out there will obtain their IP addresses from a DHCP server—somewhere. For example, your SOHO router might hand out IP addresses automatically. Or it could be something more advanced. The important thing is that the process is automated. It would be silly to manually input IP addresses to every system on a network. Think of the time and effort required to do that, not to mention the risk of error and duplicate IP addresses. No, dynamic addressing is the way to go for client systems. However, systems such as servers, switches, routers, wireless access points, and printers, are often configured with a static address. This way, it is known that the address won't change over time, as is potentially the case with dynamic addresses.

It's all about automation. Let the computers do the work!

As mentioned, in Figure 2 you see that two PCs have IP addresses ending in .73 and .142. Those are most likely obtained automatically from a DHCP server. On the other hand, the router (gateway) might use 192.168.1.1, which is most likely assigned manually. Be sure to understand the difference between static and dynamic IP addresses and when to use each of them.

TCP/IP is impressive subject matter. In fact, no one person knows the complete depth of TCP/IP—it's that massive.

Lab: TCP/IP Example in Linux

In this example we use the ip a command in Linux. In the console (or terminal) we can type ip a and view the results. Here's an example of a Debian Linux system:

dave@pt1:~$ ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: enp1s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether 52:54:00:c4:81:10 brd ff:ff:ff:ff:ff:ff
    inet 10.0.2.52/24 brd 10.0.2.255 scope global noprefixroute enp1s0
       valid_lft forever preferred_lft forever
    inet6 fe80::5054:ff:fec4:8110/64 scope link noprefixroute 
       valid_lft forever preferred_lft forever
3: docker0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default 
    link/ether 02:42:91:04:4f:17 brd ff:ff:ff:ff:ff:ff
    inet 172.17.0.1/16 brd 172.17.255.255 scope global docker0
       valid_lft forever preferred_lft forever

Example: Displaying IP addresses with the ip a command.

In Example 1 we see that there are three network interfaces on this system: lowhich is the local loopback adapter; enp1s0 — which is the main network adapter; and docker0 — which is a virtual adapter placed on the system by the Docker container system. The one we are interested in is enp1s0.

If you look at the fourth line of that adapter you will see "inet 10.0.2.52/24". "inet" is short for "Internet". That tells us the Internet address or simply, the IP address of the computer.

More accurately, our system uses the IPv4 address 10.0.2.52. The /24 tells us the netmask that the IP address uses. /24 is equivalent to 255.255.255.0. This means that the network portion of the IP address is 10.0.2 and the host portion is .52. Therefore, this system can communicate with other systems on the same 10.0.2.0 network. You now know more about Linux and TCP/IP than the average bear.

🖥️
Try it! Run the ip a command now and explore the results!
🗒️
Want to learn more about how netmasks such as /24 work?
See this article on classful and classless IP networks.

This is just the tip of the iceberg when it comes to the ip command. But for now, try using it to analyze any Linux system you come across. The more you run it, the more you will learn about TCP/IP in Linux.

In addition, this is just the beginning of TCP/IP. It is a vast subject that you could spend a lifetime becoming an expert on. Remember that just about everything we do in computer networking has its basis in TCP/IP.

Additional Learning

Deep Dive: The ip Command in Linux
The ip command in Linux can be used to analyze, configure, and troubleshoot your system. It’s a powerhouse! ⚡

Quiz

Click the drop-down arrow to the right of each question to display the answer.

1. What does TCP/IP stand for?

Transmission Control Protocol/Internet Protocol. Those are the two original protocols within the TCP/IP suite, though today there are hundreds more.

2. What command can you use in the Linux Terminal to find out the IP address?

ip a (the full command is ip address show)

3. What type of address would a router usually have—static, or dynamic?

Static

4. What is the default network portion of the IP address 192.168.1.58?

By default, the network portion is 192.168.1, and the host portion would be .58. That is assuming that the netmask is /24.

Bonus! What is the 4-octet equivalent of /24?

255.255.255.0
In binary, that number would be 11111111.11111111.11111111.00000000
If you add up the 1s, you get 24! yes!


Summary

Whether you are browsing the web, sending an email, or connecting via SSH to your beloved Linux servers, TCP/IP is at the core of your work. Computers of all kinds communicate with each other using IP addresses and TCP/IP protocols.

The TCP/IP suite is massive. It has a multitude of protocols. It is beyond formidable. It is a fantastic work of technology created by the geniuses of our time.

And if you're wondering how long I've been working with TCP/IP (and computers in general), here's a nice little image for you.

Actually, my roots go back way before this, but these were good times. Some of my best TCP/IP work was performed in this system, however, it required in-depth knowledge of the TCP/IP stack. While today's systems make it much easier to work with TCP/IP, the core principles remain the same.

Become proficient in IP addressing and TCP/IP protocols and you will have a serious advantage over the competition!


♾️
As we said, TCP/IP is everywhere. Practice with it! Hope you enjoyed this article!

Linux Networking - Basics and Beyond
Over 10 Hours of Video Instruction Learn hands-on how Linux systems communicate and how they are networked together in real-life environments. Overview: Linux Networking - Basics and Beyond focuses on … - Selection from Linux Networking - Basics and Beyond [Video]

Also available on InformIT (use PROWSE70 at checkout to save 70%!)


Great! You’ve successfully signed up.
Welcome back! You've successfully signed in.
You've successfully subscribed to Prowse Tech.
Your link has expired.
Success! Check your email for magic link to sign-in.
Success! Your billing info has been updated.
Your billing was not updated.