# Ethernet basics

RJ-45 pinouts

EIA/TIA defines the cabling specifications for Ethernet, including the pinouts for RJ-45:

T568A - Pair 1 (4,5) Pair 2 (3,6) Pair 3 (1,2) Pair 4 (7,8)
T568B - Pair 1 (4,5) Pair 2 (1,2) Pair 3 (3,6) Pair 4 (7,8)

PC transmission uses pins 1 and 2, reception uses pins 3 and 6.
Switch transmission uses pins 3 and 6, and reception uses pins 1 and 2.

Auto-MDIX (Automatic Medium-Dependent Interface Crossover) is a feature not supported on all switch models.

Auto-negotiation, speed and duplex

By default, each Cisco switch uses auto-negotiation:

- Speed detection is based on FLP (Fast Link Pulses) when both ends uses auto-negotiation and based on incoming electrical signal if the other end does not use auto-negotiation.

- Duplex detection is based on auto-negotiation only.

If both ends use auto-negotiation then full duplex mode is used.
If only one end uses auto-negotiation then if speed is 10Mbps or 100Mbps the end with auto-negotiation uses half duplex, if speed is 1000Mbps the end with auto-negotiation uses full duplex.
To disable auto-negotiation you statically configure speed and duplex settings.

CSMA/CD

Carrier Sense Multiple Access with Collision Detection algorithm:

- The sender begins sending a frame and listens to make sure that no collision occurred.
- If there was a collision, all stations that sent a frame send a jamming signal.
- After the jamming signal, each sender randomizes a timer and waits that long before resending.

Collision Domains and Switch Buffering

Switches store frames in memory buffers to prevent collisions.
NICs operating in HDX mode use a loopback circuitry when transmitting a frame. The combined looped-back signal and the received signal allows the NIC to detect the collision.

Basic Switch Port Configuration

Switch(config-if)# speed ?
  10    Force 10 Mbps operation
  100   Force 100 Mbps operation
  auto  Enable AUTO speed configuration
Switch(config-if)# duplex ?
  auto  Enable AUTO duplex configuration
  full  Force full duplex operation
  half  Force half-duplex operation

Bables: frames longer than 1518 bytes in size.
Late collision: detected after the first 64 bytes.
Deferred: found the carrier busy at the first attempt.

Ethernet Layer 2: Framing and Addressing

- DIX Ethernet v2 and revised IEEE 802.3

Preamble (8B) Destination Address (6B) Source Address (6B) Type/Length (2B) ! 802.3
Data (var)
FCS (4B) ! 802.3

- Original IEEE 802.3

Preamble (7B) SFD (1B) Destination Address (6B) Source Address (6B) Length (2B) ! 802.3
DSAP (1B) SSAP (1B) Control (1-2B) ! 802.2
Data (var)
FCS (4B) ! 802.3

- IEEE 802.3 with SNAP header

Preamble (7B) SFD (1B) Destination Address (6B) Source Address (6B) Length (2B) ! 802.3
DSAP (1B) SSAP (1B) Control (1-2B) ! 802.2
OUI (3B) TYPE (2B) ! SNAP
Data (var)
FCS (4B) ! 802.3

If Type/Length is >= 1536 then is a DIX frame (Type) else is a IEEE frame (Length).
DSAP (Destination Service Access Point)
SSAP (Source Service Access Point)
If DSAP == 0xAA and SSAP == 0xAA and Control == 0x03 then there is a SNAP header.
OUI (Organizationally Unique Identifier) represents the manufacturer of the sender Ethernet NIC.

Types of Ethernet Addresses

Unicast: I/G bit = 0
Broadcast: 0XFFFFFFFFFFFF
Multicast: I/G bit = 1

Ethernet Address Formats

1B 2B 3B ! OUI
4B 5B 6B ! Vendor-Assigned

1B is the most significant byte.
6B is the least significant byte.

1b 2b 3b 4b 5b 6b 7b 8b

8b is the most significant bit and I/G (Individual/Group) bit.
7b is the U/L (Universal/Local) bit.

If I/G == 0 then is a Unicast MAC address else is a Broadcast/Multicast MAC address.
If U/L == 0 then is a Vendor-Assined MAC address else is a Administratively-Assigned MAC address.

Switching and Bridgind Logic

The default MAC address aging time is 300 seconds (5 minuts).
Store-and-forward: receives all bits in the frame (store) before forwarding (check FCS).
Cut-through: forwards the frame as soon as the Destination Address field is received.
Fragment-free: forwards the frame as soon as the first 64 bytes are received.

SPAN, RSPAN and ERSPAN

SPAN: Switch Port ANalyzer
RSPAN: Remote SPAN
ERSPAN: Encapsulated RSPAN (GRE tunnel)

A SPAN source port:

- Can be any type of port (routed, switched, access, trunk, etherchannel, ...)
- Can be one or more ports OR one or more VLANs, but not a mix.

A SPAN destination port:

- Does not support CDP, STP, VTP or DTP.
- Overwrites its original configuration until the destination of the session is removed.

Up to 64 SPAN destination ports on a switch.
Only one SPAN/RSPAN session can send traffic to a single destination port.
Traffic routed from another VLAN to a source VLAN can not be monitored with SPAN.
For RX SPAN, each frame is copied before any modification.
For TX SPAN, each frame is copied after any modification, not all frames match the orginal frames exactly.
SPAN/RSPAN ignores CDP, STP BPDU, VTP or DTP, so use encapsulation replicate in order to forward these frames.

Basic SPAN Configuration

Switch(config)# monitor session 1 source interface fa0/10
Switch(config)# monitor session 1 destination interface fa0/24

Complex SPAN Configuration

Switch(config)# monitor session 1 source interface fa0/10 rx
Switch(config)# monitor session 1 source interface fa0/11 tx
Switch(config)# monitor session 1 source interface fa0/12 ! Trunk port
Switch(config)# monitor session 1 filter vlan 1-3,10 interface fa0/11 tx ! Only VLANs 1, 2, 3 and 10
Switch(config)# monitor session 1 destination interface fa0/24 encapsulation replicate

RSPAN Configuration

Switch1(config)# vlan 10
Switch1(config-vlan)# remote span
Switch1(config)# monitor session 1 source vlan 1-5
Switch1(config)# monitor session 1 destination remote vlan 10

Switch2(config)# vlan 10
Switch2(config-vlan)# remote span
Switch2(config)# monitor session 2 source remote vlan 10
Switch2(config)# monitor session 2 destination interface fa0/24

Ethernet Standards

10BASE5 - Thick coaxial - 500m
10BASE2 - Thin coaxial - 185m
10BASE-T - UTP cat 3, 4, 5, 5e, 6 - 100m
100BASE-FX - MM fiber - 400m
100BASE-T4 - UTP cat 3, 4, 5, 5e, 6 (4 pair) - 100m
100BASE-TX - UTP cat 5, 5e, 6, or STP (2 pair) - 100m
1000BASE-LX - Long wavelenght laser, SM or MM fiber - 10km or 3km
1000BASE-SX - Short wavelenght laser, MM fiber - 220m or 550m
1000BASE-ZX - Extended wavelenght laser, SM fiber - 100km
1000BASE-CS - STP (2 pair) - 25m
1000BASE-T - UTP cat 5, 5e, 6 (4 pair) - 100m

IEEE 802.3u: Fast Ethernet over copper and optical cabling
IEEE 802.3z: Gigabit Ethernet over optical cabling
IEEE 802.3ab: Gigabit Ethernet over copper cabling

No comments: