Vault sync: 2022-01-26 13:24:31

This commit is contained in:
2022-01-26 13:24:31 +01:00
parent 29c0f2b719
commit 9ae3834c41
49 changed files with 17 additions and 10 deletions

View File

@@ -0,0 +1,139 @@
# 1. Physical Layer
This layer is responsible for the actual physical transfer of data between devices via cables or other mediums using switches, routers, etc..
This layer also converts the data into a bit-stream of 1's and 0's.
The signal convention must be the same on both devices. (Meaning of a 0 and a 1)
## In depth
Information on computers is stored in a digital format. To transmit this information we have to convert the information to signals.
Physical layer is responsible for this conversion. The Physical layer deals with the actual physical transmission of electrical signals.
You could say the physical layer is a bridge between real life and software.
## Waves
Waves, like you would see on a lake, or in electrical cables are made when a physical quantity changes in the form of a moving ridge.
Waves by them self store no real information.
## Signal
A signal is a wave (carrier) that holds information. (wave + data = signal)
The carrier is a type of wave we add our information to. In most cases a sine wave is used as a carrier wave,
![[encoder.png]]
A encoder converts analog or digital information in signals that can be transmitted across different [[Comminucation Mediums]]
The process of adding data to a carrier wave is called Modulation
## Modulation
Adding data to carrier waves is called modulation.
This can be done in 3 different ways.
### Amplitude
![[modulation-amplitude.png]]
Amplitude or the strength (height) of a wave changes over time.
### Frequency
![[modulation-frequency.png]]
Frequency is the amount of waves that pass a fixed point in a given amount of time.
### Phase
![[modulation-phase.png]]
Phase specifies the location or timing of a point within a wave cycle of a repetitive waveform.
![[modulation-phase-2.png]]
## Analog
**Analog Signals** can have a infinite number of possible values in a range.
For example: 0.0 <-> 1.0
- 0.1436367436473......
- 0.54454764654765......
**Analog data** is continuous and have continuous values.
Values in analog data are always changing.
A good analogy for analog data is like a physical (analogue) clock with hands.
The hands on a clock like that are always moving (continuous) and do not have a specific value.
## Digital
Digital data is information represented as a string of discrete symbols each of which can take on one of only a finite number of values from some alphabet, such as letters or digits.
For example:
- a
- b
- 1
- 0
These values are specific and are not changing.
## Transmitting Impairments
Signals most often have to deal with problems during transmission. Problems like this are called transmission impairments.
Important transmission impairments are:
### Attenuation
Attenuation is the strength or amplitude of a signal is decreasing over time and distance.
A good analogy for this would be the loss of volume you would hear from a speaker the further you are away from it.
![[attenuation.png]]
This makes is more difficult to correctly capture the signal on the receiving end.
We can solve this issue by dividing the communication line up in smaller segments and amplify the signal between segments.
### Distortion
![[distortion.png]]
Distortion is the change that occurs in a signal that affects how the signal looks.
For example talking to someone while behind a thick glass pane changes how you sound on the other side.
We can solve this by using a lower bit rate. Bit rate is kinda like the information per second. This way the signal is less susceptible to distortion.
### Noise
![[noise-signal.png]]
Noise is when data is added to a signal and therefore changing the data itself.
Analogy for this when you are listening to someone talk and somebody else is talking at the same time trough your conversation.
We can solve this by using a stronger signal (bit like talking louder).
This will reduce the impact noise has on the signal.
This is also called signal to noise ratio (SNR)
## Transmission Media
These signals are send through a transmission medium. A transmission medium is a physical object that can carry the information from source to destination.
Transmission mediums are often space (air), metallic cable or fiber optic cables.
Transmission media are divided in 2 groups.
### Guided media
Guided media like cables provide a conduit from one device to another.
I like to think of it as you can steer the signal by moving the cable for example.
Coaxial cable, twisted pair cable and fiber optic cables.
![[type-cables.png]]
### Unguided media
Unguided media transport electromagnetic waves without using a physical conductor.
This is called wireless transmission. (Technically using the air around you as a conductor)
Signals are broadcast tough space and thus available for everyone to pick up.

View File

