Networking OSI Model
Architecture Model. OSI Model
7 layers: 1-4 lower level dealing with moving data physically. 5-7 is upper app level.
Level 1 Physical Layer
It deals deals with bit-level transmission, bit streams (e.g. raw data 100011001110011000)
Ethernet. Cables Cat5 (1 GB/s speed at 100 meters). Cat6 cables can handle up to 10 GB/s of data, that bandwidth is limited to 55 meters — anything beyond that will rapidly decay to only 1 Gb.
Examples: Ethernet (100BASE-T etc), USB, GSM Air Interface, Bluetooth, Wi-fi 802.11 etc
Level 2 Data Link, streams are forming data packets, which are encoded/decoded. Handles errors in physical layer.
It is divided in two sublevels: MAC Media Access Control and LLC Logical Link Control. MAC deals with access and permissions to transmit data. LLC controls frame syncs, flow control and physical error checking.
It operates with MAC addresses: 00-01-42-13-31-C9
Examples: PPP, FDDI, ATM IEEE 802.3, etc
Level 3 Network Layer. It provides switching and routing. Here virtual circuits (= logical paths) are created for transmitting data node to node. Functions of this layers are: routing, forwarding, addressing, internetworking, error handling, congestion control and packet sequencing.
It operates through IP addresses: IPv4 194.78.0.163, or IPv6
Examples: IP
Level 4 Transport level. Transfer data between hosts. Other functions error recovery and flow control.
Examples: TCP, UDP
Level 5 Session Layer. It manages connections coordinations
Level 6 Presentaion layer. Data representation (e.g. encryption) and its compatibility across networks.
Examples: encryption, ASCII, JPEG, MPEG. MIDI.
Level 7 Application layer. Everything here is application specific. It provides services for file transfer, emails etc.
Examples: HTTP, WWW, FTP
Switch and routers
A switch operates at level 2 (Data link).
A switch connects networks at MAC level. It is often called a MAC bridge. It’s also much cheaper.
A router is more sophisticated. It is a net device which connects a local network to other networks.
It operates at level 3 (Transport). It directs traffic. It means it can act as intermediate destination over internet, it stores IPs in routing tables.
It can perform NAT (Network Address Translation)
Data packets. They have encoded in the Sender IP + Receiver IP.
There are only 4.2 billion IP (32 bit) addresses. But 7 billion people each with own devices.
Explaining NAT (Network address translation)
Router expose a public IP address: e.g 12.13.14.15 and a private one e.g. 192.168.1.1. Then he reference all local devices as 192.168.1.2, 192.168.1.3 etc These are not accesible from the external internet.
All addresses of this format: 192.168.x.x and 10.x.x.x. are reserved for private networks.
A question like ‘What is the temperature in NY today’ from my local device will translate as 192.168.1.3:42301
to 40.30.20.10:80
, thus the package will encode the Sender and Receiver’s IP. Now here :80 is the port number encoded for www. The response back from 40.30.20.10
to 192.168.1.3:42301
which is 30 degrees Celsius
will not be reachable because 192.168.1.3 is a private address. The Receiver (the remote web server) will send it back to the originated router e.g 12.13.14.15 which keeps a NAT forwarding table. This table keeps reference of the originated device as so
NAT forwarding table
| Private | Public side |
|-------------------|-------------------|
| 192.168.1.3:42301 | 12.13.14.15:24604 |
This NAT translation is necessary because of the aforementioned IPv4 limitation. The future will slowly moved to IPv6 (3.4x10^38).