IP & Ports

IP & Ports

What is protocol ?
Think of a protocol like a set of agreed-upon rules for a conversation between two people. Imagine you and a friend are trying to communicate, but you don’t speak the same language. To make sure the conversation goes smoothly, you both decide to follow certain rules—like using hand signals, speaking slowly, or writing down words. These "rules" help both of you understand each other, even though you're different people.

In the world of computers and networks, devices (like your phone, laptop, or a server) need to communicate with each other too, but they also need to follow specific "rules" to make sure the data (like messages, files, or websites) gets to the right place and is understood correctly. This is where protocols come in—they’re the set of rules that define how data should be sent, received, and interpreted between devices.

For example:

  • When you visit a website, there’s a protocol (called HTTP) that tells your device how to ask for a web page and how the server should respond with the page.

  • When sending an email, there's a protocol (called SMTP) that makes sure the email gets delivered to the correct recipient.

So, a protocol is just a set of instructions that ensures everything works smoothly when computers or devices talk to each other. Without these rules, the conversation would be confusing and might not happen at all!

In networking, several protocols are commonly used to facilitate communication between devices, but I'll focus on a few that are particularly relevant in DevOps workflows. Here are some of the most widely used protocols in networking and how they relate to DevOps:

1. HTTP/HTTPS (HyperText Transfer Protocol / HyperText Transfer Protocol Secure)

  • Purpose: HTTP is the foundation of any data exchange on the web, and HTTPS is the secure version of HTTP. These protocols are used to request and transfer web pages, files, APIs, and other resources.

  • Relevance in DevOps:

    • Web services: HTTP/HTTPS is essential for DevOps workflows that involve microservices or APIs. Continuous integration/continuous deployment (CI/CD) pipelines often rely on HTTP to test APIs, deploy services, or interact with cloud platforms.

    • Automated Testing: DevOps teams use HTTP/HTTPS to test endpoints or integrate third-party services during deployment or build phases.

    • Security: HTTPS ensures encrypted communication, which is vital when handling sensitive data, especially when deploying applications to production.

HTTP Full Form - Hypertext Transfer Protocol - GeeksforGeeks

Here we can see that how http/https works in the above image shared by GeeksforGeeks

2. SSH (Secure Shell)

  • Purpose: SSH is a cryptographic network protocol for securing remote access to systems, allowing secure login and execution of commands.

  • Relevance in DevOps:

    • Remote management: DevOps engineers use SSH to securely log into servers, configure systems, and deploy code remotely, especially when working with infrastructure-as-code tools (like Ansible or Terraform).

    • Automation: Automated deployment scripts or CI/CD tools often use SSH to access and manage servers, ensuring a secure method of interaction with environments, particularly when accessing remote machines in cloud or on-premises environments.

What is SSH Protocol? How does it work?

DNS (Domain Name System)

  • Purpose: DNS translates domain names (like example.com) into IP addresses. It acts as a directory that allows the web to function.

  • Relevance in DevOps:

    • Service Discovery: In microservices architecture, DNS helps resolve the addresses of various services dynamically. Tools like Kubernetes use DNS for service discovery.

    • Load Balancing: DNS is also used in load balancing strategies, distributing traffic across multiple servers to ensure high availability and scalability.

Lightbox

How Does DNS Works?

ThisThis diagram appears to be a "Use Case Diagram" based on the information provided by GeeksforGeeks

FTP/SFTP (File Transfer Protocol / Secure FTP) :

  • Purpose: FTP is used to transfer files between systems, while SFTP is a secure version that encrypts data during transfer.

  • Relevance in DevOps:

    • File deployment: SFTP is often used in DevOps workflows to securely upload or download files, deploy updates to servers, or move files between different environments.

    • Backup and Sync: FTP/SFTP is also used to synchronize files across distributed systems, ensuring that the latest versions of files are always available in development, staging, and production environments.

File Transfer Protocol (FTP) in Application Layer - GeeksforGeeks

ThisThis diagram appears to be a "Use Case Diagram" based on the information provided by GeeksforGeeks

SMTP (Simple Mail Transfer Protocol) :

  • Purpose: SMTP is used for sending email messages between servers.

  • Relevance in DevOps:

    • Alerting: DevOps teams often use SMTP to configure alerts or notifications for system failures, deployment status, or CI/CD pipeline results.

    • Monitoring and Logging: SMTP can be integrated with monitoring tools to send email notifications if performance thresholds are exceeded, or if critical system issues are detected.

