Using Raspberry Pi as proxy server?

Ahmed Al Banna

Regular Member
Joined
Apr 4, 2023
Messages
449
Reaction score
301
Does anyone know a working way to use RPI as a proxy server? I have a few laying around. I saw tutorial on Youtube in the past for squid, followed all instructions but it never worked. I asked my friend who is more experienced with Linux and he couldn't find anything wrong with install. After that I gave up and now want to give it another try. Does anyone know a currently working solution for using RPI as a proxy server? My goal is to put RPI at my friend / family houses and using their residential IP for my IM purposes.

Please share solution if you have one. Thanks in advance
 
This is a very interesting idea, unfortunately I don't have that kind of experience, although I do have some experience working with Raspberry Pi. I wonder if anyone has achieved success using Raspberry Pi in such a role.
 
You might try openVPN if you do not want to involve with technicalities. But - it is not proxy. A VPN. However you can use it as a VPN with a different country ip. Digital ocean will help.
 
Setting up a proxy is not that hard. Here's an example:
1. Install NodeJS on your RPI
2. Add and run this script

JavaScript:
var socks = require('socksv5');

var srv = socks.createServer(function(info, accept, deny) {
  accept();
});
srv.listen(1080, '0.0.0.0', function() {
  console.log('SOCKS server listening on port 1080');
});

srv.useAuth(socks.auth.None());

Then just make a curl request using your RPI's address:
Code:
curl -x socks5://<RPI_IP>:1080

PS. Install https://www.npmjs.com/package/socksv5 inside your Node project.
 
Setting up a proxy is not that hard. Here's an example:
1. Install NodeJS on your RPI
2. Add and run this script

JavaScript:
var socks = require('socksv5');

var srv = socks.createServer(function(info, accept, deny) {
  accept();
});
srv.listen(1080, '0.0.0.0', function() {
  console.log('SOCKS server listening on port 1080');
});

srv.useAuth(socks.auth.None());

Then just make a curl request using your RPI's address:
Code:
curl -x socks5://<RPI_IP>:1080

PS. Install this module inside your Node project.
thanks I'll share this with my developer to see what other things we need to do. I can simple things but for more technical stuff I'll seek guidance if I get stuck.
 
Multiple ways actually. If you need just HTTP/HTTPS proxies you can use squid proxy. And if you need socks4/5 proxies you will need to use 3proxy. There are still some more advance settings if you want to make but for just basic settings you can make simple config to incoming interface to accept the request and specify the outgoing interface as you. In some cases those can be same also. And the most important thing is you will need Public/Static IP assigned to the broadband connection otherwise you won't be able to access the proxy from outsode network (Your Home/Office)
 
VPN and proxies are different technically. I think he need proxies not VPN. But still there is good solution that can fullfill both requirements in single installation. He may install v2ray server. V2ray can create both VPN and proxy on same machine. It's also advanced
 
I think your problem is that your raspberry(debian linux actually) device DOES NOT have a public IP adress visible from the internet.
You need to obtain some intermediate sever (VPS for example) which has a static IP. You will use this VPS IP as a socks5/https server and the traffic will be forwarder to your raspberry.

Then you can try the following setup:
Install 3proxy (or squid or dante or any other proxy server) on raspberry that is listening on port XXXX(for ex.)
Install openvpn client on raspberry
Install openvpn server on the VPS with public IP
Connect your raspberry to VPS using openvpn
Add routes on VPS using iptables to forward all traffic coming to VPS public address:XXXX -> to internal vpn ip address of your raspberry:XXXX
And don't forget to add reverse postrouting )
 
Back
Top