1.4a
What is IP?
Internet Protocol (IP) is the fundamental protocol that governs communication across the internet. It's responsible for routing data packets from one network device to another. IP provides the logical addressing system that allows devices to find each other on the network.
How does IP work?
IP operates in a layered model. It sits above the Network layer in the OSI model. IP packets, also known as datagrams, contain the destination IP address, source IP address, and the actual data to be transmitted.
Encapsulation: The data to be sent is encapsulated within an IP datagram.
Routing: The router examines the destination IP address to determine the best path to send the datagram.
Forwarding: The datagram is forwarded to the next hop router until it reaches its destination.
The role of TCP and UDP
IP is often used in conjunction with other protocols, primarily Transport Layer protocols TCP (Transmission Control Protocol) and UDP (User Datagram Protocol).
TCP: Offers reliable, connection-oriented communication. It guarantees delivery of data and provides features like flow control and error recovery. TCP is suitable for applications that require high reliability, such as file transfers and web browsing.
UDP: Provides a connectionless, unreliable service. It's more efficient than TCP but doesn't guarantee delivery. UDP is suitable for applications that can tolerate some packet loss, such as streaming audio and video.
IP Addressing
IP addresses
An IP address is a unique numerical label assigned to each device connected to a network. It consists of four octets (groups of eight bits) separated by periods. There are two main types of IP addresses:
IPv4: The original version of IP, using 32-bit addresses.
IPv6: A newer version that uses 128-bit addresses, providing a much larger address space.
IP address classes
IPv4 addresses are divided into five classes: A, B, C, D, and E. Classes A, B, and C are used for network addressing. Class D is used for multicast addressing, and Class E is reserved for experimental use.
Subnet masks
A subnet mask is used to divide an IP address range into smaller subnets. It determines which part of an IP address identifies the network and which part identifies the host.
Routing
Routing involves determining the best path for a packet to reach its destination. Routers use routing protocols (e.g., RIP, OSPF, BGP) to exchange routing information and build routing tables.
TCP and UDP
TCP
Connection-oriented
Reliable delivery
Flow control
Error recovery
Suitable for applications requiring high reliability
UDP
Connectionless
Unreliable delivery
Efficient
Suitable for applications tolerant of packet loss
Port Numbers
A port number is a logical address used to identify specific applications or services running on a host. It's part of the TCP or UDP header. Port numbers range from 0 to 65535.
Well-known ports: Reserved for specific services (e.g., HTTP: port 80, FTP: port 21).
Registered ports: Assigned to specific organizations or applications.
Ephemeral ports: Dynamically assigned to applications.
IP Communication
How IP communication works
A device generates an IP packet containing the destination IP address, source IP address, and data.
The packet is forwarded through routers based on routing tables.
The packet reaches its destination host.
The destination host extracts the data and processes it.
An example of IP communication
A web browser on a client device sends an HTTP request to a web server. The HTTP request is encapsulated within an IP datagram. The datagram is routed through the network to the web server. The web server processes the request, generates an HTML response, and encapsulates it in an IP datagram. The response is routed back to the client, where the browser extracts the HTML and displays the webpage.