GCP VM SOCK5
Setting up a GCP (Google Cloud Platform) Free Tier VM as a proxy for your Kali Linux machine is an excellent way to route traffic through a clean, cloud-based IP.
To achieve this, you will use SSH Dynamic Port Forwarding, which turns your SSH connection into a SOCKS5 proxy.
1. Create and Prepare your GCP VM
-
Instance Type: Use an
e2-microinstance (available in specific US regions likeus-central1,us-east1, orus-west1for the Free Tier). -
Operating System: Standard Debian or Ubuntu is fine.
-
Firewall: Ensure the Default-allow-ssh rule is active. You do not need to open any web ports (80/443) on GCP because all traffic will travel through the encrypted SSH tunnel (Port 22).
2. Establish the SSH Dynamic Tunnel
On your Kali Linux terminal, run the following command to create the tunnel. This command tells your local machine to listen on a specific port and forward everything to the GCP VM.
Bash
Breakdown of the flags:
-
-D 9050: Sets up Dynamic port forwarding on local port9050. -
-C: Compresses data (improves speed for web traffic). -
-N: Tells SSH not to execute a remote command (you won't get a shell prompt, it just holds the tunnel open). -
-f: Sends the process to the background.
Note: If you are using the
gcloudCLI, the command is:
gcloud compute ssh [INSTANCE_NAME] -- -D 9050 -N
3. Configure FoxyProxy in Kali (Firefox/Chrome)
Now that your local port 9050 is a gateway to GCP, you need to tell your browser to use it.
-
Open FoxyProxy and click Options.
-
Click Add to create a new proxy profile.
-
Proxy Details:
-
Proxy Type: Select SOCKS5.
-
IP Address / Hostname:
127.0.0.1(orlocalhost). -
Port:
9050.
-
-
Important: Check the box for "Proxy DNS" (or "Remote DNS"). This ensures your DNS queries go through GCP as well, preventing "DNS leakage" where your ISP could still see what sites you are visiting.
-
Save the profile and select it from the FoxyProxy extension icon.
4. Route System-Wide Traffic (Optional)
If you want all Kali traffic (like nmap, curl, or apt) to go through the GCP VM and not just the browser, use ProxyChains.
-
Open the config:
sudo nano /etc/proxychains4.conf -
Scroll to the bottom (under
[ProxyList]) and add:Plaintext
-
Now you can run any tool through the proxy by prefixing it:
proxychains nmap -sT -PN [target-ip]
Verification
To confirm it's working, visit icanhazip.com in your browser. It should display your GCP VM's external IP instead of your actual home IP.
Would you like me to show you how to automate this connection so it starts every time you boot your Kali machine?