@@ -0,0 +1,54 @@
# 2. Data link Layer
The Data Link Layer is responsible for handling the data transfer between two devices on the **same** network. (so a bit like the Network Layer)
The Data Link Layer also splits up packets into smaller chunks called a frame. The reverse happens on the receiving device (reassembling frames into packets).
Like the Network Layer the Data Link Layer is also responsible for flow control and error checking.
## Error Detection
Transmissions are not always error free. In case of an error, it should be detected and the message should be re transmitted (whenever possible)
Detecting errors are handled by different algorithms:
- Parity bits
- CRC
## Data Framing
Data is split up in smaller chunks called frames. For each frame we add some extra data:
- Who is sender?
- Who is receiver?
- Length of chunk
- Type of chunk (normal message, error message, control message)
- Error checking values (ex. CRC code)
- Data and metadata are put in single message called frame
## Ethernet Protocol
Ethernet is a protocol used at the data link layer of wired networks.
Ethernet uses specific hardware addresses to identify hosts on a network.
These 6-byte-integer addresses are names Medium Access Control (MAC Address)
Ethernet frame has the following format:
![[ethernet-frame.png]]
## Wireless networks
Wireless networks do not use a physical medium for data transmission. The data is send through radio waves.
- Each member of a wireless network is called a station.
Networks are implemented in different sizes:
- Wireless local area networks (WLAN)
- Wireless Metropolitan Area Networks (WMAN)
- Wireless Wide Area Networks (WWAN)
### BSS Network
A BSS is a network with a specific station called Access Point.
All transmissions from a station to another are trough the Access Point.
Access Points also connect the network (BSS) other networks, hence the name internet.
### AD-HOC Networks
AD-HOC networks do not have a central node (access point).
Every station can send data directly to a other station.

View File

