In today's Internet environment, it is especially important to protect privacy and improve network security. socks5 proxy, as a common proxy protocol, can help us better hide the real IP address and improve the security of network access. This article will detail how to set up a Socks5 proxy on CentOS system to help you get this task done easily.
Preparation: Installation of the necessary software
Before we begin, we need to install some necessary software. First, make sure your CentOS system is updated to the latest version. Use the following command to update your system:
sudo yum update -y
Next, we need to install Dante, a popular Socks5 proxy server. Use the following command to install Dante:
sudo yum install epel-release -y
sudo yum install dante-server -y
Once the installation is complete, we can start configuring Dante.
Configuring Dante: Making Proxy Services More Attentive
After installing Dante, we need to configure it.The Dante configuration file is located in the/etc/sockd.conf
. We can edit it using a text editor such as vim or nano:
sudo vim /etc/sockd.conf
In the configuration file, we need to specify the IP addresses and ports to listen on, define the users and networks allowed to access, and so on. Below is a simple configuration example:
logoutput: syslog stdout /var/log/socks.log
internal: eth0 port = 1080
external: eth0
method: username
user.privileged: root
user.notprivileged: nobody
client pass {
from: 0.0.0.0/0 to: 0.0.0.0/0
log: connect disconnect
}
socks pass {
from: 0.0.0.0/0 to: 0.0.0.0/0
log: connect disconnect
}
This configuration file specifies that the proxy server listens on port 1080 of the eth0 interface and allows clients from all networks to connect. When the configuration is complete, save and exit the editor.
Launching Dante: Getting Proxy Services Running
Once the configuration is complete, we need to start the Dante service. Use the following command to start and make it boot up:
sudo systemctl start sockd
sudo systemctl enable sockd
To make sure the Dante service is running properly, we can check its status:
sudo systemctl status sockd
If everything is fine, our Socks5 proxy server has been successfully started. At this point, you can use the proxy client to connect to your CentOS server and enjoy a secure network access experience.
Authentication agent: make sure everything is in order
To make sure our Socks5 proxy server is working properly, we can verify it using the curl command. First, install curl:
sudo yum install curl -y
Then, use the following command to access a website through a proxy server:
curl -x socks5h://:1080 http://ifconfig.me
If the returned IP address is the same as the server's IP address, the proxy server is working properly.
Optimization and Security: Making Proxy Services More Stable
In order to further improve the security and stability of the proxy server, we can perform some optimized configurations. For example, limiting the range of IP addresses allowed to access, setting more complex usernames and passwords, and so on.
exist/etc/sockd.conf
You can restrict the range of IP addresses allowed for access by adding the following to the
client block {
from: 0.0.0.0/0 to: 0.0.0.0/0
log: connect disconnect
}
client pass { from: /32 to: 0.0.0.0/0 log: connect disconnect }
from: /32 to: 0.0.0.0/0
log: connect disconnect
}
Additionally, we can use the iptables firewall to further protect the proxy server. Here are some simple examples of iptables rules:
sudo iptables -A INPUT -p tcp --dport 1080 -s -j ACCEPT
sudo iptables -A INPUT -p tcp --dport 1080 -j DROP
These rules will allow only the specified IP address to access port 1080; other IP addresses will be denied.
In Summary: The Unlimited Possibilities of Socks5 Proxies
In this article, we have learned how to set up a Socks5 proxy server on a CentOS system. From installing the necessary software, configuring Dante, starting the service to verifying the proxy and optimizing the security, each step is elaborated in detail. Hopefully, with this content, you can easily set up a stable and secure Socks5 proxy server for your network access.
The use of proxy IPs not only improves network security, but also brings us more convenience and possibilities. Whether it's to protect privacy or to increase the speed of network access, Socks5 proxy can provide us with strong support.