1. Home
  2. Explore
  3. Computer Science
  4. Networking Fundamentals

Study methods

Flashcards
Quiz
Fill in the blanks
Written test
Lesson
Notes
Podcast
Content

Networking Fundamentals

Networking Fundamentals for UniFi Network Design

Networking becomes much easier to understand once its central purpose is clear: a network allows devices to communicate with one another. Those devices may include computers, smartphones, wireless clients, servers, switches, routers, or devices connected to the internet.

Before designing a UniFi network, a student needs to understand how devices are grouped, how information moves between them, and how addresses identify both devices and networks. The most important foundations are the distinction between LANs and WANs, the OSI model, Layer 2 and Layer 3 communication, MAC addresses, IP addresses, subnetting, CIDR notation, private address ranges, DHCP, and DNS.

Local Area Networks and Wide Area Networks

A local area network, or LAN, is the portion of a network that exists within a local organization, home, office, or site. It generally includes the devices and network infrastructure located behind the firewall.

Examples of LAN devices include:

  • Desktop computers and laptops
  • Smartphones and wireless clients
  • Printers
  • Access points
  • Ethernet switches
  • Local servers
  • Network-connected cameras and other devices

The LAN is the part of the network over which a network administrator has the greatest control. The administrator can decide how devices are grouped, which IP addresses they use, what VLANs they belong to, and which devices are allowed to communicate.

A wide area network, or WAN, is the network outside the local environment. The WAN commonly includes the connection to an internet service provider, or ISP, and the wider internet beyond it.

A firewall or router generally sits between the LAN and WAN:

  • Traffic traveling from a local device toward the internet moves from the LAN through the firewall and into the WAN.
  • Traffic returning from the internet travels through the WAN, reaches the firewall, and may then be forwarded into the LAN.
  • The router uses Layer 3 information, especially IP addresses, to make decisions about where traffic should go.

A useful analogy is a building. The LAN is the inside of the building, where the organization controls the rooms, doors, and occupants. The WAN is the public road system outside. The firewall is the controlled entrance between the two.

A LAN is the locally controlled network behind the firewall; a WAN is the external network leading toward the ISP and the wider internet.

Think About It

If a laptop communicates with a printer in the same office, is that communication primarily local or wide-area? If the laptop loads a website hosted elsewhere, which boundary does the traffic cross?

The OSI Network Model

The OSI model is a conceptual framework that divides networking into seven layers. Each layer represents a different responsibility in the process of communication.

The model helps explain why different networking devices and protocols perform different jobs. For example, a switch primarily uses Layer 2 information, while a router primarily uses Layer 3 information.

A common mnemonic for remembering the layers from bottom to top is:

Please Do Not Throw Sausage Pizza Away

Another mnemonic is:

Please Do Not Touch Steve’s Pet Alligator

The seven layers, from the bottom upward, are as follows.

Layer 1: Physical Layer

The Physical layer concerns the parts of a network that can be physically touched. It includes the medium through which signals travel and the physical interfaces that connect devices.

Examples include:

  • Ethernet cables
  • Wires
  • RJ45 connectors
  • Physical network ports
  • Other physical components required to make communication possible

This layer does not interpret addresses or decide where traffic should go. It provides the physical pathway over which signals move.

Layer 2: Data Link Layer

The Data Link layer is where much of the switching activity occurs. This layer uses MAC addresses to identify devices on a local network.

Ethernet switches primarily operate at this layer. They examine Layer 2 information and forward traffic toward the appropriate physical port.

Layer 2 also involves frames, which are units of data that contain information such as:

  • The sender’s MAC address
  • The receiver’s MAC address
  • VLAN information, including a VLAN ID
  • The encapsulated data being transported

Layer 2 is therefore strongly associated with local delivery. It helps a switch determine which device on the local network should receive a frame.

Layer 3: Network Layer

The Network layer is associated with IP addressing and routing. Routers and Layer 3 switches use IP addresses to determine how traffic should move between different networks.

