How do hosts know which part of the IP is host and other is Network
That is the Job of the Subnet Mask
Subnetting:
Subnet Mask Notation:
Subnet masks are often expressed using CIDR notation. For instance, instead of writing 255.255.255.0, you can write /24.
Subnetting Example:
If you have the IP address 192.168.1.0/24, it means the first 24 bits are the network portion, and the remaining 8 bits are the host portion.
Subnetting further might result in subnets like 192.168.1.0/26, 192.168.1.64/26, and so on.
Subnet Mask in Binary:
To better understand subnetting, convert the subnet mask to binary. For example, 255.255.255.0 in binary is 11111111.11111111.11111111.00000000.
Key Points:
Network Address: The network address is the first address in a subnet, and the host portion is set to all zeros.
Broadcast Address: The broadcast address is the last address in a subnet, and the host portion is set to all ones.
Host Range: The addresses between the network and broadcast addresses are available for hosts.
Subnetting Examples:
Subnetting Example:
Given the IP address 192.168.1.0 with a subnet mask of 255.255.255.0 (or /24 in CIDR notation), you have 256 addresses in the subnet (2^8). The usable host addresses are 192.168.1.1 to 192.168.1.254, with the network address being 192.168.1.0 and the broadcast address being 192.168.1.255.
CIDR Notation Example:
An IP address like 192.168.1.0/26 means that the first 26 bits represent the network, and the remaining 6 bits represent hosts. This results in smaller subnets with 64 addresses each.
OSI Model:
The OSI (Open Systems Interconnection) Model is a standardised model which we use to demonstrate the theory behind computer networking. In practice, it's actually the more compact TCP/IP model that real-world networking is based off; however the OSI model, in many ways, is easier to get an initial understanding from.
OSI Model: Application Layer (L7):
The application layer of the OSI model essentially provides networking options to programs running on a computer. It works almost exclusively with applications, providing an interface for them to use in order to transmit data. When data is given to the application layer, it is passed down into the presentation layer.
OSI Model: Presentation Layer (L6):
The presentation layer receives data from the application layer. This data tends to be in a format that the application understands, but it's not necessarily in a standardised format that could be understood by the application layer in the receivingcomputer. The presentation layer translates the data into a standardised format, as well as handling any encryption, compression or other transformations to the data. With this complete, the data is passed down to the session layer.
OSI Model: Session Layer (L5):
When the session layer receives the correctly formatted data from the presentation layer, it looks to see if it can set up a connection with the other computer across the network. If it can't then it sends back an error and the process goes no further. If a session can be established then it's the job of the session layer to maintain it, as well as co-operate with the session layer of the remote computer in order to synchronise communications. The session layer is particularly important as the session that it creates is unique to the communication in question.
OSI Model: Session Layer (L5):
The session layer is particularly important as the session that it creates is unique to the communication in question. This is what allows you to make multiple requests to different endpoints simultaneously without all the data getting mixed up (think about opening two tabs in a web browser at the same time)! When the session layer has successfully logged a connection between the host and remote computer the data is passed down to Layer 4: the transport Layer.
OSI Model: Transport Layer (L4):
Its first purpose is to choose the protocol over which the data is to be transmitted. The two most common protocols in the transport layer are TCP (TransmissionControlProtocol) and UDP (UserDatagramProtocol); with TCP the transmission is connection-based which means that a connection between the computers is established and maintained for the duration of the request. This allows for a reliable transmission, as the connection can be used to ensure that the packets all get to the right place.
OSI Model: Transport Layer (L4):
A TCP connection allows the two computers to remain in constant communication to ensure that the data is sent at an acceptable speed, and that any lost data is re-sent. With UDP, the opposite is true; packets of data are essentially thrown at the receiving computer -- if it can't keep up then that's its problem (this is why a video transmission over something like Skype can be pixelated if the connection is bad).
OSI Model: Transport Layer (L4):
What this means is that TCP would usually be chosen for situations where accuracy is favoured over speed (e.g. file transfer, or loading a webpage), and UDP would be used in situations where speed is more important (e.g. video streaming).
With a protocol selected, the transport layer then divides the transmission up into bite-sized pieces (over TCP these are called segments, over UDP they're called datagrams), which makes it easier to transmit the message successfully.
OSI Model: Network Layer (L3):
The network layer is responsible for locating the destination of your request. For example, the Internet is a huge network; when you want to request information from a webpage, it's the network layer that takes the IP address for the page and figures out the best route to take. At this stage we're working with what is referred to as Logicaladdressing (i.e. IP addresses) which are still software controlled. Logical addresses are used to provide order to networks, categorising them and allowing us to properly sort them.
OSI Model: Data Link Layer (L2):
The data link layer focuses on the physical addressing of the transmission. It receives a packet from the network layer (that includes the IP address for the remote computer) and adds in the physical (MAC) address of the receiving endpoint. Inside every network enabled computer is a NetworkInterfaceCard (NIC) which comes with a uniqueMAC (MediaAccessControl) address to identify it.
OSI Model: Data Link Layer (L2):
MAC addresses are set by the manufacturer and literally burnt into the card; they can't be changed -- although they can be spoofed. When information is sent across a network, it's actually the physical address that is used to identify where exactly to send the information.
OSI Model: Data Link Layer (L2):
Additionally, it's also the job of the data link layer to present the data in a format suitable for transmission.
The data link layer also serves an important function when it receives data, as it checks the received information to make sure that it hasn't been corrupted during transmission, which could well happen when the data is transmitted by layer 1: the physical layer.
Layer 1 -- Physical:
The physical layer is right down to the hardware of the computer. This is where the electrical pulses that make up data transfer over a network are sent and received. It's the job of the physical layer to convert the binary data of the transmission into signals and transmit them across the network, as well as receiving incoming signals and converting them back into binary data.
Encapsulation:
As the data is passed down each layer of the model, more information containing details specific to the layer in question is added on to the start of the transmission. As an example, the header added by the Network Layer would include things like the source and destination IP addresses, and the header added by the Transport Layer would include (amongst other things) information specific to the protocol being used.
Encapsulation:
The data link layer also adds a piece on at the end of the transmission, which is used to verify that the data has not been corrupted on transmission; this also has the added bonus of increased security, as the data can't be intercepted and tampered with without breaking the trailer. This whole process is referred to as encapsulation; the process by which data can be sent from one computer to another.
Information Down the Layers:
DE-Encapsulation
When the packet gets passed down to the Data Link layer it becomes a frame, and by the time it's transmitted across a network the frame has been broken down into bits.
When the message is received by the second computer, it reverses the process -- starting at the physical layer and working up until it reaches the application layer, stripping off the added information as it goes. This is referred to as de-encapsulation.
Data Link Layer: Trailer Header:
The trailer at the data link layer is necessary for a few reasons: Error detection: The trailer often contains error-checking information, such as a cyclic redundancy check (CRC), which allows the receiving device to detect errors in the received data.
How does encapsulation add security?
Confidentiality: Encapsulation often involves encrypting data before transmission. By encapsulating data in a secure manner, unauthorized parties are less likely to intercept and understand the information being transmitted, thus preserving confidentiality.
Integrity: Encapsulation protocols often include mechanisms for ensuring the integrity of transmitted data. This typically involves adding checksums or hashes to the encapsulated packets, allowing the recipient to verify that the data has not been tampered with during transmission
How does encapsulation add security?
Access Control: Protocols that encapsulate data often include authentication mechanisms to ensure that only authorized entities can access or modify the encapsulated information. This helps control access to sensitive data and prevents unauthorized parties from interfering with the communication.
Tunneling for Secure Communication: VPNs encapsulate data within secure tunnels, providing a secure and private communication channel over an otherwise untrusted network, such as the internet.
How does encapsulation add security?
Segmentation and Isolation: Encapsulation allows for the segmentation of data into smaller packets. This segmentation not only facilitates efficient transmission but also provides a level of isolation. If a part of the encapsulated data is compromised, it doesn't necessarily compromise the entire communication, limiting the potential impact of security breaches.
TCP/IP Model:
TransmissionControlProtocol controls the flow of data between two endpoints, and the Internet Protocol, which controls how packets are addressed and sent. There are many more protocols that make up the TCP/IP suite;
TCP is a connection-based protocol. In other words, before you send any data via TCP, you must first form a stable connection between the two computers. The process of forming this connection is called the three-way handshake.
TCP Handshake:
When you attempt to make a connection, your computer first sends a special request to the remote server indicating that it wants to initialise a connection. This request contains something called a SYN (short for synchronise) bit, which essentially makes first contact in starting the connection process. The server will then respond with a packet containing the SYN bit, as well as another "acknowledgement" bit, called ACK.
TCP Handshake:
Finally, your computer will send a packet that contains the ACK bit by itself, confirming that the connection has been setup successfully. With the three-way handshake successfully completed, data can be reliably transmitted between the two computers. Any data that is lost or corrupted on transmission is re-sent, thus leading to a connection which appears to be lossless.
Why the TCP/IP Model:
To begin with there was no standardisation -- different manufacturers followed their own methodologies, and consequently systems made by different manufacturers were completely incompatible when it came to networking. The TCP/IP model was introduced by the American DoD in 1982 to provide a standard -- something for all of the different manufacturers to follow. This sorted out the inconsistency problems.
TCP/IP
What is a Link?
A link refers to the connectivity between two devices. It includes the type of cables and protocols used for one device to be able to communicate with the other.
What are the layers of the OSI reference model?
There are 7 OSI layers: 1) Physical Layer, 2) Data Link Layer, 3) Network Layer, 4) Transport Layer, 5) Session Layer, 6) Presentation Layer, and 7) Application Layer.
What is the backbone network?
A backbone network is a centralized infrastructure that is designed to distribute different routes and data to various networks. It also handles the management of bandwidth and multiple channels.
What is a LAN?
LAN stands for Local Area Network. It refers to the connection between computers and other network devices that are located within a small physical location.
What is a node?
A node refers to a point or joint where a connection takes place. It can be a computer or device that is part of a network. Two or more nodes are needed to form a network connection.
What are routers?
Routers can connect two or more network segments. These are intelligent network devices that store information in its routing tables, such as paths, hops, and bottlenecks. With this info, they can determine the best path for data transfer. Routers operate at the OSI Network Layer.
What is a point to point link?
It refers to a direct connection between two computers on a network. A point to point connection does not need any other network devices other than connecting a cable to the NIC cards of both computers.
IP address
An Internet Protocol address is a numerical label such as 192.0.2.1 that is assigned to a device connected to a computer network that uses the Internet Protocol for communication. IP addresses serve two main functions: network interface identification, and location addressing.
What is anonymous FTP?
Anonymous FTP is a way of granting user access to files in public servers. Users that are allowed access to data in these servers do not need to identify themselves, but instead, log in as an anonymous guest.
What is a subnet mask?
A subnet mask is combined with an IP address to identify two parts: the extended network address and the host address. Like an IP address, a subnet mask is made up of 32 bits.