• November 15, 2024

Ubuntu Socks5 Proxy

How to setup a Socks5 Proxy server on Ubuntu with Dante

How to setup a Socks5 Proxy server on Ubuntu with Dante

Dante Socks5 Server
Dante is a socks5 server that you can use to setup a socks5 proxy on your ubuntu or debian machine. In this quick tutorial we shall learn how to setup dante and use authentication.
With authentication enabled, the dante proxy server would require all clients to provide login details in order to use the proxy server. This is a good idea.
1. Install Dante on Ubuntu
The default Ubuntu repositories have the dante-server package but it is outdated. The version present is 1. 1. 19 which is quite old and also has some bugs. The authentication feature does not work properly.
If you don’t need authentication then you can install it.
sudo apt-get install dante-server
The version in repository was
# danted -v
danted: dante v1. 19
Known authentication issues
Like mentioned earlier, the authentication feature does not properly work with it. The log file shows the following error messages –
Mar 11 14:05:05 (1489241105) danted[5020]: pass(1): tcp/accept]: username%[email protected] -> 104. 131. 115. 128. 1080: system username/password failed
Trying to test with curl shows the following error message –
$ curl -v -x socks5username:[email protected]:1080 * Trying 104. 128…
* User was rejected by the SOCKS5 server (1 1).
* Closing connection 0
curl: (7) User was rejected by the SOCKS5 server (1 1).
Some users have reported similar issues at this reddit post -Install newer version directly from file
So we need to install a newer version. There is a ppa for dante-server at –
but it is no longer being maintained. But we can use the deb file from the ppa to install dante on Ubuntu 16. 10
The download url is this:
using the wget command:
# wget Install using gdebi command:
$ sudo apt-get install gdebi-core
$ sudo gdebi
2. Configure
The next task is to configure the dante server before starting it. The configuration file can be found here –
nano /etc/
The contents should look similar to this –
# /etc/
logoutput: syslog
ivileged: root
user. unprivileged: nobody
# The listening network interface or address.
internal: 0. 0. 0 port=1080
# The proxying network interface or address.
external: eth0
# socks-rules determine what is proxied through the external interface.
# The default of “none” permits anonymous access.
socksmethod: username
# client-rules determine who can connect to the internal interface.
clientmethod: none
client pass {
from: 0. 0/0 to: 0. 0/0
log: connect disconnect error}
socks pass {
Now start the danted proxy server
# service danted start
Use the netstat command to check the port number
# netstat -nlpt | grep dant
tcp 0 0 0. 0:1080 0. 0:* LISTEN 6342/danted
3. Create a User
Dante can use the system unix user accounts to authenticate the connecting clients. For this you should create a separate user. Any client that will be connecting to this proxy server will be sending the password in plain text over the network, so beware of that.
$ adduser mike
4. Test with curl
Once you have setup everything, its time to test that the proxy server is working as expected. Use the curl command to do this. Specify the username, password, server ip and port number and try fetching some url.
curl -v -x socks5mike:[email protected]:1080 If everything goes fine, you should see the html of in the terminal. Now you can use the proxy inside of browsers.
Conclusion
Dante is a socks5 server that can be used as a proxy server. For instance you can setup an online linux server and use it as a proxy server to access other websites. Such proxy servers are useful when you need to change your ip address on the internet or access a website from a different geo location.
If you need an proxy server or caching solution try Squid Proxy which supports, etc.
Resources
Config documentation can be found here –
If you want to compile the latest version of dante from source then check out these links –
connect over SOCKS4/5 proxy - Ubuntu Manpage

connect over SOCKS4/5 proxy – Ubuntu Manpage

Provided by: connect-proxy_1. 105-1_amd64 NAME connect-proxy — connect over SOCKS4/5 proxy
SYNOPSIS connect-proxy [-dnhst45] [-R resolve] [-p local-port] [-w secs] [-H [user@]proxy-
server[:port]]] [-S [user@]socks-server[:port]]] [-T proxy-server[:port]] [-c
telnet-proxy-command] [host] [port]
DESCRIPTION connect-proxy open connection over SOCKS4/5 proxies
Please, note that any HTTP-Proxy tunnel won’t work with content-inspection firewall
(unless using SSL).
OPTIONS -H specifies a hostname and port number of the proxy server to relay. If port
is omitted, 80 is used. You can specify this value in the environment variable
HTTP_PROXY and pass the -h option to use it.
-S specifies the hostname and port number of the SOCKS server to relay. Like -H,
port number can be omitted and the default is 1080. You can also specify this
value pair in the environment variable SOCKS5_SERVER and give the -s option to
use it.
-4 specifies SOCKS relaying and indicates protocol version to use. It is valid
only when used with ‘-s’ or ‘-S’. Default is ‘-5’ (protocol version 5)
-R method to resolve the hostname. Three keywords (“local”, “remote”, “both”) or
dot-notation IP address are acceptable. The keyword “both” means, “Try local
first, then remote”. If a dot-notation IP address is specified, use this host as
nameserver. The default is “remote” for SOCKS5 or “local” for others. On SOCKS4
protocol, remote resolving method (“remote” and “both”) requires protocol 4a
supported server.
-p will forward a local TCP port instead of using the standard input and output.
-P same to ‘-p’ except keep remote session. The program repeats waiting the port
with holding remote session without disconnecting. To connect the remote
session, send EOF to stdin or kill the program.
-w timeout in seconds for making connection with TARGET host.
-d used for debug. If you fail to connect, use this and check request to and
response from server.
USAGE To use proxy, this example is for SOCKS5 connection to connect to “host” at port 25 via
SOCKS5 server on “firewall” host.
connect-proxy -S firewall host 25
SOCKS5_SERVER=firewall; export SOCKS5_SERVER; connect-proxy -s host 25
For a HTTP-PROXY connection:
connect-proxy -H proxy-server:8080 host 25
HTTP_PROXY=proxy-server:8080; export HTTP_PROXY; connect-proxy -h host 25
To forward a local port, for example to use ssh:
connect-proxy -p 5550 -H proxy-server:8080 host 22 ssh -l user
To use it along ssh transparently:
# file~/
# not using proxy on lan
Host 192. *
ProxyCommand connect-proxy%h%p
# mandatory to access the internet
Host *
ProxyCommand connect-proxy -H proxyserver:8080%h%p
Or for all users ( /etc/ssh/ssh_config)
ENVIRONMENT SOCKS5_USER, SOCKS5_PASSWORD, HTTP_PROXY_USER, HTTP_PROXY_PASSWORD, CONNECT_PASSWORD,
LOGNAME, USER
SEE ALSO ssh (1).
WWW
AUTHOR This manual page was written by Philippe Coval for the Debian system (but may
be used by others). Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU General Public License, Version 2 any later version published
by the Free Software Foundation.
On Debian systems, the complete text of the GNU General Public License can be found in
/usr/share/common-licenses/GPL.
CONNECT-PROXY(1)
How to set up a SOCKS5 Proxy Server Using Dante - Ubuntu

