Buffl

Capital 6: The Network Layer

as
by abdullah S.

Network Layer

The Network Layer is the third layer in the OSI (Open Systems Interconnection) model and is responsible for routing, addressing, and delivering data packets across different networks. It plays a crucial role in ensuring that data moves efficiently from the source to the destination, even if they are on different networks.

Key Functions of the Network Layer:

  1. Logical Addressing (IP Addressing)

    • The Network Layer assigns unique IP addresses to devices.

    • It ensures that packets are correctly sent to the intended recipient using these addresses.

    • Example: IPv4 (e.g., 192.168.1.1) and IPv6 (e.g., 2001:db8::ff00:42:8329).

  2. Routing

    • Determines the best path for data to travel from source to destination.

    • Uses routing protocols (e.g., OSPF, BGP, RIP) to dynamically update and find the most efficient route.

    • Routers operate at the Network Layer.

  3. Packet Forwarding

    • The Network Layer breaks data into packets and forwards them based on IP addresses.

    • Uses hop-by-hop transmission to pass packets through multiple routers.

  4. Fragmentation & Reassembly

    • If a packet is too large to be transmitted over a network, it is divided into smaller fragments.

    • At the destination, these fragments are reassembled into the original data.

  5. Error Handling & Congestion Control

    • Some protocols at this layer (like ICMP) help detect and report network errors.

    • It helps manage network congestion by optimizing traffic flow.

Protocols Operating at the Network Layer:

  • IP (Internet Protocol) – Core protocol for addressing and routing.

  • ICMP (Internet Control Message Protocol) – Used for error reporting (e.g., ping).

  • ARP (Address Resolution Protocol) – Resolves IP addresses to MAC addresses.

  • BGP (Border Gateway Protocol) – Manages routing between large networks.

Devices Operating at the Network Layer:

  • Routers – Direct data between networks.

  • Layer 3 Switches – Handle switching and routing.

Example of Network Layer in Action:

When you visit a website:

  1. Your device sends an HTTP request.

  2. The request is broken into packets.

  3. The Network Layer assigns an IP address and determines the best route.

  4. Routers forward the packets to the destination server.

  5. The server responds, and the data travels back to your device.


The IP Header

For the CCNA exam, you need to understand the IPv4 header in detail, as well as some basics of the IPv6 header. Let’s go step by step with focus on what’s important for CCNA.

IPv4 Header (CCNA Focus)

The IPv4 header is typically 20 bytes long but can be longer if options are included. It consists of 14 fields:

1. Version (4 bits)

  • Specifies the IP version (IPv4 = 4, IPv6 = 6).

2. Internet Header Length (IHL) (4 bits)

  • Specifies the length of the header in 32-bit words.

  • Minimum: 5 (20 bytes).

  • Maximum: 15 (60 bytes, with options).

3. Type of Service (TOS) / Differentiated Services (DS) (8 bits)

  • Used for Quality of Service (QoS).

  • Modern use: DSCP (Differentiated Services Code Point).

4. Total Length (16 bits)

  • Size of the entire packet (header + data).

  • Maximum: 65,535 bytes.

5. Identification (16 bits)

  • Unique ID for packet fragments.

  • Used for reassembling fragmented packets.

