01.1 (Conspect) TCP/IP overview
Before we start learning about network programming, we will discuss TCP/IP.
- Let's imagine the situation that we are on the verge of inventing the Internet: we have two computers connected to a telephone (about 40 years ago) which is not clear than ( analogue modem). There was no Internet and the question arose to develop a more or less clear and universal, flexible model of how computers can be connected to a single data network and what rules to introduce.
Data transmission environment
Step 1: we need to figure out how the data will be transmitted in general, that is (in the form of what?).
- There can be all kinds of difficulties in data transmission. First of all, to turn a figure into something that can be transmitted through media. And then something that can be transmitted through the media can be transmitted back. It means that we have to be able to transfer the digit into something that can turn specifically into wires and then turn it back into something that can be transmitted back.
- I mean, what's the media gonna be? - The answer is, maybe a wire. Trucks of winches (for a long time it was an effective method (we stuff data carriers and send them to another city, it was more effective than downloading data from somewhere). Transmit by fibre optic cable or by air - radio signal.
You have to imagine how well the data will be transmitted. We must take this into account and choose media by this criterion. For example, the weight of the same coding on the wire (0 and 1) has two problems.
- 1) (Scrombling) is very difficult to catch a switch from 0 to 1. The parameters of any metal medium are different from those of a medium that may not experience voltage or drop within a few seconds. The idea of making the absence of voltage equal to 0 and the presence of voltage equal to 1 is a bad idea. I think that any noise will provoke our detector to give incorrect data. 2) Coding - in the case of the wire we must agree on the speed at which 0 and 1 change. If we do not agree, we will get different results.
Connecting the computer to the data transmission environment
We now agree on how several subscribers of our environment will transmit this very data in this environment, and if this agreement is called level 2 protocol, it means several environments - lei. There are mixed networks. We must accept how we will want to share this environment:
- Channel-switched networks - there are multiple channels of communication between computers, all computers are connected to each other, and in order for computer A to transmit information to computer B. He takes the channel that links them, transmits the information through it, the corresponding software that knows what a marker of the beginning of data transmission catches this fact. And it waits for the end marker and primes the message. If each of them is infinitely large (a lot of them are square-size), they may be missing. We have n channels and H computers. They have to rent this anal and release it further, because there are not enough channels for everyone.
- Pact-switching networks - at the moment. The unit of transmission is the packet. A single transmission medium is connected to the torus by all subscribers in our network, but they do not send data to it from beginning to end, but cutting it into pieces called packets. We must decide who sends how (in what order).
1 problem - determine the procedures of subscription of this channel and some intermediate agent that will sell and collect this channel. 2 problem - encapsulation, i.e. to determine the packet
!Octet = 8 bits
Media discipline
- How to send a packet in the same time with other nodes over joint media?
How not to receive/eavesdrop foreign packets?
Example: ethernet
preamble of the packet (additional fixed 0/1 sequence) ti detect packet start
Frame_check_sequence (checksum) to verify packet integrity
MAC_address to identify nodes
Ethernet packets are called frames
Carrier-sense_multiple_access_with_collision_detection
- Can sense if media is not busy, so a packet can be sent
- When sending, can detect a collision (that other device is sending packet at the same time)
In both previous cases, stop a transmission, wait with random timeout and retry it
On recurrent busy/collision wait longer time and retry
Carrier-sense multiple access with collision detection is smart, but makes transmission time unpredictable.
Raw old ethernet local network is functioning normally until 30% of all the time it's busy, and 70% stale. If load goes over 50%, the network is considered inoperable.
Example: Token_ring
Not much to say, that's ancient technology
- In simple words:
- Media is like ring railroad with nodes as stops
- There's train runs round the ring (token)
- When train makes a stop (a node got the token), the node
- can detach a car routing to this stop (receive packet addressing to this node)
- and attach a car routing to another stop (send a packet to another node)
This policy has guaranteed delivery speed, but slow.
Invariants
- Incapsulation
All higher level data is separated into pieces (this is called fragmentation), each fit to be payload of a current level packet (level 2 packet is frame). Then data is wrapped into packet metadata (e. g. ethernet: MAC-addresses, type, checksum etc) and then sent.
- Independence
- There's (theoretically) no dependence on lower level implementation, e. g. ethernet frames are just the same, either if media is twisted pair or coaxial.
Consolidation of various SPDs
Combining many transmission environments, read local area networks (although this is a slightly narrower concept) into a WAN.
Here arises the task which was said at first - to learn how to identify all subscribers to the global network. The global network is always changing. Only raggedy geeks may want a list of all Internet subscribers and it will not help them anything.
- Identification
- Ensuring the possibility of data delivery from the sender to the recipient. Within a single SPD this is implied by default. But in the case of multiple SPDs it is not obvious. The site says "planning for data delivery", but this is a euphemism of the word routes. It's a rather complicated task. However, if we want the data to be transmitted, we have to describe a rule according to which data from subscriber A can reach B. If we have a complete network map somewhere, it can look and decide how to transmit. The problem is to keep the entire card. And the second drawback is that the Internet is big, and some link may fall off in a blocked route. The other is not knowing exactly how the data will reach its destination, but knowing who to send it to next. Dynamic route construction.
TCP/IP model, it has the following levels:
- hardware;
- interface (Cisco "believes" that layer four, combining hardware and interface. The lecturer and "all others" "believe" that Layers five);
- network;
- transport;
- application.
Global network
The task of data transfer is solved, but:
- locally (in the space of single media)
- without any data integrity / transmission control / data interpretation
So we shall continue. Next subtask is to unite all local networks (sets of nodes bound by joint media) into global network
- Router
- a node of two or more local networks, that can retransmit packets from one network to another
- Route
- a chain of routers leads from sender to recipient
- Routing
a process of determining this chain
- Host
- a node of global network
Identifying and routing
- All hosts should have unique identifiers
When sending a packet from one host to another, in case they're not connected to the same media, there should be algorithm to determine what router to chose to send packet instead of recipient (which therefor is not accessible directly by media)
Dynamic connectivity
No host can bear a full routing map of global network:
- It changes every second
Everybody can change a route without informing all others
But some information on what is connected to what is critical. Question is: what is «what»?
E. g.: the Internet
- Addressing:
every host has an (almost) unique IP_address
There's some address groups, that can be non-unique, for use in intranet, the set of local networks under single administration
- Routing:
- every IP address is assigned to a network interface connected to the media
Classic (topological): every IP address is divided to network address and node address.
- If network addresses of two nodes are identical, they treated as connected to single media, so no routing is needed.
If network addresses of two nodes are different, there must be special routing table entry pointing to the router that can deliver packet to the recipient. The shorter network address is, the longer is node address and more nodes can belong to this network. IPv4 network address of 0 bits (0.0.0.0) means all the internet
- Typical network setup:
- One local network
- One default router for all recipient not belonging to local network
- Non-classic (source based / policy based) routing
- Exterior dynamic routing:
A set of single-administered local networks forms autonuomus system
All AS'es should announce their availability and other properties to each other (for example, via Border_Gateway_Protocol), and update routing tables.