@@ -0,0 +1,136 @@
# 3. Network Layer
The Network Layer is responsible for handling the data transfer between two different networks. This means that this layer is not needed if the receiving device is on the same network.
The Network Layer breaks up segments from the Transport layer into smaller chunks called [[Packets]]. The reverse happens on the receiving device (reassembling packets into segments).
Furthermore the Network Layer also finds the optimal path to travel from origin network to the destination network. This is called routing.
## Routing
Routing is finding the shortest (most efficient) path from source to destination and forwarding the messages over that calculated path.
Routing is difficult because it has to deal with a lot of things:
- Network topology may change.
- New hosts may be added.
- Some connections/hosts may be removed.
- Distance between hosts may change.
Routers use tables called routing tables. The table contains the next point on the shortest path to each destination.
Steps:
1. Routing: Finding the most efficient path(s)
2. Forwarding: Send info to the nest point from the routing table.
A router can not practically store all hosts in the table as that would be way to many.
So instead the router stores only possible destination networks.
The address to identify a host on a networks should have the format:
{Network, Host}
## Forwarding
When a router receives a packet:
1. Extracts the destination address from packet.
2. Separates the network ID from the rest of the address.
3. Looks if it can match the networks id in routing table.
4. If Match found: Sends packet using suggested paths in its table for that destination.
5. If no match found: Send packet over the default path which is the path to the next (probably a higher level) router.
### Separating network ID from address
Router needs to know how many digits are used as network ID.
Routers keep this information in their routing table.
A binary number named a netmask is used to show the network ID where 1's show the network ID.
#### Example:
Network ID is marked as bold.
- Netmask:
**11111111.11111111**.00000000.00000000
- Address:
**195.210**.23.14
## Router
Router is a member of multiple networks.
![[routers-example.png]]
For each connection to a network a routers uses a network interface card (NIC) and a IP address.
This way a router can have multiple IP addresses.
Each connection is identified by a interface, label or an address.
Example of a routing table:
![[routing-table.png]]
### Updating router tables
Routers are responsible for updating routing tables themselves.
When a router detects a change in connections, it immediately informs other routers about it.
Routers use optimum route finding algorithms to update their tables.
Exchanging routing information between routers is done periodically even when there is no change in the network.
The most commonly used routing algorithms are:
- Distance vector routing (RIP)
- Link-state Routing (OSPF, IS-IS)
## Addressing problem
We now do have a addressing issue because:
- We have a MAC Address but we do not have a Network ID or host ID. Which is what we need for our routers.
- MAC addresses are hardwired in the NIC's
So we need a new type of ID to uniquely identify a host in the internet.
This address will we at a higher level of protocols (Network layer) and is therefore protocol dependent.
### IPV4
IPV4 are 4 byte integers. We use them in the following format:
0-255.0-255.0-255.0-255 ex. 192.168.100.1
This is called a dotted decimal, each address contains 4 decimals of 8 bits (octets)
Example: 00000000.00000000.00000000.00000000
### Classful addresses
Classful addresses define 3 networks types
Class A: First decimal shows the network ID, remaining 3 decimals show the host ID. (Large networks)
Class B: First two decimals shows the network ID, remaining 2 decimals show the host ID. (Mid networks)
Class C: First three decimals shows the network ID, remaining 1 decimal show the host ID. (Small networks)
### Classless addresses
In classless addresses the number of bits is used for a Network ID is given as a number after the address
Example 144.24.13.172/**20 (20 bits used for network ID)**
### Exceptions in IPV4
![[exceptions-ipv4.png]]
Also the following addresses are not used as a valid and unique IPv4 Addresses:
10.0.0.0 - 10.255.255.255/8 (16.777.216 hosts)
172.16.0.0 - 172.31.255.255/12 (1.048.576 hosts)
192.168.0.0 - 192.168.255.255/16 (65.536 hosts)
We use these IP addresses as local addresses. The local addresses are translated into a global IP when sending messages to a host in a other network. This translation process is called NAT.
### Scarce IP address problem
With 32 bits, the maximum possible IPv4 addressed is 2^32 = 4 billion
**We need more addresses.**
## IPV6
Solution! Make it bigger!
In a IPv6 each address is a 16 byte integer. The address itself is written in hexadecimal.
Every address contains 8 groups of 4 hexadecimal digits, separated by colon (.).
**Example:**
2001:0db8:85a3:0000:0000:8a2e:0370:7334
Only classless addresses are used!

View File

@@ -0,0 +1,10 @@
# 4. Transport Layer
The Transport Layer is responsible for the end-to-end communication between 2 devices.
The Transport layer on the sending device takes data from the Session Layer and breaks them up in chunks called segments.
On the receiving device the Transport Layer reassembles the segments of data that the Session Layer can consume.
While sending data via a network data can get corrupted, the Transport layer also ensures the data being received is complete and correct, and requesting a retransmission if its not.
The Transport Layer also controls the flow of outgoing data so that the receiver is not overwhelmed with data. (fast to slower connections for example)

View File

@@ -0,0 +1,10 @@
# 5. Session Layer
The session layer is responsible for opening and closing connections between two devices. The duration of a connection is called the session.
The session layer ensures that the connections remains active and open so that the data being received and/or send is complete.
For example when sending a big file to someone, which takes some time, the session layer will keep the connection open long enough to send the complete file.
The session layer also synchronizes the data transfer with checkpoints. For example, if a 50 MB file is send to a device, the session layer could set a checkpoint every 10 MB. In case of a disconnect (session close), the session could be restored to a certain checkpoint and the data transfer can resume where it disconnected.
This way we do not need to completely resend the file.

View File

@@ -0,0 +1,13 @@
# 6. Presentation Layer
The presentation layer is responsible for preparing the data so that it can be used by the Application Layer.
**Presentation layer is responsible for:**
- Translation of data
- Encryption of data
- Compression of data
For example, two devices can use different types of encoding on their data, the presentation layer will translate the data in a way that the Application Layer can understand.
When sending sensitive data, we would like to encrypt the data so that its secure. The Presentation layer is responsible for encrypting and decrypting ingoing or outgoing data.
Also when sending of receiving data we sometimes want to compress the data so that sending and receiving data is more efficient. (smaller size)

View File

@@ -0,0 +1,14 @@
# 7. Application Layer
The application Layer provides services to the end user. So this is the layer the user actually interacts with.
These services are usually protocols that interact with the data that the user uses.
**Examples of services (protocols):**
- HTTP
- FTP
- IRC
- SSH
- DNS
- SMTP
For example a web browser like Google Chrome uses the HTTP protocol to browse files on the internet. And the mail client Outlook uses the SMTP protocol to send mail via the internet.