VPS Hosting and ports : Episode 3

Table of Contents

VPS Hosting and ports : Episode 3

  • Drawing

Ports

root@atulya:~/frappe_docker# sudo netstat -tulnp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name    
tcp        0      0 127.0.0.1:5280          0.0.0.0:*               LISTEN      692956/lua          
tcp        0      0 0.0.0.0:5000            0.0.0.0:*               LISTEN      692956/lua          
tcp        0      0 127.0.0.1:3306          0.0.0.0:*               LISTEN      692928/mariadbd     
tcp        0      0 127.0.0.1:5432          0.0.0.0:*               LISTEN      692846/postgres     
tcp        0      0 0.0.0.0:443             0.0.0.0:*               LISTEN      760740/nginx: maste 
tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN      760740/nginx: maste 
tcp        0      0 193.203.163.151:3478    0.0.0.0:*               LISTEN      692805/turnserver   
tcp        0      0 193.203.163.151:3478    0.0.0.0:*               LISTEN      692805/turnserver   
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      692826/sshd: /usr/s 
tcp        0      0 127.0.0.54:53           0.0.0.0:*               LISTEN      692825/systemd-reso 
tcp        0      0 0.0.0.0:8080            0.0.0.0:*               LISTEN      694319/docker-proxy 
tcp        0      0 127.0.0.1:25            0.0.0.0:*               LISTEN      693229/exim4        
tcp        0      0 127.0.0.1:35333         0.0.0.0:*               LISTEN      691529/containerd   
tcp        0      0 0.0.0.0:5355            0.0.0.0:*               LISTEN      692825/systemd-reso 
tcp        0      0 0.0.0.0:5269            0.0.0.0:*               LISTEN      692956/lua          
tcp        0      0 127.0.0.53:53           0.0.0.0:*               LISTEN      692825/systemd-reso 
tcp        0      0 0.0.0.0:5281            0.0.0.0:*               LISTEN      692956/lua          
tcp        0      0 0.0.0.0:5222            0.0.0.0:*               LISTEN      692956/lua          
tcp6       0      0 :::5000                 :::*                    LISTEN      692956/lua          
tcp6       0      0 ::1:25                  :::*                    LISTEN      693229/exim4        
tcp6       0      0 :::22                   :::*                    LISTEN      692826/sshd: /usr/s 
tcp6       0      0 :::8080                 :::*                    LISTEN      694325/docker-proxy 
tcp6       0      0 ::1:5280                :::*                    LISTEN      692956/lua          
tcp6       0      0 :::5355                 :::*                    LISTEN      692825/systemd-reso 
tcp6       0      0 :::5269                 :::*                    LISTEN      692956/lua          
tcp6       0      0 :::5281                 :::*                    LISTEN      692956/lua          
tcp6       0      0 ::1:5432                :::*                    LISTEN      692846/postgres     
tcp6       0      0 2a02:4780:12:1c7b::3478 :::*                    LISTEN      692805/turnserver   
tcp6       0      0 2a02:4780:12:1c7b::3478 :::*                    LISTEN      692805/turnserver   
tcp6       0      0 :::5222                 :::*                    LISTEN      692956/lua          
udp        0      0 0.0.0.0:5355            0.0.0.0:*                           692825/systemd-reso 
udp        0      0 193.203.163.151:3478    0.0.0.0:*                           692805/turnserver   
udp        0      0 193.203.163.151:3478    0.0.0.0:*                           692805/turnserver   
udp        0      0 127.0.0.54:53           0.0.0.0:*                           692825/systemd-reso 
udp        0      0 127.0.0.53:53           0.0.0.0:*                           692825/systemd-reso 
udp6       0      0 :::5355                 :::*                                692825/systemd-reso 
udp6       0      0 2a02:4780:12:1c7b::3478 :::*                                692805/turnserver   
udp6       0      0 2a02:4780:12:1c7b::3478 :::*                                692805/turnserver   
root@atulya:~/frappe_docker# 

The Digital Kingdom: Ports & Protocols Adventure

A Journey Through the Network Realm

Welcome, brave traveler! You stand at the gates of the Digital Kingdom, where mysterious ports and powerful services guard the flow of data. Your mission is to explore this land, uncover its secrets, and understand who controls which gate (port).


πŸ—ΊοΈ Map of the Digital Kingdom

(A visual guide to the ports and their guardians)

🌐 The Great Gates (0.0.0.0 & ::: – Open to All)

