Difference between revisions of "TCP/IP"

From Pulsed Media Wiki
(Network)
 
(Guides: Information: Pulsed Media: Linux)
 
Line 1: Line 1:
The '''Internet Protocol Suite''' (often referred to as '''TCP/IP''') is the fundamental set of [[Network protocol|network protocols]] that underpin the [[Internet]] and most other computer networks. It defines how [[Data|data]] should be packaged, addressed, transmitted, routed, and received, enabling diverse computer systems and networks to communicate with each other.
+
= Internet Protocol Suite (TCP/IP) =
  
The suite is named after two of its most important protocols: the [[Transmission Control Protocol]] (TCP) and the [[Internet Protocol]] (IP). While it includes many other protocols, TCP and IP are central to its operation.
+
The '''Internet Protocol Suite''' (often called '''TCP/IP''') is the core set of network protocols that power the Internet and most computer networks. It dictates how data is packaged, sent, and received, allowing different systems to communicate. Named after its two main components, Transmission Control Protocol (TCP) and Internet Protocol (IP), it includes many other protocols essential to its function.
  
 
== Overview ==
 
== Overview ==
The TCP/IP suite is organized into layers, where each layer handles a specific aspect of network communication and interacts with the layers above and below it. This layered model simplifies the design and development of networking hardware and software. The most commonly referenced layers are:
+
The TCP/IP suite uses a layered model, with each layer managing a specific part of network communication. This simplifies hardware and software design. The main layers are:
 
+
* **Application Layer:** For direct application interaction (e.g., HTTP, FTP, DNS).
* **Application Layer:** Protocols that interact directly with applications (e.g., HTTP, FTP, SSH, DNS).
+
* **Transport Layer:** Manages data transfer between applications (e.g., TCP, UDP).
* **Transport Layer:** Provides communication services to the application layer, managing data transfer between applications (e.g., TCP, UDP).
+
* **Internet Layer:** Handles addressing and routing (e.g., IP).
* **Internet Layer:** Handles addressing and routing packets across networks (e.g., IP).
+
* **Link Layer:** For physical network interface and transmission (e.g., Ethernet, Wi-Fi).
* **Link Layer:** Protocols for the physical network interface and transmission medium (e.g., Ethernet, Wi-Fi).
+
Data moves down the layers when sending and up when receiving.
 
 
Data passes down through the layers on the sending computer (adding headers at each step) and up through the layers on the receiving computer (removing headers and processing data).
 
  
 
== Key Protocols: TCP and UDP ==
 
== Key Protocols: TCP and UDP ==
 
Within the TCP/IP suite, two major protocols operate at the Transport Layer, providing different services to applications:
 
Within the TCP/IP suite, two major protocols operate at the Transport Layer, providing different services to applications:
  
; [[Transmission Control Protocol]] (TCP)
+
; Transmission Control Protocol (TCP)
: A connection-oriented protocol that provides reliable, ordered, and error-checked delivery of a stream of packets between applications. It establishes a connection (the "three-way handshake") before sending data, ensures data arrives in the correct sequence, requests retransmission of lost packets, and manages flow control. TCP is slower due to this overhead but guarantees data integrity and reliable delivery.
+
: A reliable, connection-oriented protocol ensuring ordered and error-checked data delivery. It sets up a connection, retransmits lost data, and manages flow, making it slower but guaranteeing integrity.
  
; [[User Datagram Protocol]] (UDP)
+
; User Datagram Protocol (UDP)
: A connectionless protocol that provides a simpler, faster, but less reliable data transfer service. UDP sends data packets (datagrams) without establishing a connection or guaranteeing delivery order. It has lower overhead than TCP but does not retransmit lost packets or manage sequencing. It's suitable for applications where speed is more important than guaranteed delivery, or where error correction is handled by the application itself.
+
: A faster, connectionless protocol that sends data without guarantees of delivery or order. It has less overhead than TCP, making it suitable for applications prioritizing speed over reliability.
  
 
== TCP vs. UDP Comparison ==
 
== TCP vs. UDP Comparison ==
Line 28: Line 26:
 
