home
|
O'Reilly's CD bookshelfs
|
FreeBSD
|
Linux
|
Cisco
|
Cisco Exam
1.2. Physical and data link layers
The physical and data link layers of the
network protocol
stack together define a machine's
network interface
. From a software perspective, the
network interface defines how the Ethernet device driver gets packets from or to the network. The physical layer describes the way data is actually transmitted on the network medium. The data link layer defines how these streams of bits are put together into manageable chunks of data.
Ethernet is the best known implementation
of the physical and data link layers. The Ethernet specification describes how bits are encoded on the cable and also how stations on the network detect the beginning and end of a transmission. We'll stick to Ethernet topics throughout this discussion, since it is the most popular network medium in networks using NFS and NIS.
Ethernet can be run over a variety of
media, including thinnet, thicknet, unshielded twisted-pair (UTP) cables, and fiber optics. All Ethernet media are functionally equivalent -- they differ only in terms of their convenience, cost of installation, and maintenance. Converters from one media to another operate at the physical layer, making a clean electrical connection between two different kinds of cable. Unless you have access to high-speed test equipment, the physical and data link layers are not that interesting when they are functioning normally. However, failures in them can have strange, intermittent effects on NFS and NIS operation. Some examples of these
spectacular failures are given in
Chapter 15, "Debugging Network Problems"
.
1.2.1. Frames and network interfaces
The data link layer defines the format of data
on the network. A series of bits, with a definite beginning and end, constitutes
a network
frame
, commonly called a
packet
. A proper data link layer packet has checksum and network-specific addressing information in it so that each host on the network can recognize it as a valid (or invalid) frame and determine if the packet is addressed to it. The largest packet that can be sent through the data link layer defines the
Maximum Transmission Unit
, or MTU, of the
network.
All hosts have at least one network interface,
although any host connected to an Ethernet has at least two: the
Ethernet interface
and the
loopback interface
. The Ethernet interface handles the physical and logical connection to the outside world, while the loopback interface allows a host to send packets to itself. If a packet's destination is the local host, the data link layer chooses to "send" it via the loopback, rather than Ethernet, interface. The loopback device simply turns the packet around and queues it at the bottom of the protocol stack as if it were just received from the Ethernet.
You may find it helpful to think of the protocol layers as passing packets upstream and downstream in envelopes, where the
packet envelope contains some protocol-specific header information but hides the remainder of the packet contents. As data messages are passed from the top most protocol layer down to the physical layer, the messages are put into envelopes of increasing size. Each layer takes the entire message and envelope from the layer above and adds its own information, creating a new message that is slightly larger than the original. When a packet is received, the data link layer strips off its envelope and passes the result up to the network layer, which similarly removes its header information from the packet and passes it up the
stack again.
1.2.2. Ethernet addresses
Associated with the data link layer is
a method for addressing hosts on the network. Every machine on an Ethernet has a unique, 48-bit address called its
Ethernet
or
Media Access Control (MAC) address
.
Vendors making network-ready equipment ensure that every machine in the world has a unique MAC address. 24-bit prefixes for MAC addresses are assigned to hardware vendors, and each vendor is responsible for the uniqueness of the lower 24 bits. MAC addresses are usually represented as colon-separated pairs of hex digits:
8:0:20:ae:6:1f
Note that MAC addresses identify a
host
, and a host
with multiple network interfaces may use the same MAC address on each.
Part of the data link layer's protocol-specific header are the packet's source and destination MAC addresses. Each protocol layer supports
the notion of a
broadcast
, which is a packet or set of packets that must be sent to all hosts on the network. The broadcast MAC address is:
ff:ff:ff:ff:ff:ff
All network interfaces recognize this wildcard MAC address as a broadcast address, and pass the packet up to a
higher-level
protocol
handler.
1. Networking Fundamentals
1.3. Network layer
Copyright © 2002
O'Reilly & Associates. All rights reserved.