For example, when traffic needs to move from one VLAN to another or from a LAN toward the internet, Layer 3 information helps determine the destination and the next path.

A router commonly connects the LAN to the WAN. It examines IP addresses and translates or forwards traffic between the local network and the ISP connection.

Layer 4: Transport Layer

The Transport layer manages protocols that support communication between applications and devices.

Two important transport protocols are:

  • TCP, which supports reliable, organized communication
  • UDP, which supports communication with less overhead and without the same type of delivery guarantees

Transport-layer information can include port numbers. Port numbers help identify which service or application should receive a particular communication.

Layer 5: Session Layer

The Session layer manages communication sessions between systems. A session represents an ongoing exchange of information.

Network devices can track this activity using a state table, sometimes called a session table. The table helps a router keep track of active connections and understand which packets belong to which communication session.

For example, when a device inside the LAN communicates with an external service, the router must remember information about that connection so that returning traffic can be associated with the correct internal device.

Layer 6: Presentation Layer

The Presentation layer concerns how information is represented so that it can be displayed or understood by the receiving system.

This is the layer associated with the form in which information is presented to the user. For example, a video displayed on a screen is ultimately information that has been formatted and interpreted so that the user can see and interact with it.

Layer 7: Application Layer

The Application layer is closest to the programs and services that users interact with.

Examples include:

  • Facebook Messenger
  • Signal
  • Web applications
  • Other network-enabled applications

Modern routers and network devices can sometimes identify applications by recognizing application signatures. This allows network administrators to create policies based on the application involved, rather than relying only on addresses and ports.

Why Layers 2 and 3 Matter Most for UniFi Networks

Although all seven layers help describe communication, network administration commonly focuses heavily on Layers 2 and 3.

  • Layer 2 explains switching, MAC addresses, Ethernet frames, and VLAN information.
  • Layer 3 explains IP addresses, subnets, routing, and communication between separate networks.

Together, these layers explain much of what switches, routers, gateways, and VLANs do in a UniFi environment.

Layer 2 Switching and Layer 3 Switching

A traditional Layer 2 switch forwards traffic based primarily on MAC addresses. It connects devices within a local network and sends frames toward the port associated with the destination MAC address.

A Layer 3 switch can perform the normal switching functions of a Layer 2 switch while also providing some routing capabilities. This means it can use IP addresses to route traffic between networks, such as separate VLANs.

For example, suppose an organization has:

  • A staff VLAN
  • A guest VLAN
  • A camera VLAN

If traffic must move from one VLAN to another, a Layer 3 switch may route that traffic internally. The packets do not necessarily need to travel all the way back to the firewall before being redirected.

A Layer 2 switch, by contrast, generally does not perform that routing function. Inter-VLAN traffic would need to be handled by a router or firewall.

Why Switching Can Be Efficient

Switches often use specialized hardware called an ASIC, or application-specific integrated circuit. An ASIC is designed to perform particular networking operations very efficiently.

Because switching can be handled by specialized hardware, a switch can process and forward large amounts of traffic very quickly. The source material describes switching hardware as capable of handling traffic at extremely high speeds, including more than 100100100 gigabits per second in suitable hardware.

The key distinction is:

  • A Layer 2 switch forwards local frames using MAC addresses.
  • A Layer 3 switch can also route between networks using IP addresses.
  • A router or firewall commonly handles traffic between the LAN and WAN.

Think About It

If two devices belong to different VLANs, why might a Layer 3 switch be more efficient than sending their traffic to the firewall and back? The answer is that the Layer 3 switch may route the traffic locally instead of requiring an additional trip through the firewall.

MAC Addresses

A MAC address, or Media Access Control address, is a Layer 2 identifier associated with a network interface.

Each Ethernet port has a MAC address, and wireless devices also use MAC addresses when connecting to Wi-Fi. A MAC address allows the local network to identify which device or interface is communicating.

MAC addresses are often described as hardware or factory-assigned identifiers. However, they can sometimes be changed or overridden by a technically capable user or by software.