6. Flags (3 bits)

  • Controls fragmentation:

    • Bit 0 (Reserved): Always 0.

    • Bit 1 (DF - Don't Fragment): Prevents fragmentation.

    • Bit 2 (MF - More Fragments): Indicates more fragments are coming.

7. Fragment Offset (13 bits)

  • Identifies where this fragment belongs in the original packet.

8. Time to Live (TTL) (8 bits)

  • Prevents infinite loops.

  • Decreases by 1 at each hop.

  • When TTL = 0, the packet is discarded.

  • Used in Traceroute.

9. Protocol (8 bits)

  • Specifies the transport layer protocol:

    • 1 = ICMP

    • 6 = TCP

    • 17 = UDP

10. Header Checksum (16 bits)

  • Error-checking mechanism for the header.

  • If incorrect, the packet is discarded.

11. Source IP Address (32 bits)

  • IP address of the sender.

12. Destination IP Address (32 bits)

  • IP address of the receiver.

13. Options (Variable, rarely used)

  • Used for security, debugging, or special routing.

14. Padding (Variable)

  • Ensures the header is a multiple of 32 bits.

IPv6 Header (Basic for CCNA)

Unlike IPv4, IPv6 has a fixed 40-byte header and simplifies many fields.

IPv6 Header Fields (Key Differences from IPv4)

Field

IPv4 Equivalent

IPv6 Key Difference

Version (4 bits)

Same as IPv4

Always 6 for IPv6

Traffic Class (8 bits)

TOS/DSCP

QoS purposes

Flow Label (20 bits)

Not in IPv4

Helps in traffic prioritization

Payload Length (16 bits)

Total Length

Only for payload (IPv6 has a fixed header)

Next Header (8 bits)

Protocol

Defines the next header (TCP, UDP, etc.)

Hop Limit (8 bits)

TTL

Decreases at each hop, prevents loops

Source Address (128 bits)

IPv4 Source Address

Uses IPv6 addressing

Destination Address (128 bits)

IPv4 Destination Address

Uses IPv6 addressing

IPv6 Key Features (CCNA Focus)

  • No fragmentation (handled at the source).

  • No checksum (relies on upper layers).

  • Uses Extension Headers instead of Options.

Example Questions for CCNA

  1. What field in the IPv4 header is used to prevent infinite loops?

    • Answer: TTL (Time to Live)

  2. Which IPv4 header field identifies the transport layer protocol?

    • Answer: Protocol field

  3. What is the purpose of the Identification field in IPv4?

    • Answer: It helps in reassembling fragmented packets.

  4. How does IPv6 handle fragmentation?

    • Answer: IPv6 does not allow fragmentation in the network; it is handled by the source.

Summary (CCNA Must-Know)

  • IPv4 header is variable length (20-60 bytes).

  • IPv6 header is fixed at 40 bytes.

  • TTL in IPv4 = Hop Limit in IPv6.

  • IPv4 uses checksum, IPv6 does not.

  • IPv6 has Flow Label for QoS.


Unicast, Broadcast, and Multicast

For CCNA exam preparation, it's important to understand the different types of traffic that can flow across a network: Unicast, Broadcast, and Multicast. These concepts are critical when studying network addressing and how devices communicate.

Let’s break down each one:

1. Unicast (One-to-One Communication)

  • Definition: Unicast is communication between a single source and a single destination.

  • It is point-to-point communication, where data is sent directly from one device to another.

  • Unicast packets are addressed to one specific device using its unique MAC or IP address.

How it works:

  • The source sends a packet directly to the destination device using the destination's IP address (Layer 3) or MAC address (Layer 2).

Example:

  • Sending an email from one computer to another.

  • A router routing packets from one device to another based on their specific IP addresses.

Unicast in the OSI Model:

  • Layer 3 (Network Layer): Uses IP addresses (IPv4 or IPv6).

  • Layer 2 (Data Link Layer): Uses MAC addresses.

CCNA Example:

  • IP Addressing: If a device (192.168.1.10) sends a packet to another device (192.168.1.20), this is unicast communication. The packet will be addressed specifically to 192.168.1.20, and no other device will process it.

2. Broadcast (One-to-All Communication)

  • Definition: Broadcast is communication from a single source to all devices on the same network segment (subnet).

  • It uses a special broadcast address that is recognized by all devices within the network.

  • In IPv4, the broadcast address is 255.255.255.255 for network-wide broadcast or a specific broadcast address for a subnet (e.g., 192.168.1.255).

How it works:

  • When a device sends a broadcast packet, it is received by every device on the local network.

  • Broadcast is limited to the local network segment; it does not cross routers (unless routers are configured to allow it).

Example:

  • ARP (Address Resolution Protocol): A device sends a broadcast request asking, “Who has IP 192.168.1.20?” All devices in the local network receive this request, but only the device with that IP address responds.

  • DHCP: A device requests an IP address by sending a broadcast message to the DHCP server.

Broadcast in the OSI Model:

  • Layer 3 (Network Layer): Broadcast traffic uses a special IP address (255.255.255.255).

  • Layer 2 (Data Link Layer): Broadcast traffic is sent to the MAC address FF:FF:FF:FF:FF:FF, which all devices in the local network recognize.

CCNA Example:

  • ARP Request: A device on the network needs to find the MAC address corresponding to an IP address. It sends a broadcast ARP request, and all devices on the same network segment receive it. Only the device with the matching IP address replies with its MAC address.

3. Multicast (One-to-Many Communication)

  • Definition: Multicast is communication from a single source to a specific group of devices.

  • The source sends data to a group of devices that are members of a multicast group. This is done by addressing packets to a multicast IP address (e.g., 224.0.0.1 to 239.255.255.255 in IPv4).

How it works:

  • Multicast packets are delivered to a group of devices, not all devices on the network.

  • Devices that want to receive multicast traffic must join the multicast group using IGMP (Internet Group Management Protocol).

Example:

  • Video Conferencing or Live Streaming: One source can send video data to multiple receivers, such as a streaming server sending data to a group of clients that subscribed to the multicast group.

  • Routing Protocols like OSPF and EIGRP use multicast to send routing information to multiple routers.

Multicast in the OSI Model:

  • Layer 3 (Network Layer): Uses Multicast IP addresses (e.g., 224.0.0.1).

  • Layer 2 (Data Link Layer): Uses Multicast MAC addresses (e.g., 01:00:5E:00:00:01 for 224.0.0.1).

CCNA Example:

  • IGMP (Internet Group Management Protocol): Routers use IGMP to manage multicast group memberships. For example, if a client wants to receive multicast traffic from a server, it sends an IGMP message to the router, telling it to forward multicast packets to the client.

Key Differences for CCNA:

Traffic Type

Destination

Addressing

Scope

OSI Layer

Router Interaction

Unicast

One device

Unique IP/MAC address

Single source to single destination

Layer 3 (IP), Layer 2 (MAC)

Routed across networks

Broadcast

All devices

255.255.255.255 or subnet broadcast

Same network segment (local)

Layer 3 (IP), Layer 2 (MAC)

Blocked by routers

Multicast

Group of devices

Multicast IP (e.g., 224.x.x.x)

Specific group (limited to subscribed devices)

Layer 3 (IP), Layer 2 (MAC)

Routed with special protocols

Example Exam Questions:

  1. What is the main difference between unicast and broadcast traffic?

    • Answer: Unicast is one-to-one communication, while broadcast is one-to-all communication within a network segment.

  2. Which type of traffic uses the IP address 255.255.255.255?

    • Answer: Broadcast traffic.

  3. What protocol is commonly used for managing multicast group memberships?

    • Answer: IGMP (Internet Group Management Protocol).

  4. Which type of traffic is used for video streaming to multiple receivers on a network?

    • Answer: Multicast.

Summary for CCNA Exam Preparation:

  • Unicast = One source to one destination.

  • Broadcast = One source to all devices on the local network.

  • Multicast = One source to multiple devices in a specific group.


Converting from decimal to binary

Converting from decimal to binary is an essential concept for the CCNA exam and is frequently used in networking (e.g., subnetting). In this process, we convert a decimal number (base 10) to its equivalent binary number (base 2). Binary uses only the digits 0 and 1.

Let's break down the steps to convert a decimal number to binary:

Step-by-Step Conversion Process:

  1. Divide the decimal number by 2 (the base of the binary system).

  2. Record the remainder (it will be either 0 or 1).

  3. Divide the quotient obtained in step 1 by 2 again.

  4. Repeat this process until the quotient becomes 0.

  5. The binary equivalent is the sequence of remainders, starting from the last remainder to the first.

Example 1: Convert 13 (decimal) to binary

Let's convert 13 (decimal) to binary:

  1. 13 ÷ 2 = 6 remainder 1 (Write down 1)

  2. 6 ÷ 2 = 3 remainder 0 (Write down 0)

  3. 3 ÷ 2 = 1 remainder 1 (Write down 1)

  4. 1 ÷ 2 = 0 remainder 1 (Write down 1)

Now, we write the remainders from last to first: 13 (decimal) = 1101 (binary).

Example 2: Convert 25 (decimal) to binary

  1. 25 ÷ 2 = 12 remainder 1

  2. 12 ÷ 2 = 6 remainder 0

  3. 6 ÷ 2 = 3 remainder 0

  4. 3 ÷ 2 = 1 remainder 1

  5. 1 ÷ 2 = 0 remainder 1

Now, the binary equivalent is: 25 (decimal) = 11001 (binary).

Quick Tip for Decimal to Binary Conversion:

  • Start dividing by 2 and keep track of the remainder.

  • Remainders give you the binary digits, but remember to reverse the order after you finish dividing!

Another Example: Convert 7 (decimal) to binary

  1. 7 ÷ 2 = 3 remainder 1

  2. 3 ÷ 2 = 1 remainder 1

  3. 1 ÷ 2 = 0 remainder 1

So, 7 (decimal) = 111 (binary).

Understanding Binary Representation for Networking (for CCNA)

In networking, we often deal with IP addresses and subnetting, which require binary conversions. For instance:

  • IP Address (e.g., 192.168.1.1) can be converted to binary.

  • Subnet masks (e.g., 255.255.255.0) are often represented in binary (e.g., 11111111.11111111.11111111.00000000).


IPv4 addresses

For your CCNA exam preparation, understanding IPv4 addresses is critical. IPv4 addresses are used to identify devices on a network, and having a solid understanding of how they work will help you with tasks like subnetting, routing, and networking fundamentals.

Let's break down the key concepts about IPv4 addresses in a way that’s easy to grasp.

1. What is an IPv4 Address?

An IPv4 address is a 32-bit numerical identifier for a device on an IP network. It’s written in dotted decimal notation, which consists of four octets (8-bit groups), separated by periods. Each octet can represent a number between 0 and 255.

IPv4 Address Format: xxx.xxx.xxx.xxx

  • Example: 192.168.1.1

Each of the four numbers (octets) is called an octet and is an 8-bit number. So, an IPv4 address has 32 bits in total:

  • 8 bits × 4 octets = 32 bits

2. Classes of IPv4 Addresses

IPv4 addresses are categorized into five classes (A, B, C, D, and E). However, for CCNA, you’ll focus mainly on Class A, B, and C.

Class A

  • Range: 0.0.0.0 to 127.255.255.255

  • Default Subnet Mask: 255.0.0.0

  • Network Bits: 8 (first octet)

  • Host Bits: 24

  • Example Address: 10.0.0.1

  • Usage: Used for large networks (up to 16 million hosts).

Class B

  • Range: 128.0.0.0 to 191.255.255.255

  • Default Subnet Mask: 255.255.0.0

  • Network Bits: 16 (first two octets)

  • Host Bits: 16

  • Example Address: 172.16.0.1

  • Usage: Used for medium-sized networks (up to 65,000 hosts).

Class C

  • Range: 192.0.0.0 to 223.255.255.255

  • Default Subnet Mask: 255.255.255.0

  • Network Bits: 24 (first three octets)

  • Host Bits: 8

  • Example Address: 192.168.1.1

  • Usage: Used for small networks (up to 254 hosts).

Class D (Multicast)

  • Range: 224.0.0.0 to 239.255.255.255

  • Usage: Reserved for multicast addresses. Not used for normal device-to-device communication.

Class E (Reserved)

  • Range: 240.0.0.0 to 255.255.255.255

  • Usage: Reserved for experimental or future use.

3. Private and Public IPv4 Addresses

  • Private IPv4 Addresses are used in internal networks and are not routed on the internet. These addresses fall within specific ranges:

    • Class A: 10.0.0.0 to 10.255.255.255

    • Class B: 172.16.0.0 to 172.31.255.255

    • Class C: 192.168.0.0 to 192.168.255.255

  • Public IPv4 Addresses are globally unique and are used for internet-facing devices. These addresses are routable on the internet.

4. Subnet Masks

A subnet mask helps define which portion of the IP address refers to the network and which part refers to the host. It’s written in the same dotted decimal format as an IP address.

Common Subnet Masks (For CCNA):

  • Class A: 255.0.0.0 (or /8 in CIDR notation)

  • Class B: 255.255.0.0 (or /16)

  • Class C: 255.255.255.0 (or /24)

The subnet mask is used in conjunction with the IP address to determine whether a device is on the same network or if the packet needs to be routed to another network.

Example:

For the IP address 192.168.1.10 with a subnet mask 255.255.255.0, the network portion is 192.168.1.0 and the host portion is .10.

5. CIDR Notation

CIDR (Classless Inter-Domain Routing) is a more flexible method of representing IP addresses and subnet masks. Instead of using the traditional subnet mask like 255.255.255.0, CIDR uses a slash notation to indicate the number of bits used for the network portion.

Example:

  • 192.168.1.10/24 means the first 24 bits are used for the network, which corresponds to the subnet mask 255.255.255.0.

6. Special IPv4 Addresses

  • Loopback Address: 127.0.0.1 is used to test the network stack on a local machine.

  • Broadcast Address: An address that targets all devices on a network. In a 192.168.1.0/24 network, the broadcast address would be 192.168.1.255.

  • Network Address: The first address in a subnet. In the 192.168.1.0/24 network, 192.168.1.0 is the network address.

  • Directed Broadcast Address: Used to send data to all devices on a specific network. Example: In a 192.168.1.0/24 network, the directed broadcast address would be 192.168.1.255.

7. IP Addressing in Networking (For CCNA)

Understanding IP Addressing is essential for configuring and managing networks. You will need to know how to:

  • Assign IP addresses to devices.

  • Subnet IP addresses based on network requirements.

  • Identify whether two devices are on the same network or different networks.

Quick Recap for the CCNA Exam:

  • IPv4 addresses are 32-bit numbers, written as four octets in dotted decimal format (e.g., 192.168.1.1).

  • Class A, B, C are the primary address classes used for different-sized networks.

  • Private IP ranges are for internal networks, while Public IPs are used for devices on the internet.

  • Subnet masks and CIDR notation are used to define network size and routing boundaries.

  • Special addresses include loopback (127.0.0.1), broadcast addresses, and directed broadcast.

Example Exam Questions:

  1. What is the default subnet mask for a Class C IP address?

    • Answer: 255.255.255.0 or /24.

  2. Which of the following IP addresses is a private address?

    • a) 10.0.0.1

    • b) 192.168.1.1

    • c) 172.30.0.1

    • d) 8.8.8.8

    • Answer: All three options (a, b, and c) are private addresses.

  3. What is the broadcast address for the network 192.168.1.0/24?

    • Answer: 192.168.1.255.