|-
 
|-
 
! Feature
 
! Feature
! [[Transmission Control Protocol|TCP]]
+
! TCP
! [[User Datagram Protocol|UDP]]
+
! UDP
 
|-
 
|-
 
! Protocol Type
 
! Protocol Type
Line 61: Line 59:
  
 
== What TCP is Used For ==
 
== What TCP is Used For ==
TCP is used by applications whenever reliable and ordered delivery of a stream of data is essential. If a single packet is lost or arrives out of order, TCP handles the detection and correction, ensuring the application receives the data exactly as it was sent. This makes it suitable for:
+
TCP is used when reliable, ordered data delivery is critical. It handles lost or out-of-order packets, ensuring data arrives as sent. This makes it ideal for:
* Loading [[Web page|web pages]] (browsers need HTML, CSS, images to arrive completely and correctly).
+
* Loading web pages (HTTP/S).
* Sending and receiving emails.
+
* Sending/receiving emails (SMTP, POP3, IMAP).
* Transferring files accurately.
+
* Accurate file transfers (FTP, SFTP).
* Establishing secure, interactive sessions via SSH.
+
* Secure remote access (SSH).
 
* Database connections.
 
* Database connections.
  
 
== How Pulsed Media Uses TCP/IP ==
 
== How Pulsed Media Uses TCP/IP ==
Like virtually all services provided over the modern internet, Pulsed Media's services—including [[Seedbox|seedboxes]], [[Virtual Private Server|Virtual Private Servers]] (VPS), and [[Dedicated server|Dedicated Servers]]—**fundamentally rely on the TCP/IP suite for all network communication**. TCP/IP is the essential language of the internet that allows clients to connect to servers and servers to communicate with each other.
+
Pulsed Media's services—including [[Seedbox|seedboxes]], [[Virtual Private Server|VPS]], and [[Dedicated server|Dedicated Servers]]—**fundamentally rely on the TCP/IP suite** for all network communication, as does virtually all modern internet traffic.
 
 
Specific ways Pulsed Media services use TCP/IP protocols include:
 
  
* **Client Access:** When you connect to your seedbox or server using tools like [[SSH]], [[SFTP]], [[File Transfer Protocol|FTP]] (though [[FTP]] has security risks and should be avoided in favor of SFTP/FTPS), or access a web-based [[Graphical user interface|GUI]], you are using applications that operate over TCP/IP (e.g., SSH and SFTP run over TCP, FTP over TCP, Web GUIs over HTTP/HTTPS which run over TCP).
+
Specific uses include:
* **Torrenting:** While the BitTorrent protocol itself has layers, the primary data transfer connections between peers for sending and receiving file blocks typically occur over **TCP**. The initial connections to trackers also often use TCP. Some parts of BitTorrent, like DHT (Distributed Hash Table) or uTP (Micro Transport Protocol), use UDP, particularly on personal computers, but high-performance seedboxes often optimize core peer-to-peer data transfers over robust TCP connections or use dedicated UDP ports.
+
* **Client Access:** Connecting to your seedbox or server via [[SSH]], [[SFTP]], or web-based [[Graphical user interface|GUIs]] (all use TCP/IP).
* **Hosting Services (VPS/Dedicated Servers):** If you use a VPS or dedicated server for web hosting, email hosting, or other services, these services use TCP/IP protocols extensively (e.g., [[Apache HTTP Server|Apache]] or [[Nginx]] for HTTP/S over TCP, Postfix/Dovecot for SMTP/IMAP/POP3 over TCP, etc.).
+
* **Torrenting:** Core data transfers between peers typically use **TCP**. While some BitTorrent components (like DHT or uTP) use UDP, high-performance seedboxes often prioritize robust TCP connections for main data transfers.
 +
* **Hosting Services:** VPS and dedicated servers use TCP/IP extensively for web hosting (HTTP/S), email (SMTP/IMAP/POP3), and other services.
  
