Setting up a Socks5 proxy server in Ubuntu
Hey! Hi everyone, I'm here today to share with you how to set up a Socks5 proxy server in Ubuntu, which I believe will be very useful for those who wish to protect their privacy or bypass blockades through a proxy server.
What is Socks5 proxy server?
Before we start, let's understand what is Socks5 Proxy Server.Socks5 Proxy Server is a network proxy service that enables forwarding and translation of network connections at the application layer. With Socks5 proxy server, you can hide your real IP address and protect your privacy.
Installing and Configuring Dante Services
First, we need to install and configure the Dante service to act as our Socks5 proxy server. Open a terminal and enter the following command to install the Dante service:
“`
sudo apt-get update
sudo apt-get install dante-server
“`
Once the installation is complete, we need to configure the Dante service. Enter the following command to edit the configuration file:
“`
sudo nano /etc/danted.conf
“`
In the configuration file that opens, find the following lines to configure the basic settings of the server:
“`
internal: eth0 port = 1080
external: eth0
“`
Replace "eth0" with your network interface, if you are not sure, you can use the following command to check the available network interfaces:
“`
ifconfig
“`
Next, add the following line to the end of the configuration file to set the range of IP addresses allowed to access the proxy server:
“`
# Example: allow access from IP range 192.168.0.0/16
allow {
ip = 192.168.0.0/16
# You can add multiple IP ranges here
}
“`
You can add as many IP address ranges as you need.
Configuring Authentication
If you want to authenticate users accessing the proxy server, you can continue with the following settings in the configuration file:
“`
# Example: authenticate users with username and password
method: username none
user.privileged: root
user.libwrap: nobody
client pass {
from: 0.0.0.0/0 to: 0.0.0.0/0
log: error # Connect log error only
}
# Example: allow access for specific users
client pass {
from: 192.168.0.0/16 to: 0.0.0.0/0
log: connect error # Log everything for those users
}
“`
In this example, we configured the authentication method of username and password and specified a specific IP address range.
Starting a proxy server
Now that we have finished configuring the proxy server, we just need to start the service and check that it is running properly. Enter the following command to start the Dante service:
“`
sudo service danted start
“`
If all goes well, you should see a message like "[ ok ] Starting Dante SOCKS daemon: danted.". To verify that the proxy server is running properly, you can use the following command:
“`
sudo service danted status
“`
If the proxy server is running, you will see a message similar to "[ + ] danted is running.".
Setting up an agent in an application
The last step is to set up the proxy in your application. Here is an example of Firefox browser, open Firefox and type in the address bar:
“`
about:preferences#network
“`
In the "Network Settings" page, find the "Proxy Settings" section, select "Manual Proxy Configuration", and then enter your proxy server address and port (default port is 1080) in the "SOCKS Host" field. In the "SOCKS Host" field, enter your proxy server address and port (the default port is 1080), and finally click "OK" to save the settings.