Establishing a socks5 proxy server

  

Recently, many netizens have always asked me how some QQ uses the proxy. In fact, it is very simple, through the agent hunter to find some socks5 agents. Just recently learning Linux system, I suddenly thought of using RedHat9 to be a socks5 proxy server. Ok! Just do it

1. First search for the installation package of socks5, found a lot, the latest version is socks5-v1.0r11.tar.gz, so I downloaded it to my RH9 server.

2. Unzip the package

#tar xvfz socks5-v1.0r11.tar.gz

3. Start compiling
#cd socks5-v1.0r11
#./configure - -with-threads
#make
#make install


4. Create /etc/socks5.conf, in fact there are ready-made examples in the package

#cd examples
#cp socks5.conf.singlehomed /etc/socks5.conf (we pick one of the simplest configuration files)

The default configuration is

# A Socks5 Config file for a normal, single homed server
permit - - - - - -

This configuration file allows anyone to use this socks5 proxy, and does not need to verify

An IP segment (192.168.0.0/255.255.255.0) can be accessed. It can be changed to

permit - - 192.168.0. - - -

or only one IP is allowed (192.168. 0.10) can be accessed, can be changed to

permit - - 192.168.0.10 - - -

5.ok Run socks5 -t Start the socks5 service, then use QQ to test whether the agent is effective , remember that the default port is 1080
Anyway, I am trying on FTP software and QQ No problem.

6. If you want to stop socks5, just run stopsocks -KILL and socks5 will stop!

7. Use non-default port: If you want the socks5 service to start without starting the default listening port 1080, such as 1234, we can run the following command
socks5 -b 1234 -t Of course you off To drop this service, you must use the following command stopsocks -p 1234 -KILL


8. Let's dig into socks5.conf to make socks5 use user authentication mechanism

User authentication, first create /etc/socks5.pwsswd file

The content is: (userA represents the user name. passwdA represents the user userA password)
#/etc/socks5.passwd
userA passwdA
userB passwdB
userC passwdC

Then modify /etc/socks5.conf
Add the following statement
auth - - u
or put:
auth - - - Change to auth - - u

Add:
Change the default permit - - - - - - to permit u - 192.168.0. - - -
Allow from 192.168.0.0/255.255. Any user-authenticated connection on the 255.0 segment


If you don't want to have the password file in the default /etc/socks5.passwd. If you want to have a custom file, such as /etc/qq.passwd

, you have to modify /etc/socks5.conf. Add a parameter

set SOCKS5_PWDFILE /etc/qq.passwd < Br>


ok! Restart the service. If you don't use the correct username and password, you can't use the socks5 proxy server. You can use the correct username and password.

The parameters mentioned above can be combined, for example, to limit the use of socks5 services to an IP segment, and to use username verification

There are also some parameters for /etc/socks5.conf. Let's study it yourself

set SOCKS5_BINDINFC 192.168.0.8:1080

Ignore the ident request. Using SOCKS5_NOIDENT will reduce the timeout value when the client is not running identd
set SOCKS5_NOIDENT

Specifies the maximum time for the connection to pause. After exceeding the maximum value, socks5 disconnects
set SOCKS5_TIMEOUT 15

socks5 will accept the SOCKS V4 protocol request, default does not accept
set SOCKS5_V4SUPPORT

specifies the maximum number of simultaneous existence The number of processes, Socks5 is preset to 64
set SOCKS5_MAXCHILD 4

Copyright © Windows knowledge All Rights Reserved