In essence, every bit of data transferred into or out of a Pulsed Media seedbox or server over the internet relies on the TCP/IP stack functioning correctly.
+
Essentially, all data transfer to or from a Pulsed Media service over the internet depends on the correct functioning of the TCP/IP stack.
  
 
== Tutorial: Opening TCP Ports on Linux (Debian) Server ==
 
== Tutorial: Opening TCP Ports on Linux (Debian) Server ==
Line 94: Line 91:
 
Verify that the firewall is active. If it's inactive, you'll need to enable it later.
 
Verify that the firewall is active. If it's inactive, you'll need to enable it later.
  
      sudo ufw status verbose   
+
  sudo ufw status verbose   
  
  
Line 100: Line 97:
 
Use the `ufw allow` command followed by the port number and `/tcp`. Replace `port_number` with the actual port the service listens on.
 
Use the `ufw allow` command followed by the port number and `/tcp`. Replace `port_number` with the actual port the service listens on.
  
      sudo ufw allow 80/tcp  # Example: Allow HTTP traffic
+
  sudo ufw allow 80/tcp  # Example: Allow HTTP traffic
      sudo ufw allow 443/tcp # Example: Allow HTTPS traffic
+
  sudo ufw allow 443/tcp # Example: Allow HTTPS traffic
      sudo ufw allow 22/tcp  # Example: Allow SSH traffic (essential if connecting remotely)
+
  sudo ufw allow 22/tcp  # Example: Allow SSH traffic (essential if connecting remotely)
      sudo ufw allow 8080/tcp # Example: Allow traffic on a custom port
+
  sudo ufw allow 8080/tcp # Example: Allow traffic on a custom port
  
  
Line 109: Line 106:
 
`ufw` has predefined rules for some common services (listed in `/etc/services`). You can use the service name instead of the port number.
 
`ufw` has predefined rules for some common services (listed in `/etc/services`). You can use the service name instead of the port number.
  
      sudo ufw allow http 
+
  sudo ufw allow http  
      sudo ufw allow https 
+
  sudo ufw allow https  
      sudo ufw allow ssh 
+
  sudo ufw allow ssh  
  
  
Line 117: Line 114:
 
To restrict access to a port to only specific source IPs.
 
To restrict access to a port to only specific source IPs.
  
      sudo ufw allow from 203.0.113.100 to any port 22 proto tcp # Allow SSH only from 203.0.113.100
+
  sudo ufw allow from 203.0.113.100 to any port 22 proto tcp # Allow SSH only from 203.0.113.100
      sudo ufw allow from 192.168.1.0/24 to any port 8080 proto tcp # Allow port 8080 from local network 192.168.1.0/24
+
  sudo ufw allow from 192.168.1.0/24 to any port 8080 proto tcp # Allow port 8080 from local network 192.168.1.0/24
  
  
Line 124: Line 121:
 
If `ufw status verbose` showed `Status: active`, reload to apply your new rules.
 
If `ufw status verbose` showed `Status: active`, reload to apply your new rules.
  
      sudo ufw reload 
+
  sudo ufw reload  
  
  
Line 130: Line 127:
 
If `ufw status verbose` showed `Status: inactive`, enable it. **WARNING:** Ensure you have allowed SSH (port 22) *before* enabling if connecting remotely via SSH, otherwise you will be locked out.
 
If `ufw status verbose` showed `Status: inactive`, enable it. **WARNING:** Ensure you have allowed SSH (port 22) *before* enabling if connecting remotely via SSH, otherwise you will be locked out.
  
      sudo ufw enable 
+
  sudo ufw enable  
  
 
Confirm the action when prompted.
 
Confirm the action when prompted.
Line 137: Line 134:
 
Check the status again to see your newly added rules.
 
Check the status again to see your newly added rules.
  
      sudo ufw status verbose 
+
  sudo ufw status verbose  
  
  
Line 144: Line 141:
 
'''Note on NAT/Port Forwarding:''' If your server is behind a router performing [[Network address translation|NAT]] and you want to access a service from the public internet, you will also need to configure [[Port forwarding]] on the router to direct incoming traffic from a public IP and port to your server's private IP and the service's TCP port.
 