Calculating an IPv4 address in binary

Calculating an IPv4 address in binary is an important skill for your CCNA exam preparation. Understanding how to convert and work with binary numbers is critical, especially when dealing with subnetting, IP addressing, and routing concepts.

Let’s walk through how to convert an IPv4 address from dotted decimal notation (like 192.168.1.1) to binary and back.

Step-by-Step Guide to Converting IPv4 Addresses to Binary

An IPv4 address is a 32-bit number, written in 4 octets (8 bits each) separated by periods (.). To convert an IPv4 address to binary:

  1. Take each octet (number) in the IP address and convert it into its 8-bit binary equivalent.

  2. Combine the binary values of all 4 octets to form the complete 32-bit IPv4 address.

Let’s break this down with an example.

Example: Convert 192.168.1.1 to Binary

1. Convert each octet to binary:

  • First octet (192):

    • Decimal 192 → Binary: 11000000

  • Second octet (168):

    • Decimal 168 → Binary: 10101000

  • Third octet (1):

    • Decimal 1 → Binary: 00000001

  • Fourth octet (1):

    • Decimal 1 → Binary: 00000001

2. Combine the binary values of all four octets:

So, the IPv4 address 192.168.1.1 in binary would be:

KopierenBearbeiten

11000000.10101000.00000001.00000001