The Two Parts of a MAC Address

A MAC address can generally be understood as having two sections.

The first section is the OUI, or Organizationally Unique Identifier. The OUI identifies the manufacturer or organization associated with the network interface.

This is why a network-management system may identify a device as belonging to a particular manufacturer, such as Apple, Google, or Ubiquiti. The system can examine the beginning portion of the MAC address and compare it with known manufacturer assignments.

The second section is specific to the individual network interface. It distinguishes one device from another made by the same manufacturer.

Thus:

  • The beginning portion generally identifies the manufacturer.
  • The remaining portion identifies the particular interface or device.

Randomized MAC Addresses

Some smartphones, including iPhones, may generate randomized MAC addresses when connecting to wireless networks. This is intended to provide additional privacy, but it can complicate network administration.

For example, a network administrator might attempt to create a rule based on a device’s MAC address. If the device changes its MAC address, the rule may no longer identify the device consistently.

Managing this behavior may require organization-level management, such as a mobile device management system capable of controlling or disabling MAC randomization.

MAC addresses are useful for identifying devices locally, but they are not always permanent or reliable identifiers when privacy features or administrative controls allow them to change.

Encapsulation: Data, Segments, Packets, and Frames

When information travels through a network, each layer adds its own information. This process is called encapsulation.

The original information can be viewed as being wrapped in progressively larger structures, somewhat like layers of an onion.

Data

At the center is the actual information being transmitted. This might be a piece of a video stream or another portion of an application’s content.

Segment

The data is encapsulated in a segment. The transport layer may add information such as a TCP or UDP port number.

The port number helps identify the application or service involved in the communication.

Packet

The segment is then placed inside a packet. The packet contains Layer 3 information, especially IP addresses.

Routers and Layer 3 switches examine packet-level information to decide where the information should go.

Frame

The packet is then placed inside a frame. The frame contains Layer 2 information, including:

  • The source MAC address
  • The destination MAC address
  • VLAN identifiers or related VLAN information

Switches primarily inspect the frame. This is what allows them to forward local traffic efficiently.

The simplified structure is therefore:

Data→Segment→Packet→Frame\text{Data} \rightarrow \text{Segment} \rightarrow \text{Packet} \rightarrow \text{Frame}Data→Segment→Packet→Frame

Each layer adds information needed for its own role. The switch focuses on the frame, while the router focuses more heavily on the packet.

IP Addresses

An IP address is a Layer 3 address used to identify a device or network interface and to help route traffic between networks.

A common IPv4 address is written as four numerical sections called octets, separated by periods. For example:

192.168.1.25192.168.1.25192.168.1.25

Each octet can contain a value from 000 through 255255255.

Computers represent IPv4 addresses in binary, while people generally use decimal notation because it is easier to read. Converting addresses between decimal and binary can be useful for understanding subnetting, although network administrators often use reference charts or subnet calculators rather than performing every conversion manually.

Subnets and Network Portions

A subnet is a defined portion of an IP address space. A subnet determines which part of an address identifies the network and which part identifies an individual device, called a host.

One traditional way to write a subnet mask is:

255.255.0.0255.255.0.0255.255.0.0

In this example, the first two octets represent the network portion, while the final two octets represent the host portion.

Another very common subnet mask is:

255.255.255.0255.255.255.0255.255.255.0

This means that the first three octets describe the network, while the final octet is available for hosts.

For example, a network based on:

192.168.1.0 with a mask of 255.255.255.0192.168.1.0 \text{ with a mask of } 255.255.255.0192.168.1.0 with a mask of 255.255.255.0

has an address space covering values in the final octet from 000 through 255255255. Some of those addresses are reserved for special purposes, so the number of usable host addresses is typically 254254254.

Subnetting matters because it allows a larger address space to be divided into smaller, more manageable networks. Different subnets can represent different departments, device types, VLANs, sites, or security zones.

Think About It

Why would an administrator divide a network into several smaller subnets instead of placing every device in one large network? Smaller subnets make it possible to organize traffic and separate groups of devices, although the specific security policies are handled by routing and firewall rules.