'''Note on NAT/Port Forwarding:''' If your server is behind a router performing [[Network address translation|NAT]] and you want to access a service from the public internet, you will also need to configure [[Port forwarding]] on the router to direct incoming traffic from a public IP and port to your server's private IP and the service's TCP port.
  
== See also ==
+
== See Also ==
* [[Transmission Control Protocol|TCP]]
+
* [[SSH]]
* [[Internet Protocol|IP]]
+
* [[FTP]]
* [[UDP]]
+
* [[FileZilla]]
* [[Network protocol]]
 
* [[Internet Protocol Suite]]
 
* [[Port (computer networking)]]
 
* [[Firewall (computing)]]
 
* [[Ufw]]
 
* [[iptables]]
 
* [[nftables]]
 
 
 
 
 
 
 
== External links ==
 
* [https://www.cloudflare.com/learning/network-layer/what-is-tcp-ip/ Cloudflare: What is TCP/IP?]
 
* [https://www.tcpipguide.com/ TCP/IP Guide]
 
* [https://ubuntu.com/server/docs/security-firewall Ubuntu Documentation: Firewalls with ufw]
 
 
 
  
[[Category:Internet protocols]]
+
[[Category:Guides]]
[[Category:Network protocols]]
+
[[Category:Information]]
[[Category:TCP/IP]]
 
[[Category:Computer networking]]
 
[[Category:System administration]]
 
[[Category:Linux software]]
 
[[Category:Technical terms]]
 

Latest revision as of 12:26, 2 June 2025

Internet Protocol Suite (TCP/IP)

The Internet Protocol Suite (often called TCP/IP) is the core set of network protocols that power the Internet and most computer networks. It dictates how data is packaged, sent, and received, allowing different systems to communicate. Named after its two main components, Transmission Control Protocol (TCP) and Internet Protocol (IP), it includes many other protocols essential to its function.

Overview

The TCP/IP suite uses a layered model, with each layer managing a specific part of network communication. This simplifies hardware and software design. The main layers are:

  • **Application Layer:** For direct application interaction (e.g., HTTP, FTP, DNS).
  • **Transport Layer:** Manages data transfer between applications (e.g., TCP, UDP).
  • **Internet Layer:** Handles addressing and routing (e.g., IP).
  • **Link Layer:** For physical network interface and transmission (e.g., Ethernet, Wi-Fi).

Data moves down the layers when sending and up when receiving.

Key Protocols: TCP and UDP

Within the TCP/IP suite, two major protocols operate at the Transport Layer, providing different services to applications:

Transmission Control Protocol (TCP)
A reliable, connection-oriented protocol ensuring ordered and error-checked data delivery. It sets up a connection, retransmits lost data, and manages flow, making it slower but guaranteeing integrity.
User Datagram Protocol (UDP)
A faster, connectionless protocol that sends data without guarantees of delivery or order. It has less overhead than TCP, making it suitable for applications prioritizing speed over reliability.

TCP vs. UDP Comparison

Comparison of TCP and UDP
Feature TCP UDP
Protocol Type Connection-oriented (requires handshake) Connectionless (sends datagrams directly)
Reliability / Delivery Guarantee Reliable (guarantees data arrives, retransmits lost packets) Unreliable (no guarantee of delivery or retransmission)
Order of Delivery Guaranteed (packets delivered in the order sent) Not Guaranteed (packets may arrive out of order or not at all)
Speed / Overhead Slower (higher overhead for connection management, error checking, etc.) Faster (lower overhead)
Use Cases (General) Applications requiring reliable, ordered data: Web Browse (HTTP/S), Email (SMTP, POP3, IMAP), File Transfer (FTP, SFTP), Secure Shell (SSH). Applications requiring speed over reliability: Streaming (video/audio), Online gaming, DNS, Voice over IP (VoIP).
Uses on Personal Computers Most internet traffic (Browse, email, downloading, secure remote access). Streaming services, voice/video calls, some games, background system services (like DNS lookups).
Uses on Seedbox/Servers Hosting websites (HTTP/S), Email servers (SMTP, IMAP, POP3), File transfer servers (FTP, SFTP), SSH access, Most torrent client peer connections. DNS servers, some monitoring services, certain peer-to-peer protocols like uTP (used by some torrent clients) or DHT, some game servers.

What TCP is Used For

TCP is used when reliable, ordered data delivery is critical. It handles lost or out-of-order packets, ensuring data arrives as sent. This makes it ideal for:

  • Loading web pages (HTTP/S).
  • Sending/receiving emails (SMTP, POP3, IMAP).
  • Accurate file transfers (FTP, SFTP).
  • Secure remote access (SSH).
  • Database connections.

How Pulsed Media Uses TCP/IP

Pulsed Media's services—including seedboxes, VPS, and Dedicated Servers—**fundamentally rely on the TCP/IP suite** for all network communication, as does virtually all modern internet traffic.

Specific uses include:

  • **Client Access:** Connecting to your seedbox or server via SSH, SFTP, or web-based GUIs (all use TCP/IP).
  • **Torrenting:** Core data transfers between peers typically use **TCP**. While some BitTorrent components (like DHT or uTP) use UDP, high-performance seedboxes often prioritize robust TCP connections for main data transfers.
  • **Hosting Services:** VPS and dedicated servers use TCP/IP extensively for web hosting (HTTP/S), email (SMTP/IMAP/POP3), and other services.

Essentially, all data transfer to or from a Pulsed Media service over the internet depends on the correct functioning of the TCP/IP stack.

Tutorial: Opening TCP Ports on Linux (Debian) Server

To allow external network traffic to reach a specific service running on a TCP port on your Linux server, you need to configure the server's firewall to permit incoming connections to that port. This tutorial uses `ufw` (Uncomplicated Firewall), a user-friendly front-end for `nftables` or `iptables`, common on Debian-based systems like Ubuntu.

Prerequisites:

Steps:

  1. Check ufw status (optional):

Verify that the firewall is active. If it's inactive, you'll need to enable it later.

 sudo ufw status verbose  


  1. Allow a specific TCP port:'

Use the `ufw allow` command followed by the port number and `/tcp`. Replace `port_number` with the actual port the service listens on.

 sudo ufw allow 80/tcp  # Example: Allow HTTP traffic
 sudo ufw allow 443/tcp # Example: Allow HTTPS traffic
 sudo ufw allow 22/tcp  # Example: Allow SSH traffic (essential if connecting remotely)
 sudo ufw allow 8080/tcp # Example: Allow traffic on a custom port


  1. Allow a service by name (if defined in ufw):

`ufw` has predefined rules for some common services (listed in `/etc/services`). You can use the service name instead of the port number.

 sudo ufw allow http  
 sudo ufw allow https  
 sudo ufw allow ssh  


  1. Allow a port/service from a specific IP address or network range (more secure):

To restrict access to a port to only specific source IPs.

 sudo ufw allow from 203.0.113.100 to any port 22 proto tcp # Allow SSH only from 203.0.113.100
 sudo ufw allow from 192.168.1.0/24 to any port 8080 proto tcp # Allow port 8080 from local network 192.168.1.0/24


  1. Reload ufw to apply changes (if it was already active):

If `ufw status verbose` showed `Status: active`, reload to apply your new rules.

 sudo ufw reload  


  1. Enable ufw (if it was inactive):

If `ufw status verbose` showed `Status: inactive`, enable it. **WARNING:** Ensure you have allowed SSH (port 22) *before* enabling if connecting remotely via SSH, otherwise you will be locked out.

 sudo ufw enable  

Confirm the action when prompted.

  1. Verify the new rules:

Check the status again to see your newly added rules.

 sudo ufw status verbose  


Remember to only open the ports necessary for the services you intend to run and make accessible from the network.

Note on NAT/Port Forwarding: If your server is behind a router performing NAT and you want to access a service from the public internet, you will also need to configure Port forwarding on the router to direct incoming traffic from a public IP and port to your server's private IP and the service's TCP port.

See Also