Simple Mail Transfer Protocol (SMTP) - GeeksforGeeks

ThisThis diagram appears to be a "Use Case Diagram" based on the information provided by GeeksforGeeks

TCP (Transmission Control Protocol) :

TCP is a connection-oriented protocol that ensures reliable data transmission between systems. It establishes a connection before data transfer and guarantees that all packets arrive in the correct order.

Relevance in DevOps :

  • CI/CD Pipelines:

    • TCP ensures reliable delivery of software artifacts between repositories, build servers, and deployment environments.

    • Example: Secure data transfer in Jenkins, Git, and Docker registries.

  • Infrastructure as Code (IaC):

    • Tools like Terraform and Ansible often rely on TCP to communicate securely with cloud providers (AWS, Azure, GCP).
  • Remote Server Management:

    • SSH (Secure Shell), which uses TCP, is essential for securely accessing and managing remote servers.
  • Monitoring & Logging:

    • Prometheus, ELK Stack, and other monitoring tools use TCP to reliably send logs and metrics between nodes.

What is TCP (Transmission Control Protocol)? - GeeksforGeeks

ThisThis diagram appears to be a "Use Case Diagram" based on the information provided by GeeksforGeeks

UDP (User Datagram Protocol) :

UDP is a connectionless protocol that prioritizes speed over reliability. It does not establish a connection or confirm packet delivery, making it ideal for applications where low latency is more important than accuracy.

Relevance in DevOps :

  1. Container Orchestration & Service Discovery:

    • Kubernetes DNS resolution often relies on UDP for fast lookups.

    • Consul and Etcd (service discovery tools) use UDP for lightweight communication.

  2. Log Forwarding & Monitoring:

    • Syslog (a standard for logging system messages) often uses UDP for fast, real-time logging.

    • Datadog and Grafana Loki can ingest UDP-based logs for real-time monitoring.

  3. High-Speed Communication in Microservices:

    • Certain microservices use gRPC over UDP to enable fast, low-latency messaging between services.
  4. Load Balancing & DNS Resolution:

    • DNS queries, crucial for resolving domain names in cloud environments, use UDP for quick responses.

    • Load balancers like NGINX and HAProxy sometimes use UDP for fast traffic routing.

User Datagram Protocol (UDP) - GeeksforGeeks

ThisThis diagram appears to be a "Use Case Diagram" based on the information provided by GeeksforGeeks

Key Differences: TCP vs UDP in DevOps

FeatureTCP (Transmission Control Protocol)UDP (User Datagram Protocol)
ReliabilityReliable, ensures data arrives correctlyUnreliable, no guarantee of delivery
ConnectionConnection-oriented (handshake required)Connectionless (no handshake)
SpeedSlower due to error checkingFaster, lower latency
Use CasesCI/CD, SSH, Monitoring, File TransferDNS, Log Forwarding, Microservices, Streaming

Conclusion

  • Use TCP when reliability and data integrity are essential.

  • Use UDP when speed and low latency are more critical than guaranteed delivery.

Understanding Ports & Important Protocols in DevOps

A port is a communication endpoint used by networked applications to send and receive data. Each port is identified by a port number (0-65535), and specific protocols use well-known ports for standard communication.

Important Ports & Protocols in DevOps

PortProtocol/ServiceUsage in DevOps
22SSH (Secure Shell)Remote server access & automation (Ansible, Terraform, Jenkins).
80HTTPWeb traffic, API calls, and application monitoring.
443HTTPSSecure web traffic, API communication, cloud services.
3306MySQLDatabase management for applications & DevOps pipelines.
5432PostgreSQLCloud-based DBs (AWS RDS, GCP Cloud SQL).
6379RedisCaching in microservices & containerized applications.
9200ElasticsearchLog monitoring & search indexing (ELK stack).
10250Kubelet APIKubernetes node management & health checks.
5000Docker RegistryPrivate container image storage for CI/CD pipelines.
8080JenkinsCI/CD automation for software deployment.

Conclusion

  • Lower ports (0-1023) are well-known and reserved for system processes.

  • Higher ports (>1024) are used by applications and custom services.

  • DevOps engineers must configure firewall rules and security groups to allow necessary ports while blocking unnecessary ones for security.