This is a 32-bit representation (4 octets × 8 bits = 32 bits).

How to Convert Each Decimal Octet to Binary:

The best way to convert each decimal number to binary is by successive division by 2, noting the remainders.

Example: Convert 192 to Binary

  1. 192 ÷ 2 = 96 remainder 0

  2. 96 ÷ 2 = 48 remainder 0

  3. 48 ÷ 2 = 24 remainder 0

  4. 24 ÷ 2 = 12 remainder 0

  5. 12 ÷ 2 = 6 remainder 0

  6. 6 ÷ 2 = 3 remainder 0

  7. 3 ÷ 2 = 1 remainder 1

  8. 1 ÷ 2 = 0 remainder 1

Now, we reverse the remainders: 192 (decimal) = 11000000 (binary).

Practice Example: Convert 255.255.255.0 to Binary

Let’s now convert the subnet mask 255.255.255.0 to binary.

  • First octet (255):

    • Decimal 255 → Binary: 11111111

  • Second octet (255):

    • Decimal 255 → Binary: 11111111

  • Third octet (255):

    • Decimal 255 → Binary: 11111111

  • Fourth octet (0):

    • Decimal 0 → Binary: 00000000

So, the subnet mask 255.255.255.0 in binary is:

KopierenBearbeiten

11111111.11111111.11111111.00000000

