Basic Networking Concepts By Just1ce 1. The OSI model It's a conceptualisation of an exchange between 2 computers, divided into 7 layers to facilitate the understanding. It looks like this: Machine1 Machine2 Application TELNET Application Presentation ASCII,EBCDIC Presentation Session SQL data Session Transport TCP,UDP segment Transport Network IP,ARP,ICMP packet Network Data Link PPP,SLIP frame Data Link Physical bits Physical Each layer on a machine talks to the same layer of the other machine. a) Physical layer: at this layer, there are electrical pulses, electro waves or light pulses sent across a physical link, either a cable or the air. - Related material: copper cable, optical fiber. - Equipment: HUB, Repeter. b) Data Link: divided into MAC and LLC sub-layers. It insures that there will be compatibility and standard whatever the upper protocol or access to the media has been used i.e. Ethernet, Token Ring, FDDI ... Flat, physical addressing. - Equipment: Switch, Bridge c) Network: This layer is responsible for logical addressing and packet encapsulation. - Equipment: Routers. d) Transport: This layer is responsible for breaking data into segments and to monitor errors amongst other things. - TCP: this important protocol is connection-oriented, reliable and slow. - UDP: this protocol is not connection-oriented, is not reliable but is fast. e) Session: At this layer 3 events are performed: initiation, maintenance and ending the session . f) Presentation: coding and encryption are the main topic of this layer. g) Application: most of the exchanges between computers are initiated through applications. Ex. : telnet, ftp ... However, this model shows layers that are not independent one from the other. Let see it with an example: I open my Leap FTP client (application) and I try to connect to a FTP server ( opening a session) the computers will exchange data using ASCII ( presentation).It's connection-oriented using TCP/IP. The exchanged files will be broken into smaller parts named packets or datagrams (IP). These packets are ENCAPSULATED into frames on the Ethernet segment my computer is connected. At the physical layer, electrical pulses goes to the local router where the frame is opened and the packet header is read. The router ENCAPSULATES it again and send it to the next router, using the MAC address of the next router but using the IP address to forward it to the right path..... until it reaches the FTP server. The server check the frame header and recognise its address.It opens the frame and read the IP header.At this point, it now understand the type of the packet and will forward it to the appropriate application. 2. IP addresses and binary maths a) IP addresses are divided into classes: Network range Mask Class A 1-126 255.0.0.0 Class B 128-191 255.255.0.0 Class C 192-223 255.255.255.0 Class D 224-239 255.255.255.0 Class E 240-255 255.255.255.0 Reserved addys: 0.0.0.0 = all other addresses 127.x.x.x = internal loop Private addys: 10.0.0.0 to 10.255.255.255 172.16.0.0 to 172.31.255.255 192.168.0.0 to 192.168.255.255 That means 1 class A network, 16 class B network and 256 class C networks are non-routable addresses. * Class D and E are special addresses that are almost never encountered. Class D are multicast addresses i.e. many computers share the same IP address so they are able to receive communication transmitted for the same IP. Computers using these addresses must have another network card to be able to surf on the web. * The mask is found when all the bits allocated for the network part are turned to 1's. * A broadcast address is done with all the hosts bits turned to 1's. b) IP addresses and binary We have seen the IP (s) in their base 10 form but a computer read only 0 and 1 so we have to translate these addresses in their binary form to understand fully the related concepts. *Go read a short tutorial if you don't know how binary maths are done. So an IP address can be broken into 2 parts: the network part and the hosts part. The mask indicate how many bits are reserved for the network part so IP mask can also be read like this: mask Class A 11111111.0.0.0 Class B 11111111.11111111.0.0 Class C 11111111.11111111.11111111.0 On the contrary, a broadcast address for a network address will be Network (in base 10) Hosts (in binary) Class A 1-126. 11111111.11111111.11111111(255.255.255) Class B 128-191.x. 11111111.11111111(255.255) Class C 192-223 .x.x. 11111111(255) c) Sub-networking Sub-networking occurs when someone take bits that are usually used for the host part and use these bits in the network part. It can be useful when a lot of network are required and only a few stations are into each network. Let's see a practical example: I use 192.168.5.0 for my network and I want to do 12 networks with that basic network. How I will proceed? By checking how many bits I need: 2 e4 = 16 so I need at least 4 bits borrowed from my host part. My networks will be divided like this: 192.168.5. _ _ _ _ 0000 192.168.5. 0 0 0 1 0000 = 192.168.5.16 192.168.5. 0 0 1 0 0000 = 192.168.5.32 192.168.5. 0 0 1 1 0000 = 192.168.5.48 192.168.5. 0 1 0 0 0000 = 192.168.5.64 192.168.5. 0 1 0 1 0000 = 192.168.5.80 192.168.5. 0 1 1 0 0000 = 192.168.5.96 192.168.5. 0 1 1 1 0000 = 192.168.5.112 etc. The broadcast addresses of these addresses would be: Address 192.168.5. 0 0 0 1 1111 = 192.168.5.31 192.168.5. 0 0 1 0 1111 = 192.168.5.47 192.168.5. 0 0 1 1 1111 = 192.168.5.63 192.168.5. 0 1 0 0 1111 = 192.168.5.79 192.168.5. 0 1 0 1 1111 = 192.168.5.95 192.168.5. 0 1 1 0 1111 = 192.168.5.111 etc. * Usually, the mask is show either with the base 10 number like this: 192.168.5.255 but sometimes you will see this notation 192.168.5 /24 where 24 indicate the number of bits for the network part. When there is sub-networks, you will see something like 192.168.5.240 or 192.168.5 /28 to indicate the borrowed bits.