How to install and configure Socks5 agent on Linux server

Time:2020-9-14

socks5
Socks5 is a proxy protocol, which plays an intermediary role between the front-end machine and the server machine that uses TCP / IP protocol to communicate, so that the front-end machine in the Intranet can access the server in the Internet network, or make the communication more secure. Socks5 server simulates the behavior of a front end by forwarding the request from the front end to the real target server. Here, the front-end and Socks5 also communicate through TCP / IP protocol. The front-end sends the request to the real server to the Socks5 server, and then the Socks5 server forwards the request to the real server.
If your machine has a legal Internet IP address, or if you can freely communicate with any host on the Internet by dialing the modem on your own machine, you usually don’t need to care about Socks5 protocol. Socks5 protocol is useful for the machine in the internal network, which needs to access the outside through some machines in the network that can connect with the external Internet. In the process of sending the communication request to the real server, the Socks5 server does not change the request packet itself. After the Socks5 server receives the response from the real server, it also forwards it to the front end. Therefore, Socks5 protocol is a kind of proxy protocol, which can adapt to all kinds of application layer protocols based on TCP / IP. Although it can’t understand the internal structure of the data it forwards, it can faithfully forward the communication package and complete the function that the protocol should complete.
Different from Socks5 protocol, HTTP proxy is carried out through HTTP protocol. The HTTP proxy server software understands the internal structure of the communication package, and it also needs to modify and transform the communication program in the process of forwarding. Different from HTTP proxy protocol, Socks5 is actually a transport layer proxy protocol. We can imagine that if every specific application layer protocol has to design the corresponding proxy protocol expression, a specific proxy server can not support so many new emerging protocols in any case. Therefore, it can be said that the emergence of Socks5 eases the difficult situation that a variety of specific protocols need to specially design proxy protocols. However, not all software using TCP / IP application protocol can communicate unconditionally through the Socks5 server, and the front-end software itself is required to have the Socks5 interface to use the Socks5 proxy server.

Installation configuration
1. Install SOCKS 5
1.1 installation dependent development library

Copy code

The code is as follows:

# yum install pam-devel openldap-devel openssl-devel

1.2 installing SOCKS 5

Copy code

The code is as follows:

# wget http://downloads.sourceforge.net/project/ss5/ss5/3.8.9-8/ss5-3.8.9-8.tar.gz?r=&ts=1396802581&use_mirror=cznic
# tar -xzvf ss5-3.8.9-8.tar.gz
# cd ss5-3.8.9
# ./configure
# make
# make install

2. SOCKS 5 configuration
2.1 modify configuration file

Copy code

The code is as follows:

# vim /etc/opt/ss5/ss5.conf
auth 0.0.0.0/0 – –

Change to

Copy code

The code is as follows:

auth 0.0.0.0/0 – u

permit – 0.0.0.0/0 – 0.0.0.0/0 – – – – –

Change to

Copy code

The code is as follows:

permit u 0.0.0.0/0 – 0.0.0.0/0 – – – – –

3. Add socket 5 users

Copy code

The code is as follows:

# cat /etc/opt/ss5/ss5.passwd
##User password
ttlsa 123456

4. Start socket 5

Copy code

The code is as follows:

# sh /etc/rc.d/init.d/ss5 start
doneting ss5…

By default, the SS5 file does not have permission to execute. If you feel that it is troublesome to use sh to start, you can use the following method:

Copy code

The code is as follows:

# chmod u+x /etc/rc.d/init.d/ss5
#Chkconfig — add SS5 / / optional
#Chkconfig SS5 on / / optional
# service ss5 start

5. Check whether it is started

Copy code

The code is as follows:

# netstat -lntp | grep ss5
tcp 0 0 0.0.0.0:1080 0.0.0.0:* LISTEN 14262/ss5

Default port 1080
6. Test Socks5
Install proxifier. By default, all requests go to Socks5. Open Baidu and enter IP. You can see the following results: our operation and maintenance survival time( ttlsa.com )IP address of
20151225121305678.jpg (665×274)

7. Common mistakes
7.1 lack of PAM

Copy code

The code is as follows:

configure: error: *** Some of the headers weren’t found ***
# yum -y install pam-devel

8. End
Have you successfully installed Socks5? I haven’t turned off Socks5 yet. You can take the account and password in this chapter for a test.