How to set up a SOCKS5 Proxy Server Using Dante – Ubuntu

Set up a 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 SOCKS5 Proxy server using Dante and Ubuntu.
If you need a proxy with different IPs in different country’s 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.
Proxy Server Resources
You do not need a large server to run a Proxy service. 5GB of space, 1GB Ram, and some v-swap would be suitable. It’s likely you will 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 Dante Proxy Server
apt install dante-server
Dante Proxy is now installed to 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
The configuration file for Dante is located at /etc/ You can use the configuration file we have generated below so move the old file out of the way first
mv /etc/ /etc/
now, create a new file and paste the below configuration into the file.
nano /etc/
internal: port = 1439
external:
clientmethod: none
socksmethod: none
ivileged: root
tprivileged: nobody
tation: same-same
logoutput: /var/log/
client pass {
from: to: 0. 0. 0/0
log: error connect disconnect}
client block {
from: 0. 0/0 to: 0. 0/0
log: connect error}
socks pass {
socks block {
Edit Dante Configuration
Now, edit the below sections in the Dante configuration file.
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;
Restrict Access To The Proxy Server
Access from specific IP
There are a number of 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. ;
If you wanted to allow access to a range of IPs like a /29 subnet you would edit the file like the below example;
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 working off the same server.
How was this article? – set up a SOCKS5 Proxy Server
Post Views:
16, 952
You might also like
More from Dedicated Servers
How To Set Up SSH Keys To Allow Access To Instances
We’re helping customers to increase the security of their F2H …
How To Add Bootsplash Image To Your OS Template
Instead of the default black screen. When creating an OS template you can choose to add a bootsplash image to …
How To Run Scripts At Startup
Sometimes it might be required to run scripts at startup. This is useful if you want to automate tasks like …
Editor Picks

Frequently Asked Questions about ubuntu socks5 proxy

Leave a Reply

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