A Local Area Network is a network contained within a relatively small area. LANs use L2 layer frames.
-
26 bytes 🔥
-
HEADER
- 22 bytes
Preamble
: used for syncronization and preparing the device to receive the rest of the data in the frameSFD
(Start Frame Delimiter)Destination
: L2 address to which the frame is being sentSource
: L2 address of the device that sent the frameType
(or Length): indicates the L3 protocol used in the encapsulatedpacket
(almsot always IPv4 or IPv6)
-
TRAILER
- 4 bytes
FCS
(Frame Check Sequence): used by the receiving device to detect any errors that may have occurred in transmission
- 18 bytes without Preamble + SFD 🔥🔥🔥
Preamble + SFD
are usually not considered as part of the ethernet header- Minimum size for an Ethernet frame (Header + Payload [Packet] + Trailer) is 64 bytes 🔥
- 64 bytes - 18 bytes (header + trailer) = 46 bytes for the packet (minimum)
- if payload is less than 46 bytes, padding bytes are added
- 7 bytes (8 bits * 7 = 56 bits)
- 10101010 * 7
- Allows deviced to sync their receiver clocks
- 1 bytes (8 bits)
- 10101011
- Marks the end of the preable, and the beginning of the rest of the frame
- 6 bytes each (8 bits * 6 = 48 bit) address of physical device
- indicate the devices sending and receiving the frame
- consist of destination and source
MAC address
MAC
= Media Access Control
- 2 bytes (8 bits * 2 = 16 bits)
- value of
1500 or less
in this field indicates the LENGTH of the encapsulated packet in bytes - value of
1536 or less
in this field indicates theTYPE
of the encapsulated packet (usually IPv4 or IPv6), and the length is determined via other methods - IPv4 = 0x0800 (Hexadecimal) =
2048
in decimal - IPv6 = 0x86DD (Hexadecimal) =
34525
in decimal - ARP Packet = 0x0806 (Hexadecimal) =
2054
in decimal
- 4 bytes (32 bits) in length
- detects corrupted data by running a "CRC" algorithm over the receiving data
CRC
: "Cyclic Redundancy Check"
- 6 bytes (48 bits) physical address assigned to the device when it is made
- A.K.A "Burned-in Address"
- Globally unique
- First 3 bytes are OUI (Organizationally Unique Identifier), which is assigned to the company making the device 🔥
- Last 3 bytes are unique to the device itself 🔥
- Written as 12 hexadecimal characters
- stands for Address Resolution Protocol
- used to discover L2 address (MAC) of a known L3 address (IP)
- consists of two messages:
ARP Request
ARP Reply
ARP Request
is abroadcast
ethernet frame (it is sent to all hosts in the network)ARP Reply
is aunicast
ethernet frame- broadcast MAC address used in ARP Request is FF.FF.FF.FF.FF.FF
Use arp -a
to view the ARP table and show all ARP entries
type static
: default entriestype dynamic
: learned via ARP
- network utility used to test reachability
- measures round-trip time
- uses two messages:
ICMP Echo Request
ICMP Echo Reply
- command to use:
ping <ip_address>
In the above example the first of the 5 requests sent failed because of ARP.
To show the MAC Address table in CISCO devices use:
show mac address-table
To manually clear the MAC Address table in CISCO devices use:
clear mac address-table dynamic interface <interface name>
We will have PC1
send data to PC2
in the same LAN where the Switch has an empty MAC Address Table
-
SW1
learnsPC1
Mac Address and associates it to the F0/1 interface (Dynamically learned MAC Address) -
SW1
doesn't know which device has thePC2
MAC address, so it willFLOOD
the frame -
PC2
receives the packet to process it normally up the OSI stack andPC3
ignores the packet because the frame destination doesn't match its own MAC address
unicast frame
: frame destined for a single targetunknown unicast frame
: frame for which the switch doesn't have an entry in its MAC Address Table. In this case the frame isFLOODED
(forwarded to all of its interfaces except the one it received the packet on)known unicast frame
: frame for which destination is already "known" in the switches MAC Address Table. In this case the frame isFORWARDED
to the specified destination.
PC1
will send data to PC3
and PC3
will reply to PC1
where the Switch has an empty MAC Address Table
-
SW1
savesPC1
MAC Address and associates it to itsF0/1
interface -
SW2
savesPC1
MAC Address and associates it to itsF0/3
interface, thenFLOODS
the frame andPC4
drops the package whilePC3
processes it -
SW2
savesPC3
MAC Address and associates it to itsF0/1
interface -
Since
SW2
already associatedPC1
MAC Address to theF0/3
interface it willFORWARD
the frame toSW1
-
SW1
already associatedPC1
Mac Address toF0/1
interface so it willFORWARD
the frame toPC1
directly
PC1
wants to send data to PC3
where:
PC1
doesn't knowPC3
MAC AddressPC1
knowsPC3
IP address
-
Because
PC1
doesn't knowPC3
MAC address, it will send an ARP Request with its IP -
SW1
addsPC1
to its MAC Address table andFLOODS
the request -
PC2
ignores the request because Destination IP doesn't match -
SW2
addsPC1
to its MAC Address table andFLOODS
the request -
PC2
ignores the request because Destination IP doesn't match andPC3
processes it -
SW2
addsPC3
to its MAC Address table andFORWARDS
the request -
SW1
addsPC3
to its MAC Address table andFORWARDS
the request -
PC1
receives the ARP reply and will addPC3
MAC Address to its ARP table