Business inquiries

[email protected]

Sales department

@bithosting_sales

Technical support

@bithosting_tech

🌐 Port Forwarding and NAT on VPS: How to Configure

Port forwarding and NAT (Network Address Translation) allow traffic to be redirected from one port or IP address to another. This is essential if you host multiple services on a single VPS, want to access an internal machine, or use your server as a gateway. This guide explains how to configure these functions on Linux and Windows servers.

🔁 What Are Port Forwarding and NAT?

🐧 Port Forwarding on Linux (via iptables)

Example: redirect external port 8080 to local port 80.

sudo iptables -t nat -A PREROUTING -p tcp --dport 8080 -j REDIRECT --to-port 80
  

To forward to another internal IP:

sudo iptables -t nat -A PREROUTING -p tcp --dport 2222 -j DNAT --to-destination 192.168.0.10:22
sudo iptables -A FORWARD -p tcp -d 192.168.0.10 --dport 22 -j ACCEPT
  

Enable IP forwarding:

echo 1 > /proc/sys/net/ipv4/ip_forward
  

💾 Saving iptables Rules

On Debian/Ubuntu:

sudo apt install iptables-persistent
sudo netfilter-persistent save
  

🪟 NAT and Port Forwarding on Windows Server

1. Install the Remote Access role → NAT via Server Manager.
2. Launch Routing and Remote Access (RRAS).
3. Configure the network interface as NAT-enabled.
4. Add a Port Redirection rule to forward traffic to the target IP/port.

⚠ Ensure the firewall allows the connection and the port isn’t already in use.

📌 Bit.Hosting Tips

← Back to Network section

If you're having trouble with NAT or port forwarding — contact Bit.Hosting support. We’ll help you set it up properly and securely. 🧩

BIT.HOSTING

Your path to perfection

Maximum Performance

Stable servers and modern hardware ensure fast and reliable operation of your services.

Ultimate Configuration Flexibility

Support for various OS and control panels lets you tailor your hosting environment to your exact needs.

Affordable Server Prices

We offer some of the most competitive and accessible prices on the market.

24/7 Customer Support

Our experts are here to assist you anytime — with advice, solutions, or technical help around the clock.