Quick Tips for CCNA Exam:

  • Each octet in an IPv4 address is 8 bits (so the total is always 32 bits for the full address).

  • 255 in decimal is 11111111 in binary, which means all bits are 1.

  • 0 in decimal is 00000000 in binary, which means all bits are 0.

  • When you see 255 in a subnet mask, it indicates that the corresponding part of the IP address is the network portion.

  • When you see 0 in a subnet mask, it indicates that the corresponding part of the IP address is the host portion.

Why Is This Important for the CCNA Exam?

  • Subnetting: Understanding binary helps with subnetting, which involves manipulating IP addresses and subnet masks to divide networks into smaller subnets.

  • Network vs. Host Portion: In the binary representation of an IP address, you'll see which bits are used to represent the network portion and which bits are used for the host portion (important for subnetting).

  • CIDR Notation: You need to know how to translate between subnet masks in binary and CIDR notation (e.g., 255.255.255.0 = /24).

Additional Practice Example: Convert 172.16.10.5 to Binary

  1. First octet (172):

    • Decimal 172 → Binary: 10101100

  2. Second octet (16):

    • Decimal 16 → Binary: 00010000

  3. Third octet (10):

    • Decimal 10 → Binary: 00001010

  4. Fourth octet (5):

    • Decimal 5 → Binary: 00000101

