Checking Network Reachability

Learn how to determine an IP address’ reachability from a container.

In order to determine if an IP address is reachable from a container, we need to understand some terms associated with IP addresses.

IP addresses

An IP (Internet Protocol) address is a unique numerical identifier assigned to each device connected to a network. It can be an IPv4 (32-bit) or IPv6 (128-bit) format. The most commonly used is an IPv4. An IPv4 address consists of four numbers (octets) separated by periods, e.g., 192.168.0.1. IP addresses are categorized into different classes: A, B, C, D, and E. Each class has a specific range of addresses.

Subnets

Subnetting is a technique used to divide networks into smaller, manageable subnetworks. It refers to borrowing bits from the host portion of an IP address to create a network prefix.

The subnet mask determines the size of the network prefix and identifies the network and host portions of an IP address. Using subnets allows efficient utilization of IP addresses and facilitates better network organization.

Ports

Ports are virtual endpoints for communication within a device or between devices on a network. Each network service or application listens on a specific port number to receive incoming data. Port numbers range from 0 to 65,535. Certain ports are reserved for specific services (e.g., port 80 is for HTTP).

TCP/IP

TCP/IP (Transmission Control Protocol/Internet Protocol) are protocols that enable communication between devices on the internet. TCP provides reliable, connection-oriented data transmission, ensuring packets arrive in order and without errors. IP handles the routing of packets across different networks and provides logical addressing with IP addresses. They both form the foundation of internet communication.

Exploring container network stack

We’ll examine some IP-related information below, what they mean, and how they’re used.

  • Launch a container: We launch a container with the following command:

Get hands-on with 1200+ tech skills courses.