CIDR Notation

CIDR, pronounced “cider,” stands for Classless Inter-Domain Routing. CIDR notation expresses the size of a subnet using a slash followed by a number.

The subnet mask:

255.255.255.0255.255.255.0255.255.255.0

is equivalent to:

/24/24/24

The number after the slash indicates how many bits belong to the network portion of the address. A larger CIDR number means that more bits are used for the network and fewer remain for individual hosts.

For example:

  • A /24/24/24 network is a common local network size.
  • A /25/25/25 divides a corresponding /24/24/24 space into two smaller networks.
  • A /29/29/29 provides a small block of addresses.
  • A /32/32/32 represents one specific IP address.

Dividing Subnets

A /16/16/16 network can be divided into two /17/17/17 networks. Each of those networks can be divided again into smaller sections.

A /24/24/24 can be divided into two /25/25/25 networks. The two resulting ranges do not both begin at host address 111.

For example, the two halves of a /24/24/24 may be divided into ranges resembling:

  • 192.168.0.0/25192.168.0.0/25192.168.0.0/25
  • 192.168.0.128/25192.168.0.128/25192.168.0.128/25

The second subnet begins at a different boundary because the subnet has been split into two equal address ranges. This is an important reason subnet calculators are useful: they show the actual network boundaries and usable address ranges instead of requiring the administrator to calculate them manually.

Common CIDR Sizes

A few CIDR sizes are especially useful to recognize:

  • /24/24/24: A very common local network size, generally providing approximately 254254254 usable host addresses.
  • /29/29/29: A small block commonly associated with five usable public IP addresses when an ISP also reserves an address for its gateway.
  • /32/32/32: A single IP address.

When an ISP provides a /29/29/29 block, the ISP may use one address as the gateway on its side, leaving five usable addresses for the customer.

Subnet calculators can display:

  • The subnet address
  • The complete address range
  • The usable host range
  • The number of available hosts
  • The boundaries created when a subnet is divided into smaller subnets
  • The way smaller subnets can be recombined into larger ones

RFC 1918 Private Address Ranges

Certain IPv4 ranges are reserved for private, internal network use. These are defined by RFC 1918 and are not publicly routable across the internet.

The three private ranges are:

10.0.0.0/810.0.0.0/810.0.0.0/8 172.16.0.0/12172.16.0.0/12172.16.0.0/12 192.168.0.0/16192.168.0.0/16192.168.0.0/16

These ranges provide address space that organizations can use inside their LANs. Because the addresses are private, the same private ranges can be reused by many unrelated organizations.

The 192.168.0.0/16192.168.0.0/16192.168.0.0/16 range contains many smaller subnets. Common examples include:

192.168.0.0/24192.168.0.0/24192.168.0.0/24 192.168.1.0/24192.168.1.0/24192.168.1.0/24 192.168.2.0/24192.168.2.0/24192.168.2.0/24

An individual /24/24/24 subnet usually provides approximately 254254254 usable host addresses.

Avoiding Address Conflicts

Although many routers use a default network such as 192.168.1.0/24192.168.1.0/24192.168.1.0/24, relying on extremely common ranges can create problems.

Suppose the internal LAN uses:

192.168.1.0/24192.168.1.0/24192.168.1.0/24

and an external device or service on the WAN side also uses the same range. The router then sees the same network on both sides of its boundary. It cannot clearly determine whether traffic belongs inside the LAN or outside the firewall.

This can occur with equipment or services that use common private ranges by default. A network administrator may therefore choose less common internal subnets to reduce the possibility of conflicts, especially when using site-to-site VPNs or external services whose addressing cannot easily be changed.

Avoiding Public Address Ranges Internally

An administrator should also avoid using someone else’s public IP range inside the LAN. For example, using a public range associated with a major internet service internally can cause routing confusion.

If a router believes that the public address belongs to a device inside the LAN, it may try to send traffic locally instead of sending it to the actual public destination on the internet. This can prevent services from working correctly.