So, 172.16.10.5 in binary is:

KopierenBearbeiten

10101100.00010000.00001010.00000101

Summary of Steps:

  1. Write the decimal IP address.

  2. Convert each octet (number) to binary using division-by-2 method or a binary chart.

  3. Combine the binary numbers for all octets to get the full 32-bit binary IPv4 address.

  4. Use binary representations for subnetting and CIDR notation when needed.

Key Points for CCNA:

  • IPv4 addresses are 32-bit binary numbers.

  • Dotted decimal notation is simply the binary address split into 4 octets, each represented as a decimal number.

  • Knowing how to convert between decimal and binary is crucial for understanding subnetting, CIDR, and network design.


subnet mask

Understanding the subnet mask is crucial for your CCNA exam preparation because it plays a key role in IP addressing and subnetting, which are essential concepts in networking.

Let's break down what a subnet mask is, how it works, and how to use it for subnetting.

What is a Subnet Mask?

A subnet mask is a 32-bit number used to divide an IP address into two parts:

  • Network portion: Identifies the network to which the device belongs.

  • Host portion: Identifies the specific device (host) within that network.

In simpler terms, a subnet mask is used to "mask" or identify which part of the IP address is the network and which part is the host.

Format of a Subnet Mask

A subnet mask is usually written in dotted decimal notation, just like an IP address, with four octets (each 8 bits). The subnet mask consists of 1s in the network portion and 0s in the host portion.

For example:

  • Subnet Mask: 255.255.255.0

In binary, the subnet mask would look like this:

  • Binary Subnet Mask: 11111111.11111111.11111111.00000000

How Subnet Masks Work

Network and Host Division

  • The 1s in the subnet mask represent the network portion of the IP address.

  • The 0s in the subnet mask represent the host portion of the IP address.

Using the example subnet mask 255.255.255.0:

  • The first 24 bits (represented by the 255 in each of the first three octets) are used for the network.

  • The last 8 bits (represented by 0 in the last octet) are used for the hosts.

For example, with an IP address like 192.168.1.10 and subnet mask 255.255.255.0, the network portion is 192.168.1 and the host portion is .10.

Common Subnet Masks (For CCNA)

