LinuxWeb Servers

How to set up an Ubuntu Dante SOCKS5 Proxy Server

Proxy servers have been around for years. A proxy server is a way of connecting to a website or service via another server. In this guide, we are going to use a KVM NVMe VPS to set up a Dante SOCKS5 Proxy server on Linux Ubuntu.

If you need a proxy with different IPs in different countries just order the IPs from your client area (Services > View Addons). You can attach a maximum of 64 IPs per Server.

There are many types of Proxy servers. HTTP proxy servers like Squid used to be very popular. This was before the internet changed to HTTPS. Mainly because of the introduction of free SSL certificates from institutions like Let’s Encrypt.

SOCKS Proxy servers forward TCP packets. They also allow UDP packets to be forwarded. You can optionally secure the server with authentication. This means anyone who wants to connect to the proxy will need to log in. The default port Dante listens on is port 1080. We are going to use a custom port on our Proxy server.

Dante Proxy Server Resources

You do not need a large server to run a Linux Proxy server. 5GB of space, 1GB RAM, and some v-swap would be suitable. You will likely need unlimited Bandwidth. You can add an unlimited bandwidth add-on to any of our NVMe VPS Servers for £10.

We are going to install our Proxy software to an Ubuntu 18VPS but this guide will work for other versions of Ubuntu like Ubuntu 16, Ubuntu 19 and Ubuntu 20.

Update Your Ubuntu Server

Before starting ensure your server is running the latest updates.

apt update
apt upgrade

Install Ubuntu Dante Proxy Server

apt install dante-server

Dante Proxy is now installed on your server. In the console, you will notice it’s not running and you might even see an error. Next, let’s configure Dante.

Configure Dante on Ubuntu

The configuration file for Dante is located at /etc/danted.conf. You can use the configuration file we have generated below so move the old file out of the way first

mv /etc/danted.conf /etc/danted-org.conf

now, create a new danted.conf file and paste the below configuration into the file.

nano /etc/danted.conf
internal: 176.xx.xx.xxx port = 1439
external: 176.xx.xx.xxx


clientmethod: none
socksmethod: none
user.privileged: root
user.notprivileged: nobody
external.rotation: same-same
logoutput: /var/log/socks.log

client pass {
        from: xx.xxx.xxx.xxx/32 to: 0.0.0.0/0
        log: error connect disconnect
}
client block {
        from: 0.0.0.0/0 to: 0.0.0.0/0
        log: connect error
}
socks pass {
        from: 0.0.0.0/0 to: 0.0.0.0/0
        log: error connect disconnect
}
socks block {
        from: 0.0.0.0/0 to: 0.0.0.0/0
        log: connect error
}

Edit Dante Proxy Server Configuration

Now, edit the below sections in the Dante configuration file.

internal: 176.xx.xx.xxx port = 1439
external: 176.xx.xx.xxx

Replace the IP in this section with the main IP of your Proxy server. If you have additional IPs routed to your server, just add more sections for each IP like the below example;

internal: 176.xx.xx.xxx port = 1439
external: 176.xx.xx.xxx

internal: 178.xx.xx.xxx port = 1439
external: 178.xx.xx.xxx

internal: 179.xx.xx.xxx port = 1439
external: 179.xx.xx.xxx

Restrict Access To The SOCKS5 Proxy Server

Access from specific IP

There are several ways you can restrict access to the proxy server. To restrict access to certain IPs edit the section below. Enter the IP you wish to allow access from.;

client pass {
        from: xx.xxx.xxx.xxx/32 to: 0.0.0.0/0
        log: error connect disconnect
}

If you wanted to allow access to a range of IPs like a /29 subnet you would edit the file like the below example;

client pass {
        from: xx.xxx.xxx.xxx/29 to: 0.0.0.0/0
        log: error connect disconnect
}

That’s the basic configuration of your Proxy server sorted. If you wanted to restrict access to authorized log ins this is possible but we are not going to cover that in this article.

Restart Dante

Finally, to start using your Proxy let’s restart and enable Dante on boot.

systemctl restart danted
systemctl enable danted

Conclusion

You now have a working SOCKS 5 proxy, restricted to certain IPs. If you are using one of our EU NVMe VPS Servers it’s possible to route different IPs in different countries to your VPS. This is great for proxies because each IP shows as being in a different country when in fact they are all

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button