From a2b53102ee5ff169472ce3a03a7037fe25969919 Mon Sep 17 00:00:00 2001
From: lomna-dev
Table of Contents
-
-
-
-
+
-
-
A computer network is collection of two or more computers that can communicate with each other. @@ -322,8 +334,8 @@ Computer networks are made of protocols which allow us to send data through link
Here, we will look at basic terminologies used in computer networks. Most of these will be expanded on further. @@ -356,8 +368,8 @@ Computer networks can fall under two broad categories
OSI stands for Open Systems Interconnection. It is a reference model which specifies standards and communication protocols for computer network. It is a 7 layer architecture. Each layer has different functions and protocols. The seven layers are @@ -377,31 +389,31 @@ We don't use the OSI Model and mostly use it as a referencial model. The TCP/IP
In order to establish communication between two nodes, we need to identify the nodes. This is done by using unique identifiers given to devices on a network.
A hostname is a human readable label that is assigned to a device on the network. On the internet, a hostname is a domain name which has been assigned to a host computer. It is useful to identify devices on a local network.
Also known as the logical address, every device to which a direct communication can be established will have a unique IP address. Interned Assigned Numbers Authority (IANA) assigns and manages ip addresses globally. Previously, ipv4 (version 4) was used and was an address of 32 bits, hence there are \(2^{32}\) unique ipv4 addresses. Because there are limited number of ipv4 addresses, we are running out of them. A new version of ip addresses ipv6 is now implemented. It has addresses of size 128 bits.
Stands for Media Access Control Address. It is also known as the physical address. Every Network Interface Card (NIC) is assigned a unique identifier. These are assigned by the manufacturer and cannot be changed. The length of a MAC address is 48 bits. @@ -410,8 +422,8 @@ Stands for Media Access Control Address. It is also known as the physical addres
A single system has multiple connections and network applications running. A port is a logical channel through which data can be sent or recieved. A port number is always associated with a network address such as an IP address so that we can identify the device whose port was referenced. The unique combination of ip address and port number together is called a socket, example 192.168.0.1:8000 @@ -469,8 +481,8 @@ The ports are divided into three categories.
A network model defines a way to organize a system's functions and features. It also defines it's structure and protocols. @@ -499,8 +511,8 @@ There have been many network models, many of them are no longer used. IBM's SNA
TODO : Add OSI model image @@ -518,8 +530,8 @@ The OSI model has 7 layers. Each layer has different functionality. The principl
The lowest layer of the OSI model. Responsible for physical connections between the devices. The physical layer handles data in form of bits and is responsible for transmitting bits without loss from one node to another. @@ -540,8 +552,8 @@ Hub, repeater, moden and cables are physical layer devices
This layer is responsible for node-to-mode delivery of the message. It makes sure that data transfer is error-free from one node to another, over the physical layer. When packet enters a network, it is the responsibility of DLL to transmit it to the host using MAC address. @@ -576,8 +588,8 @@ Switch and bridges are example of DLL devices.
The network layer controls operations of the subnet. @@ -605,8 +617,8 @@ The implementation of network layer is in devices such as routers and switches.
The data in transport layer is referred to as segments. This layer is responsible for end to end delivery of messages. It also acknowledges successful transmission and re-transmits data if error is found. @@ -645,8 +657,8 @@ Transport layer is operated by the OS. This layer is called the heart of OSI
This layer is responsible for establishing connection, maintanance of communication sessions and authentication. It ensures the security in connection. @@ -662,8 +674,8 @@ The services provided by session layer are
Also called the translation layer. This layer translates files and data from local formats to standard, transmittable formats. @@ -681,8 +693,8 @@ The services provided by presentation layer are
Also called the Desktop Layer. This layer acts as the window for applications to access the network. This layer produces the data which will be transferred over network and displays the information to user. This layer also contains the protocols for interfaces to different functionalities of the web. @@ -695,8 +707,8 @@ This layer has protocols such as HTTP, FTP, SMTP, DNS and provides the functiona
TCP/IP was used in ARPANET and now the worldwide Internet. The ARPANET started as a network of hundreds of universities and government installations. When satellite and radio networks were added, they caused problems with existing protocols. This need for a model that can connect multiple networks in a seamless way was the major goal of the TCP/IP model. @@ -711,8 +723,8 @@ The TCP/IP model had 4 layers, but sometimes physical layer is also included in
The requirnment for a robust network led to the choice of packet-switching network based on a connectionless layer that runs across different networks. The link layer describes what links like serial lines and classic ethernet must do to meet needs of this connectionless internet layer. It is not a layer in normal sense, but rather an interface between different hosts and transmission links. @@ -720,8 +732,8 @@ The requirnment for a robust network led to the choice of packet-switching netwo
This layer roughly corresponds to the OSI network layer. Its job is to permit hosts to inject packets into any network and have them travel independently to the destination. That is, it will allow packets from go to one network to another while they are going to destination. This property that packets can travel through any network makes the whole network more robust, by allowing communication even if a few networks in some path are down. @@ -744,16 +756,16 @@ The job of internet layer is to deliver IP packets where they are supposed to go
TODO : Here
TODO : Here @@ -763,16 +775,16 @@ TODO : Here
The lowest layer of the TCP/IP model. It describes the standard for the physical connections between nodes. It only views the data as a stream of bits and is concerned with transmission of bits without error.
The arrangement of nodes and links in a computer network is called network topology. There are various types of topologies @@ -782,24 +794,24 @@ The arrangement of nodes and links in a computer network is called network topol TODO : Add images of network topology
It is the simplest connection with two nodes and a single link between them.
Also called linear topology, the nodes are connected in a series. Message will follows the whole chain till it reaches the destination. If a link fails in this topology, it is hard to find it, therefore it is not good for large networks.
Every node is connected to another node through a direct link. In mesh topology, we use AHCP (Ad Hoc Configuration Protocol) and DHCP (Dynamic Host Configuration Protocol). @@ -843,8 +855,8 @@ Mesh topology is of two types
All nodes are connected to a central node (called the hub) through links. Hubs are not communication endpoints, their function is to forward packets across all ports. The hubs can either be passive in nature or active. @@ -874,8 +886,8 @@ Drawback of star topology are
In bus topology, all the nodes are connected to a single backbone line. This backbone is bi-directional, there are lines from node to backbone called droplines. This topology is not robust, since if backbone is damaged, the whole network is down. @@ -905,8 +917,8 @@ Drawbacks
A daisy chain in a closed circular loop is called a ring topology. The most common method for communication in this topology is token passing. A token is a frame which is circulated around the network. The token is passed from one node to another till it reaches its destination. @@ -931,8 +943,8 @@ Disadvantages
Also called a star-bus topology. It can be seen as multiple star topologies connected via a backbone like in bus topology. Tree topology is hierarchical and there are parent and child star networks. It uses protocols like DHCP and SAC. The backbone is like the truck of the tree and various star networks branch out from it. @@ -962,8 +974,8 @@ Drawbacks
A hybrid topology is when a network combines two or more topologies in a way that does not resemble standard topologies. @@ -990,24 +1002,37 @@ Disadvantages
Wires carry analog signals in form of continuously varying voltage. To send digital information, we need to devise analog signals to represent bits. This process of converting bits to analog signals is called digital modulation.
-Bandwidth is the measure of carrying capacity of a medium. It is measured in Hertz (Hz).
-
-Note : in many places, maximum data rate is also refered to as the bandwidth.
+Bandwidth is the measure of carrying capacity of a medium. There are two ways to define bandwidth.
+
+These two ways to define bandwidth are linked and are not actually different ideas. +
+ ++The reason for this difference of Hz and bps measurements is that the maximum frequency of medium is something that only the physical layer is concerned with. In every other layer, we only care about how much data can be transferred. +
+ ++Therefore, unless we are working on physical layer, bandwidth is the maximum data transfer rate of the medium.
Suppose our analog signal has \(V\) different levels. Then for a noiseless wire with bandwidth of \(B\), the maximum data rate is @@ -1018,8 +1043,8 @@ Example, a noiseless 3-kHz channel cannot transmit binary signal (two levels) at
But the noiseless wire is an ideal case, which is not possible in real wires. Amount of noise is measured using ratio of signal power to noise power called SNR (Signal-to-Noise Ratio). \(S\) denotes signal power and \(N\) denotes noise power. The ratio is expressed on a log scale as @@ -1038,8 +1063,8 @@ Using SNR, the maximum data rate in a noisy medium is
TODO : Add image @@ -1056,8 +1081,8 @@ The NRZ is simple, but is seldom used by itself in practice. We use more complex
Bandwidth is a limited resource, therefore we must use it efficiently. @@ -1080,8 +1105,8 @@ Note: the number of levels does not need to be a power of 2.
Clocks on both sender and reciever side are used to decode the incoming signal into bits. Suppose we are sending a signal with 20 consecutive zero's. In this case it will become hard to tell bits apart, 20 zero's will look very similar to 19 or 21 zero's. @@ -1091,8 +1116,8 @@ Clocks on both sender and reciever side are used to decode the incoming signal i We could use accurate clocks for this problem. But when bit rate is in multiple Mbps, the clock would need to be accurate down to less than a fraction of microsecond. Therefore, accurate clocks are not a general solution.
TODO : Add image @@ -1108,8 +1133,8 @@ Therefore, the downside of manchester encoding is that it requires twice as m
TODO : Add image @@ -1128,8 +1153,8 @@ In NRZI, rather than using levels to represent bits, we use transitions to re
To truly fix the issue, we can break long runs of 0's by mapping group of bits to longer patterns that do not have consecutive 0's. @@ -1247,8 +1272,8 @@ Since there are 32 different 5 bit patterns and all of them are not used. We can
Another approach is scrambling the bits to reduce chances of long runs of 0's. @@ -1268,8 +1293,8 @@ However, since scrambling is pseudorandom there is no guarentee that long run
Signals that have almost as many positive voltages as negative voltages are called balanced signals. Balanced signals average to zero, which means they have no DC electrical component. @@ -1285,7 +1310,299 @@ We need balanced signals because
+TODO : Add image +
+ ++AMI encoding adds another voltage level to achieve the balance. It is a bipolar encoding, i.e it uses positive and negative voltages to represent 1 bit and no voltage to represent 0 bit. +
+ ++Therefore, there are 3 levels in the signal +, - and 0. The 1 bit will cycle between positive and negative values, to make signal balanced. The pair of voltages chosen cancel each other (example, + is +5V and - is -5V). +
+ ++0 bits are all represented by 0V +
+ +
+The first 1 bit in sequence is +
+
+The second 1 bit in sequence is -
+
+The third 1 bit in sequence is +
+
+and so on.
+
+Suppose + is +5V and - is -5V. The encoding will be as follows +
+Bits | +1 | +0 | +1 | +0 | +0 | +1 | +1 | +1 | +0 | +0 | +1 | +
---|---|---|---|---|---|---|---|---|---|---|---|
Signal | ++ | +0 | +- | +0 | +0 | ++ | +- | ++ | +0 | +0 | +- | +
Voltage (V) | ++5 | +0 | +-5 | +0 | +0 | ++5 | +-5 | ++5 | +0 | +0 | +-5 | +
+In old terminology, 1 is called a "mark" and 0 is called a "space". +
++If we don't want to add another level to achieve balance, we can use mapping similar to 4B/5B. +A balanced code is 8B/10B. It will map 8 bits to 10 bits, therefore it is 80% efficient. +
+ ++The 8B/10B coding will first take the first 5 bits from 8 bit input and map it to 6 bits (using a 5B/6B). Then it will take the remaining 3 bits and map them to 4 bits (using a 3B/4B). Finally the 6 bits and 4 bits are concatenated to get 10 bits. +
+ ++The 3B/4B and 5B/6B will try to produce codes that are balanced. For example, "001" will be mapped to "1001" by 3B/4B. But producing all codes balanced is not possible in this way. +
+ ++Both 3B/4B and 5B/6B can map an input into one of two outputs, one with an extra 1 and other with extra 0. This pair of outputs are usually complement of each other. As these two codes map bits, the encoder will remember the disparity between the two produced codes. Then it will choose one of the two possible outputs such that disparity is reduced. +
+ ++
+Two different switching techniques are used by networks. +
++This section will only provide brief introduction with relation to physical layer. Switching is later discussed in network layer. +
++When a telephone call is placed, the switching equipment looks for a single path from sender to receiver and maintains it for the duration of the communication. This technique of having a direct physical connection is called circuit switching. +
+ ++In early days of telephone, connection was made by operator by plugging jumper cables into input and output sockets. Automatic circuit switching was invented by Almon B. Strowger. For nearly a 100 years, the automatic circuit switching equipment used worldwide was known as Strowger gear. +
+ ++The parts of path between telephone may in fact be microwave or fibre or any other type of medium. There are thousand of calls multiplexed on parts of links. +
+ ++The main property of circuit switching is that there is a single path for the whole duration of communication. Therefore, it needs to set up and end-to-end path before any data can be sent. The bandwidth required for communication is also reserved before data is sent. +
+ ++Since there is a reserved path, once setup is complete the only dealy for data is propogation time for signals. Also once path is reserved, there is no danger of congestion. Of course the conjestion can be felt before connection is established, as it may take a while due to switching or trunk capacity. +
++In contrast to circuit switching, there is no need to set up dedicated path in advance. Packet switching is analogous to sending data in form of series of letters using postal system. +
++Each packet will travel independently of others and can choose any path to reach destination in the network. It is up to routers to use store-and-forward transmission to send each packet on its way towards the destination. Since every packet travels independently, they may arrive out of order. +
+ ++Packet-switching networks place tight upper limit on the packet sizes. This ensures that no single user can monopolize any transmission line for long, so that network can handle interactive traffic. It also reduces delay since first packet of a long message can be forwarded before second is fully formed. However, there is more delay than circuit switching. In ciruit switching, bits can flow continuously without anything ever being stored and forwarded later. +
+ ++Since bandwidth is not reserved, packets may have to wait to be forwarded, this introduces queuing delay and congestion. On the other hand, we don't have to wait to establish a connection. Therefore, in circuit switching (during setup) and packet switching (packets are travelling) congestion occurs at different times. +
+ ++Packet switching does not waster bandwidth which is limited resource. Packet switching is also more fault tolerant, in fact that was why packet switching was chosen for internet. If some switches go down, packets can travel around them. +
+ ++These differences in the types of switching also leads to the difference in which billing is usually done for both networks. With circuit switching main load factors are distance and time of communication, therefore billing is done for how long connection is established (talktime on phone calles). Whereas in packet switching main load factor is how much traffic is added to network by a user, therefore billing is done based on how much data is transferred by user. +
+ ++The difference between circuit and packet switching is +
+Item | +Circuit switched | +Packet switched | +
---|---|---|
Call Setup | +Required | +Not needed | +
Dedicated Physical Path | +Yes | +No | +
Whole data follows same path | +Yes | +No | +
Data arrives in order | +Yes | +No | +
Is a switch crash fatal | +Yes | +No | +
Bandwidth available | +Fixed | +Dynamic | +
Time of possible congestion | +At setup | +On every packet | +
Potentially wasted bandwidth | +Yes | +No | +
Store-and-forward transmission | +No | +Yes | +
Billing | +Per minute | +Per Byte | +
+