# Interfaces and cables

{% embed url="<https://youtu.be/ieTH5lVhNaY>" %}

## Ethernet

* collection of network protocol/standards
* RJ45 - Registered Jack - used at the end of copper ethernet cable (UTP)

## Why network protocols?

* agreed upon system of communicating
* to make the switch and cable manufacturer to agree upon the size and shape of the connector and port
* all vendors follow industry standards
* physical standards - connectors and cables
* logical standards - internet protocol (IP)

## Bits and bytes

* 1 byte = 8 bits
* speed is measured in bits/second (mbps-megabits/s, not bytes)
* data in hard-drive is measured in bytes

## UTP Cables

* Unshielded Twisted Pair
* copper cables used in ethernet standards
* 4 pairs of cables twisted together
* uses separate wire pairs "within the cable" to transmit and receive data
* no metallic shield
* vulnerable to electrical interference

### Ethernet standards (copper)

| Speed   | Common name      | IEEE standard | Informal name |
| ------- | ---------------- | ------------- | ------------- |
| 10mbps  | Ethernet         | 802.3i        | 10BASE-T      |
| 100mbps | Fast ethernet    | 802.3u        | 100BASE-T     |
| 1gbps   | Gigabit ethernet | 802.3ab       | 1000BASE-T    |
| 10gbps  | 10 gig ethernet  | 802.3an       | 10GBASE-T     |

BASE - baseband signalling T - twisted pair cabling (max length = 100m) twists helps protect from Electro Magnetic Interference (EMI)

### 10BASE-T, 100BASE-T

* uses 2 pairs - 4 wires
* Scenario 1: connection between PC/router/firewall and switch
  * PC/firewall/routers Transmit (TX) data on pins 1&2 and Receive (RX) data on pins 3&6
  * Switches Receive (RX) data on pins 1&2 and Transmit (TX) data on pins 3&6
  * **Straight-through cable** - used when connecting devices which use opposite pin pairs to transmit and receive data
  * **Full-duplex transmission** - both devices can send and receive data at the same time with no collisions
* Scenario 2: connection between router\&router or switch\&switch or router\&PC
  * **Crossover cable** - used when connecting devices which use same pin pairs to transmit and receive data
  * pins 1&2 of device A are connected to pins 3&6 of device B
  * pins 3&6 of device A are connected to pins 1&2 of device B

### Auto MDI-X

* allows devices to automatically detect which pins their neighbor is transmitting data on, and then adjust which pins they use to transmit and receive data
* unless working with old equipment, need not worry about straight-through or crossover cables

### 1000BASE-T, 10GBASE-T

* uses 4 pairs - 8 wires
* each pair is bidirectional (no specific pins for transmitting and receiving), thus can operate at much higher speeds
* apart from already used pins, pins 4&5, 7&8 are connected straight

<div align="left"><figure><img src="https://935233489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUGyWMBzIPoBvXNyR5UOW%2Fuploads%2FWWLrFTiiaNDmdRdsaTlS%2Fstraight%20through.png?alt=media&#x26;token=a2f8e9bf-9d5b-4a93-87a1-8f23ca8ae8be" alt=""><figcaption></figcaption></figure></div>

<figure><img src="https://935233489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUGyWMBzIPoBvXNyR5UOW%2Fuploads%2FvBkoenRZPmlaS0KAHi0y%2Fcrossover.png?alt=media&#x26;token=83a5d054-f603-48f6-9682-af93676bf61e" alt=""><figcaption></figcaption></figure>

## Fiber optic connections

* Fiber optic cables send light over glass fibers, rather than electrical signal over copper wires
* SFP (Small Form-factor Pluggable) transceiver is connected to switches or routers
* fiber optic cables connect to these transceivers
* there are 2 connectors on each end, one to transmit and another to receive data
* unlike copper UTP cables which use wire pairs within the cable, fiber optic cables use separate cables to transmit and receive
* Transmit (Tx) pin on A connects to Receive (Rx) pin on B and vice versa.

### Structure of fiber optic cable

* fiberglass (core)
* cladding (reflects light)
* protective buffer
* outer jacket

### Types of fiber optics

1. Multi-mode fiber cables
   * core diameter is wider
   * allows multiple angles (modes) of light waves to enter the fiberglass core
   * allows longer cables than UTP, but shorter than single-mode fiber
   * cheaper than single-mode fiber (due to cheaper LED-based SFP transmitters)
2. Single-mode fiber cables
   * core diameter is narrower
   * light enters at a single angle (mode) from a laser-based transmitter
   * allows longer cables than UTP and multi-mode fiber
   * more expensive because it uses laser-based SFP transmitters)

### Fiber optic cable standards

| Informal name | IEEE standard | Speed  | Cable type           | Max length       |
| ------------- | ------------- | ------ | -------------------- | ---------------- |
| 1000BASE-LX   | 802.3z        | 1gbps  | multi or single mode | 550m(MM) 5km(SM) |
| 10GBASE-SR    | 802.3ae       | 10gbps | multi mode           | 400m             |
| 10GBASE-LR    | 802.3ae       | 10gbps | single mode          | 10km             |
| 10GBASE-ER    | 802.3ae       | 10gbps | single mode          | 30km             |

<div align="left"><figure><img src="https://935233489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUGyWMBzIPoBvXNyR5UOW%2Fuploads%2F9bAz98tiRMg9fjiSVC66%2Futp%20vs%20fiber.png?alt=media&#x26;token=82502230-d140-4613-878a-a4dd1a806a4f" alt=""><figcaption></figcaption></figure></div>

## extra note

Most hosts do not have the capability to connect to a switch via fiber cabling, and most switches do not have enough SFP interfaces to support many end hosts. UTP cables are the standard for wired connections to switches. Switches typically have many RJ45 ports for end hosts to connect to via UTP cable, and then connect to a router with the SFP fiber optic port.