Here are some common subnet masks you'll encounter in the CCNA exam:

  • Class A (255.0.0.0): Network: 8 bits, Host: 24 bits Example: 10.0.0.0 with subnet mask 255.0.0.0

  • Class B (255.255.0.0): Network: 16 bits, Host: 16 bits Example: 172.16.0.0 with subnet mask 255.255.0.0

  • Class C (255.255.255.0): Network: 24 bits, Host: 8 bits Example: 192.168.1.0 with subnet mask 255.255.255.0

Subnet Mask in CIDR Notation

Instead of writing out the full subnet mask in dotted decimal notation, CIDR (Classless Inter-Domain Routing) notation uses a shorthand form to represent the subnet mask.

CIDR Notation Format:

  • The slash ("/") is followed by the number of network bits (the number of 1s in the subnet mask).

  • For example:

    • 255.255.255.0 = /24 (because the first 24 bits are 1s).

    • 255.255.0.0 = /16 (because the first 16 bits are 1s).

    • 255.0.0.0 = /8 (because the first 8 bits are 1s).

So, 192.168.1.0 with a subnet mask 255.255.255.0 can be written in CIDR as 192.168.1.0/24.

How to Calculate Subnet Masks (For Subnetting)

1. Determine the Number of Networks/Hosts Needed

Before subnetting, you need to determine how many subnets and how many hosts you need for your network. This will help you decide on the subnet mask.

  • To find the number of subnets: Use the formula:

    Subnets=2n\text{{Subnets}} = 2^nSubnets=2n

    where n is the number of bits borrowed from the host portion for subnetting.

  • To find the number of hosts: Use the formula:

    Hosts per subnet=2h−2\text{{Hosts per subnet}} = 2^h - 2Hosts per subnet=2h−2

    where h is the number of host bits (subtract 2 for the network and broadcast addresses).

Example 1:

If you need to subnet a Class C network (192.168.1.0/24) into 4 subnets:

  • You need to borrow 2 bits from the host portion (since 22=42^2 = 422=4 subnets).

  • Now your new subnet mask will have 26 bits for the network portion (24 bits original + 2 bits borrowed).

  • The new subnet mask is 255.255.255.192 or /26.

Example 2:

If you need 30 hosts per subnet:

  • For 30 hosts, you need 5 host bits (because 25−2=302^5 - 2 = 3025−2=30).

  • Therefore, you need to leave 5 bits for the host portion. Since the original Class C subnet mask has 8 bits for hosts, you’ll borrow 3 bits for subnetting (since 8−5=38 - 5 = 38−5=3).

  • The new subnet mask is 255.255.255.248 or /29.

Subnet Mask and Network Calculation Example

Let's say you have the IP address 192.168.1.10 with a subnet mask 255.255.255.0 (or /24). Here's how you would calculate the network and host portions:

  1. Network Portion: The first 24 bits of the IP address are for the network. So for 192.168.1.10:

    • The network portion is 192.168.1.0.

  2. Host Portion: The last 8 bits are for the host. So for 192.168.1.10:

    • The host portion is .10.

  3. Network Address: The network address is the first address of the network. For 192.168.1.0/24, the network address is 192.168.1.0.

  4. Broadcast Address: The broadcast address is the last address of the network. For 192.168.1.0/24, the broadcast address is 192.168.1.255.

  5. Usable IP Range: The usable IP range is the range of addresses between the network address and the broadcast address. For 192.168.1.0/24, the usable IP range is 192.168.1.1 to 192.168.1.254.

Key Points for CCNA Exam:

  1. A subnet mask helps separate the network portion and the host portion of an IP address.

  2. Common subnet masks for Class A, B, and C networks are:

    • Class A: 255.0.0.0 or /8

    • Class B: 255.255.0.0 or /16

    • Class C: 255.255.255.0 or /24

  3. CIDR notation is a shorthand for subnet masks (e.g., /24 instead of 255.255.255.0).

  4. You need to know how to calculate subnets and hosts for subnetting.

  5. Subnetting involves borrowing bits from the host portion to create multiple subnets.

Practice Example:

If you have the IP address 192.168.10.0/24 and need to create 8 subnets, what would the new subnet mask be?

  • You need to borrow 3 bits to create 8 subnets (23=82^3 = 823=8).

  • The new subnet mask would be 255.255.255.224 or /27.


Slash notation