These ports allow entry from anywhere in the realm!

PortGuardian (Service)Role in the Kingdom
80Nginx (Master)The Web Gatekeeper – Allows HTTP travelers into the land.
443Nginx (Master)The Royal SSL Gate – Encrypts all messages (HTTPS).
22OpenSSHThe Secure Tunnel – Only trusted knights (admins) may pass.
3478TURN ServerThe Ice Mage – Helps with WebRTC (video calls & gaming).
5000Lua (Mystic Script)A secret service – Possibly a custom app or API.
5222Lua (XMPP?)The Messenger’s Port – Used for chat (Jabber/XMPP).
5269Lua (XMPP Server?)The Messenger’s HQ – For server-to-server chat.
8080Docker ProxyThe Dockworker – A containerized service (possibly web).

🏰 The Inner Keep (127.0.0.1 & ::1 – Local Only)

These ports are locked inside the castle wallsβ€”only local services may enter.

PortGuardian (Service)Role in the Kingdom
3306MariaDBThe Royal Database – Stores all kingdom secrets.
5432PostgreSQLThe Second Database – Another vault of knowledge.
5280Lua (Admin?)A hidden control panel – Possibly Prosody (XMPP admin).
5281Lua (BOSH?)A web messenger gateway – For browser-based chat.
25Exim4The Postmaster – Handles emails in the kingdom.
53systemd-resolvedThe Name Resolver – Converts names to IPs (DNS).
35333containerdThe Docker Overseer – Manages containers.

🌌 The UDP Shadows (Stateless & Fast)

These are quick, connectionless messengersβ€”great for real-time tasks.

PortGuardian (Service)Role in the Kingdom
3478 (UDP)TURN ServerHelps with fast media streams (video/voice).
53 (UDP)systemd-resolvedDNS Queries – Quickly finds where domains live.
5355 (UDP)systemd-resolvedMulticast DNS – For local network discovery.

🎨 Diagram: The Digital Kingdom’s Network Fortress

  🌍 Internet Travelers
       β”‚
       β–Ό
  πŸ”“ Port 80 (HTTP)  πŸ”’ Port 443 (HTTPS)
       β”‚               β”‚
       β–Ό               β–Ό
  🏰 Nginx (Master)  πŸ” SSL Encryption
       β”‚
       β”œβ”€β”€β–Ά πŸ—ƒοΈ Docker (8080) β†’ Container Secrets
       β”œβ”€β”€β–Ά πŸ’¬ XMPP (5222, 5269) β†’ Messengers
       β”œβ”€β”€β–Ά 🧊 TURN (3478) β†’ Video Calls
       └──▢ οΏ½ SSH (22) β†’ Admin Access
            β”‚
            β–Ό
  🏯 Local Castle (127.0.0.1)
       β”œβ”€β”€πŸ“¦ MariaDB (3306) β†’ Royal Records
       β”œβ”€β”€πŸ“œ PostgreSQL (5432) β†’ More Records
       β”œβ”€β”€πŸ“¨ Exim4 (25) β†’ Messaging Pigeons (SMTP)
       β””β”€β”€πŸ” DNS (53) β†’ Address Book

πŸ” The Mystery of Lua (Ports 5000, 5222, 5269, 5280, 5281)

A mysterious Lua-powered service controls multiple ports. Clues suggest:

  • 5222 & 5269: Likely XMPP (Jabber chat) – Messengers delivering encrypted scrolls.
  • 5280 & 5281: Could be Prosody (XMPP admin & BOSH) for web chat.
  • 5000: Unknownβ€”possibly a custom API or internal tool.

Quest: Run sudo lsof -i :5000 to uncover more secrets!


βš”οΈ Battle Plan for Migration (Nginx vs. Apache)

Since Nginx (Master) already rules ports 80 & 443, you must:

  1. Redirect Apache’s forces to a new port (e.g., 8081).
  2. Configure Nginx to proxy requests to Apache.
  3. Retire Apache once all services swear loyalty to Nginx.

πŸ† Conclusion: You’ve Mapped the Kingdom!

Now you know:

  • Nginx guards the main gates (80/443).
  • MariaDB & PostgreSQL protect the royal archives.
  • XMPP (Lua) runs the messenger network.
  • Docker hides services in magical containers.

Your next quest: Decide if Nginx shall rule alone or keep Apache as a vassal!

πŸš€ Adventure awaits! πŸš€

Tags :