Private RFC 1918 ranges are intended for internal networks, while public IP ranges should not be casually reused inside the LAN.

DHCP

DHCP, or Dynamic Host Configuration Protocol, automatically provides network configuration to devices.

When a computer connects to a network, it may not yet have an IP address. The computer requests configuration, and the DHCP service responds with information such as:

  • An available IP address
  • The subnet information
  • The gateway
  • Other network configuration details

This prevents the administrator from having to manually assign an IP address to every device.

For example, when a laptop connects to an Ethernet port, it can request an address. The DHCP server selects an available address from the relevant subnet and leases it to the laptop.

DHCP can also provide additional information, including:

  • An NTP server, used for time synchronization
  • A TFTP server, used by certain devices to retrieve configuration or files

DHCP is therefore more than an address-distribution mechanism. It can provide several pieces of information that help clients operate correctly on the network.

DNS

DNS, or Domain Name System, converts human-friendly names into IP addresses.

People generally prefer to remember names such as:

  • google.com
  • A website’s domain name
  • A familiar server name

Computers and network devices, however, use IP addresses to establish communication. DNS provides the translation between the name and the address.

A fully qualified domain name, or FQDN, is a complete domain name that identifies a specific location in the DNS hierarchy.

Without DNS, a user would need to remember the IP address of every website or network service. DNS makes network resources easier to locate by allowing users and applications to use names.

DNS is also a common cause of apparent network failures. A device may have a functioning network connection but still be unable to reach a website if it cannot translate the website’s name into an IP address. This is why network administrators often investigate DNS when internet services appear to be unavailable.

Think About It

If a device can reach an IP address directly but cannot open the corresponding domain name, which service is a likely source of the problem? The likely cause is DNS, because the physical connection and IP routing may be working while name resolution is failing.

Comprehensive Review

Networking is the process of allowing devices to communicate. The LAN represents the locally controlled portion of the network, while the WAN represents the external network leading to the ISP and the wider internet.

The OSI model organizes networking responsibilities into seven layers:

  1. Physical
  2. Data Link
  3. Network
  4. Transport
  5. Session
  6. Presentation
  7. Application

Layer 2 focuses on local delivery through MAC addresses and Ethernet frames. Layer 3 focuses on IP addresses and routing between networks. A Layer 2 switch forwards local frames, while a Layer 3 switch can also route between VLANs or other networks. Specialized switching hardware, such as an ASIC, allows switches to process traffic efficiently.

Data becomes progressively encapsulated as it moves through the network:

Data→Segment→Packet→Frame\text{Data} \rightarrow \text{Segment} \rightarrow \text{Packet} \rightarrow \text{Frame}Data→Segment→Packet→Frame

MAC addresses identify network interfaces at Layer 2. Their beginning portion commonly identifies the manufacturer through the OUI, while the remaining portion identifies the particular interface. Randomized MAC addresses can make device-based network rules more difficult to maintain.

IPv4 addresses consist of four octets, each ranging from 000 through 255255255. Subnet masks divide an address into a network portion and a host portion. CIDR notation expresses the same division more compactly, such as:

255.255.255.0=/24255.255.255.0 = /24255.255.255.0=/24

The private address ranges defined by RFC 1918 are:

10.0.0.0/8,172.16.0.0/12,192.168.0.0/1610.0.0.0/8,\qquad 172.16.0.0/12,\qquad 192.168.0.0/1610.0.0.0/8,172.16.0.0/12,192.168.0.0/16

These ranges are intended for internal networks. Careful subnet selection prevents conflicts between internal networks, VPNs, and external equipment.

Finally, DHCP automatically assigns network configuration to clients, while DNS translates human-readable domain names into IP addresses. Together, addressing, switching, routing, DHCP, and DNS form the essential foundation for designing a reliable UniFi network.

Ask anything

We've read this whole study set, so questions about it get the best answers.

FlashcardsQuizFill in the blanksWritten testLessonNotesPodcastContent