Docs / Networking / Advanced SSH Tunneling and Port Forwarding

Advanced SSH Tunneling and Port Forwarding

By Admin · Mar 20, 2026 · Updated Apr 23, 2026 · 4 views · 2 min read

This guide covers how to set up and configure ssh on a Linux VPS. Whether you're running a production environment or a development setup, these instructions will help you get started quickly and securely.

Prerequisites

  • Access to server network configuration
  • A VPS running Ubuntu 22.04 or later (2GB+ RAM recommended)
  • Understanding of TCP/IP fundamentals

Network Configuration

The ssh configuration requires careful attention to resource limits and security settings. On a VPS with limited resources, it's important to tune these parameters according to your available RAM and CPU cores.


# Network configuration and testing
ip addr show                   # View interfaces
ip route show                  # View routing table
ss -tlnp                       # View listening ports

# Firewall rules
sudo iptables -L -n -v         # List current rules
sudo ufw status verbose        # UFW status

This configuration provides a good balance between performance and resource usage. For high-traffic scenarios, you may need to increase the limits further.

  • Implement caching at every appropriate layer
  • Start with the minimum required resources
  • Scale vertically before scaling horizontally
  • Use connection pooling for database connections

Firewall Rules Setup

After applying these changes, monitor the server's resource usage for at least 24 hours to ensure stability. Tools like htop, iostat, and vmstat can provide real-time insights into system performance.


# Configure network interface
sudo nano /etc/netplan/01-netcfg.yaml

network:
  version: 2
  ethernets:
    eth0:
      addresses:
        - 192.168.1.10/24
      routes:
        - to: default
          via: 192.168.1.1
      nameservers:
        addresses:
          - 8.8.8.8
          - 1.1.1.1

sudo netplan apply

Note that file paths may vary depending on your Linux distribution. The examples here are for Debian/Ubuntu; adjust paths accordingly for RHEL/CentOS-based systems.

Common Issues and Solutions

  • Slow performance: Check for disk I/O bottlenecks with iostat -x 1 and network issues with mtr. Review application logs for slow queries or requests.
  • Service won't start: Check the logs with journalctl -xe -u ssh. Common causes include port conflicts, missing configuration files, or insufficient permissions.
  • High memory usage: Review the configuration for memory-related settings. Reduce worker counts or buffer sizes if running on a low-RAM VPS.

Wrapping Up

Following this guide, your ssh setup should be production-ready. Keep an eye on resource usage as your traffic grows and don't forget to test your backup and recovery procedures periodically.

Was this article helpful?