0Pricing
Linux Networking & TCP/IP for Developers · 课时

IP 地址与子网划分

掌握 IPv4 编址、网络类别和子网划分等概念,高效组织和管理 IP 网络

IP 地址与子网划分 是 CoddyKit 上的免费 Linux Networking & TCP/IP for Developers 课时。 这是第 2 节课,共 4 节。 你可以在下方免费阅读本课时的完整内容 — 然后在浏览器中使用内置代码编辑器和全天候 AI 导师进行实践。 这是 Linux Networking & TCP/IP for Developers 学习路径的一部分,你的进度在网页和 CoddyKit 应用中同步。 Linux Networking & TCP/IP for Developers 课程共包含 4 节课。

本课时的部分内容尚未翻译,以英文显示。

Your Device's Network Address

Every device connected to a network needs a unique identifier, much like a mailing address for your house. In computer networks, this identifier is called an Internet Protocol (IP) address.

An IP address allows devices to locate and communicate with each other across local networks and the internet.

The IPv4 Address Format

We primarily use IPv4 (Internet Protocol version 4) addresses. These are 32-bit numbers, typically written in a dotted-decimal format.

This format divides the 32 bits into four sections, called octets, separated by dots. Each octet can range from 0 to 255.

  • Example: 192.168.1.100
  • Each 'dot' separates an octet.

IP Addresses in Binary

While we see IP addresses in decimal, computers understand them in binary. Each octet is 8 bits (a byte), so an IPv4 address is 32 bits long (4 octets * 8 bits/octet).

For example, the decimal number 192 in binary is 11000000. Understanding this binary representation is key to comprehending subnetting.

Network and Host Portions

An IP address isn't just one big number; it's logically divided into two parts:

  • Network Portion (Network ID): Identifies the specific network a device belongs to. All devices on the same network share the same network ID.
  • Host Portion (Host ID): Uniquely identifies a specific device (host) within that network.

Think of it like a street address: the street name is the network, and the house number is the host.

What is a Subnet Mask?

How does a computer know which part of an IP address is the network portion and which is the host portion? It uses a subnet mask.

A subnet mask is another 32-bit number that works with an IP address to define the network and host parts. Like an IP address, it's often written in dotted-decimal format (e.g., 255.255.255.0).

How Subnet Masks Work

In binary, a subnet mask consists of a series of 1s followed by a series of 0s.

  • The 1s represent the network portion of the IP address.
  • The 0s represent the host portion.

By comparing an IP address with its subnet mask (a process called 'ANDing'), a device can determine its network ID and its unique host ID.

Historical Network Classes (A, B, C)

Historically, IP addresses were categorized into classes (A, B, C, D, E) based on their first octet. This system, known as classful addressing, defined default subnet masks:

  • Class A: First octet 1-126 (Default mask: 255.0.0.0)
  • Class B: First octet 128-191 (Default mask: 255.255.0.0)
  • Class C: First octet 192-223 (Default mask: 255.255.255.0)

Why Classful Addressing Was Inefficient

While simple, classful addressing led to significant waste of IP addresses. For example, a Class B network could support over 65,000 hosts, far too many for most organizations, but you couldn't easily divide it.

This inflexibility and inefficiency in allocating IP addresses spurred the need for a more granular approach: subnetting.

Subnetting: Dividing Networks

Subnetting is the process of dividing a single large IP network into smaller, more manageable subnetworks (subnets).

It involves borrowing bits from the host portion of an IP address to extend the network portion, creating more, smaller networks. Each subnet then has its own unique network ID.

Benefits of Subnetting

Subnetting offers several crucial advantages for network administrators:

  • Improved Efficiency: Reduces the waste of IP addresses compared to classful addressing.
  • Reduced Network Traffic: Smaller broadcast domains mean less unnecessary traffic.
  • Enhanced Security: Isolates segments of the network, limiting the impact of security breaches.
  • Easier Management: Organizes the network logically, making troubleshooting and administration simpler.

Quick Check: Network ID

You now understand how an IP address and subnet mask work together. Let's test your knowledge.

IP Addressing & Subnetting Recap

Great job! You've learned the fundamentals of IPv4 addressing, including how IP addresses are structured and divided into network and host portions using a subnet mask.

You also explored the historical classful addressing system and understood why subnetting became essential for efficient and flexible network design. Subnetting allows us to create smaller, more manageable subnets, improving network performance and security.

常见问题解答

「IP 地址与子网划分」课时是免费的吗?

是的 — 「IP 地址与子网划分」的完整文本可在网页上免费阅读。要进行交互式练习(内置代码编辑器和全天候 AI 导师)并解锁 Linux Networking & TCP/IP for Developers 课程的其余内容,请升级到 CoddyKit PRO。 Linux Networking & TCP/IP for Developers 课程共包含 4 节课。

「IP 地址与子网划分」这节课中我会学到什么?

掌握 IPv4 编址、网络类别和子网划分等概念,高效组织和管理 IP 网络 你通过在浏览器中直接运行的动手代码来练习 Linux Networking & TCP/IP for Developers,全天候 AI 导师会在你学习这节课的过程中回答你的问题。

学习 Linux Networking & TCP/IP for Developers 需要有经验吗?

无需任何先前经验。CoddyKit 上的 Linux Networking & TCP/IP for Developers 课程适合初学者到高级学习者,你可以从这里开始或从头开始,按照自己的节奏学习。 这是第 2 节课,共 4 节。

「IP 地址与子网划分」课时需要多长时间?

大多数 CoddyKit 课程大约需要 5–10 分钟。每节课都很精短且互动,所以你能稳步进步,并在网页和应用中从离开的地方继续。

我能在这节 Linux Networking & TCP/IP for Developers 课中编写并运行代码吗?

能。每节 Linux Networking & TCP/IP for Developers 课都包含内置代码编辑器,你可以在浏览器中直接编写并运行真实代码,并获得即时 AI 反馈 — 无需本地设置。

此课程中的所有课时

  1. 理解 TCP/IP 模型
  2. IP 地址与子网划分
  3. TCP 与 UDP 基础
  4. ICMP 以及 Ping 和 Traceroute 的作用
← 返回 Linux Networking & TCP/IP for Developers