TL;DR
This guide shows you how to set up an upstream server for Bettercap’s TCP proxy, allowing it to forward traffic through a specified host. This is useful for tunnelling traffic or using Bettercap with remote servers.
Setting Up the Upstream Server
- Understand the Concept: Bettercap’s TCP proxy normally intercepts and handles connections locally. An upstream server lets you send that intercepted traffic to another host (your chosen server) for further processing or routing.
- Configure Bettercap: You’ll use Bettercap’s
proxy.upstreamoption to define the server address and port.bettercap -cfg proxy.upstream 192.168.1.100:8080Replace
192.168.1.100:8080with the actual IP address and port of your upstream server. - Start Bettercap in Proxy Mode: Launch Bettercap with the TCP proxy enabled.
bettercap -proxy on - Verify Traffic Forwarding:
- Connect to a website or service while Bettercap is running.
- On your upstream server, check if you’re receiving the forwarded traffic (e.g., using
netstat,tcpdump, or your server’s logging).
Advanced Configuration
- Using a Different Interface: If you want Bettercap to listen on a specific network interface for proxy connections:
bettercap -iface eth0 -proxy onReplace
eth0with your desired interface. - Specifying the Upstream Server in a Config File: Edit Bettercap’s configuration file (usually located at
~/.config/bettercap/bettercap.conf) and add or modify the following line:proxy.upstream = 192.168.1.100:8080 - Handling HTTPS Traffic: Bettercap can proxy HTTPS traffic, but you’ll need to configure it correctly.
- Ensure your upstream server is capable of handling SSL/TLS connections (e.g., using a reverse proxy like Nginx or Apache).
- Consider using the
proxy.ssloption in Bettercap if needed, but be aware of potential certificate issues and man-in-the-middle risks.
Troubleshooting
- Connection Refused: Check that your upstream server is running and listening on the specified port. Also, ensure there are no firewalls blocking the connection between Bettercap and the server.
- Traffic Not Forwarded: Verify that Bettercap is correctly intercepting traffic (using
netstator packet capture tools). Check your upstream server logs for any errors. - SSL/TLS Errors: If you’re proxying HTTPS traffic, ensure your upstream server has a valid SSL certificate and that Bettercap is configured to handle it properly.