Slash notation, also known as CIDR notation (Classless Inter-Domain Routing notation), is a shorthand way of representing IP addresses and their associated subnet masks. It simplifies the process of representing networks and is commonly used in networking.

What is Slash Notation?

Slash notation is written as:

php-template

KopierenBearbeiten

<IP address>/<prefix length>

Where:

  • The IP address is the network address (e.g., 192.168.1.0).

  • The prefix length (the number after the slash) represents the number of bits in the network portion of the IP address.

For example:

  • 192.168.1.0/24

  • 10.0.0.0/8

  • 172.16.0.0/16

The prefix length specifies how many bits are used for the network portion of the IP address.

How Slash Notation Works

In an IPv4 address, there are 32 bits in total. The slash notation tells you how many of those bits are assigned to the network portion.

Example: 192.168.1.0/24

  • 192.168.1.0 is the network address.

  • /24 means the first 24 bits of the 32-bit IP address are used for the network portion, and the remaining 8 bits are used for the host portion.

This corresponds to the subnet mask 255.255.255.0, which in binary looks like:

KopierenBearbeiten

11111111.11111111.11111111.00000000

In this case:

  • The first 24 bits (11111111.11111111.11111111) represent the network.

  • The last 8 bits (00000000) represent the host.

Prefix Length Examples

Here are a few common examples of slash notation and their corresponding subnet masks:

  • /8:

    • IP address: 10.0.0.0/8

    • Subnet mask: 255.0.0.0

    • 8 bits are used for the network portion (1 byte).

    • Suitable for very large networks.

  • /16:

    • IP address: 172.16.0.0/16

    • Subnet mask: 255.255.0.0

    • 16 bits are used for the network portion (2 bytes).

    • Suitable for medium-sized networks.

  • /24:

    • IP address: 192.168.1.0/24

    • Subnet mask: 255.255.255.0

    • 24 bits are used for the network portion (3 bytes).

    • Suitable for smaller networks.

  • /30:

    • IP address: 192.168.1.0/30

    • Subnet mask: 255.255.255.252

    • 30 bits are used for the network portion (leaving only 2 bits for the host portion).

    • This subnet mask is commonly used for point-to-point links where only 2 hosts are required (e.g., router-to-router).

Why Use Slash Notation?

  1. Simplifies subnetting: CIDR notation makes it easier to represent subnets and network sizes. It removes the need to remember complex dotted decimal subnet masks.

  2. Flexibility: With slash notation, you can divide an IP address into more flexible subnet sizes. This is important for efficient IP address allocation.

  3. More Efficient IP Addressing: CIDR allows for more efficient use of IP addresses, reducing waste. It replaces the old class-based system, which was less efficient.

Slash Notation Examples:

  • Example 1: 192.168.1.0/24

    • This network has 24 bits for the network and 8 bits for the host.

    • Subnet mask: 255.255.255.0

    • Usable IP range: 192.168.1.1 to 192.168.1.254

  • Example 2: 172.16.0.0/16

    • This network has 16 bits for the network and 16 bits for the host.

    • Subnet mask: 255.255.0.0

    • Usable IP range: 172.16.0.1 to 172.16.255.254

  • Example 3: 10.0.0.0/8

    • This network has 8 bits for the network and 24 bits for the host.

    • Subnet mask: 255.0.0.0

    • Usable IP range: 10.0.0.1 to 10.255.255.254

How to Convert Between Slash Notation and Subnet Mask

You can convert between slash notation and the subnet mask by understanding the number of 1s in the subnet mask.

For example:

  • /24 means the first 24 bits are 1s in the subnet mask. The corresponding subnet mask is 255.255.255.0.

  • /16 means the first 16 bits are 1s in the subnet mask. The corresponding subnet mask is 255.255.0.0.

Key Takeaways for CCNA Exam:

  1. CIDR Notation (slash notation) represents an IP address and its subnet mask in a simpler form.

  2. The number after the slash (/24, /16, /8, etc.) represents the number of bits in the network portion of the IP address.

  3. It’s important to understand how CIDR notation relates to subnet masks when subnetting or configuring networks.

  4. CIDR notation helps in efficient IP address allocation and flexible subnetting.


Author

abdullah S.

Information

Last changed