Because the servers in the data center are bound to a small bandwidth, this post is mainly about using Dante to provide SOCKS5 forwarding, using some high-bandwidth servers for traffic forwarding to speed up dependency package downloads.
1. Find a High-Bandwidth Server
1
| pip3 install speedtest-cli
|
1
2
3
4
5
6
7
8
9
10
11
12
13
| speedtest-cli --secure --list
Retrieving speedtest.net configuration...
5396) China Telecom JiangSu 5G (Suzhou, China) [747.08 km]
16204) JSQY - Suzhou (Suzhou, China) [747.08 km]
4575) China Mobile Group Sichuan (Chengdu, China) [1012.06 km]
17634) China Mobile (Fujian, China) [1102.09 km]
67564) MOACK Data Center (Yongin-si, South Korea) [1240.80 km]
62580) Skymedia (Ulaanbaatar, Mongolia) [1566.70 km]
3805) Alyans Telekom (Vladivostok, Russia) [1822.03 km]
27732) Telenet-Chita (Chita, Russia) [1921.20 km]
36254) EDINOS (Ulan-Ude, Russia) [1959.23 km]
37436) RLINE1 (Svobodny, Russia) [2177.33 km]
|
The first column is the ID of the test server we need.
Domestic
1
| speedtest-cli --secure --server 5396
|
Overseas
1
| speedtest-cli --secure --server 37436
|
2. Deploy the Dante Server
1
| apt install dante-server -y
|
- Generate the configuration file
1
| ip route | grep default | awk '{print $5}'
|
Find the name of the default NIC; here it is bond0.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
| cat > /etc/danted.conf <<EOF
logoutput: syslog
internal: 0.0.0.0 port = 1080
external: bond0
method: username none
user.privileged: root
user.unprivileged: nobody
client pass {
from: 0.0.0.0/0 to: 0.0.0.0/0
log: connect
}
socks pass {
from: 0.0.0.0/0 to: 0.0.0.0/0
log: connect
}
EOF
|
1
2
| systemctl restart danted
systemctl enable danted
|
1
| export ALL_PROXY="socks5://x.x.x.x:1080"
|
At this point it should output the IP address of the forwarder above.
4. Using a Proxy with apt-get
- Configure apt-get to use a proxy
Add the following content
1
2
| Acquire::http::proxy "socks5h://x.x.x.x:1080";
Acquire::https::proxy "socks5h://x.x.x.x:1080";
|
But this approach cannot update apt-key adv --keyserver keyserver.ubuntu.com --recv-keys B53DC80D13EDEF05; you need to download and import it manually.
5. Installing proxychains
1
| apt install proxychains -y
|
1
| vim /etc/proxychains.conf
|
Add the following content
1
| proxychains apt-key adv --keyserver keyserver.ubuntu.com --recv-keys B53DC80D13EDEF05
|
When using a proxy, you only need to prefix the command with proxychains.