# #ALOHA

Multiple access protocol for transmission of data via a shared network channel. Operated in the medium access control layer ( MAC layer ). Using this protocol, several data streams originating from multiple nodes are transferred through a multi-point transmission channel.
Each node transmits a frame without trying to detect whether transmission channel is idle or busy. If channel is idle, frames are successful. If two frames occupy the channel simultaneously, collision of frames will occur and both will be discarded. These frames will then be retransmitted

1. Uses contention to manage access to bus
	- Sender transmits packet whenever they want
	- Wait for maximum RT propagation delay
	- If no ack, wait random time and resend
2. Recipient ack valid packets and discards invalid packets
3. Slotted ALOHA divides up channel into time slots ( equal in size to maximum packet transmission time )
4. Sender can only start transmitting at a slot boundary
	- Prevents 2 packets that "just" overlap ( either 100% overlap or none )

# #CSMA/CD ( Carrier Sense Multiple Access with Collision Detection )

### Carrier Sense Multiple Access

- Check bus before transmission
	- If free, transmit
	- If not free, wait
		- for random time, and try again (non-persistent)
		- until bus is free (1-persistent)

### With Collision Detection

- If we notice someone else has started transmission soon after transmission, stop and wait
	- For a bus, unexpected voltage swings indicate collision
	- For a star, activity on more than one port indicates collision
	- Attenuation of voltages may make collisions harder to detect, standards like Ethernet set limits to cable length.

# #Ethernet

- Ethernet is a generic name for any product that implements IEEE 802.3
	- Originally 10Mbps (Manchester Encoding) using Bus topology, with a coax cable and BNC connectors
	- Then 100Mbps (4B5B Encoding) using a Star topology, with Cat5 or Cat6 (twisted-pair) cables and RJ-45 connectors.
	- Then 1Gbps (if twisted pair then 125MBaud, 8b/baud, full duplex over 4 twisted pairs)
	- Then 10Gbps (using fibre cables up to 40km) but only in p2p mode (so no collisions possible)
- Every Ethernet card has a globally unique 48-bit address hard-coded into it, known as the MAC address. Blocks of addresses are allocated to the card manufacturer.

## Ethernet Packet Format

- 8B preamble (10101010\*7 10101011)
- 6B - source addr
- 6B - dest addr
- 2B - data length
- 0-1500B - data
- 0-46B - padding
- 4B - CRC
- 12B - interframe gap
	- Ethernets "maximum" packet size is 1518 bytes (but not really with Jumbo Frames)
	- Ethernets minimum packet size is 64 bytes
	- 18 bytes overhead

# #WLAN

- Uses radio waves as transmission medium
- Logically equivalent to Bus topology
	- One node transmits a broadcast, everyone receives it shortly after
- Physically equivalent to Star topology
	- Through the AP in the "middle" is not creating a WLAN (like a hub / switch), but rather a bridge between WLAN and something else (usually wired, but phones may create a bridge from Wi-Fi to 4G)
- Speed is usually slower than with LAN, but is catching up.

## 802.11

- Uses frequencies in the 2.4, 5, and 6GHz bands
- Range of the order of 100 meters
- Developing standard
	- 802.11a (54Mbps) and 802.11b (11Mbps) old, but legacy supported.
	- 802.11g (54Mbps) is a 2003 standard still widely used
	- 802.11n (300Mbps+) is more recent
	- Many more protocol subvariations
- CSMA/CA - Carrier Sense Multiple Access with Collision Avoidance
	- Rather than Collision Detection
		- Radio Waves attenuate by the inverse square law. Therefore if you were to listen while transmitting in the CSMA/CD way, your own transmissions would dominate
		- It is possible a collision is not detectable

# #WAN

- LANs do not cope with large no. users.
	- CSMA/CD - more users implied more collisions, less efficiency and more delays
- LANs do not cope with large geographic sizes
	- CSMA/CD - imposes limits on RTT
