運用と保守 - ネットワークのない純粋なイントラネット環境で、ネットワークを外部ネットワークにプロキシする方法! 超充実!手作りで教えます!!

序文

	在外出实施和部署公司的软件和系统时,有的甲方要求时纯内网环境!不给开公网,但
是自己处理软件包之间的依赖又太麻烦(一个软件包有可能会有67个依赖。亲身经
验)。所以找到了一套可以强制代理固定软件的网络包到指定电脑端口的代理服务的工
具——tsocks。但是在纯内网中安装它又可能需要其它的东西比如gcc和make编译工具。
下面会一一列出需要的工具和获取的方法
	第二种可能会用到的情况就是在linux下想要 “出去” 上网也可以用到这个tsocks。

必要なツールとその入手方法

1:网络包转发工具——tsocks: 
	官网地址:https://tsocks.sourceforge.net/faq.php
	如果你碰巧可以在有网络的时候提前下载,那也可以通过apt,yum等软件包管理工具提前下载
	如:sudo apt-get install tsocks
2:网络服务代理工具——Clash-for-Windows
	github地址:https://github.com/ender-zhao/Clash-for-Windows_Chinese-Attached
	根据自己的系统版本下载对应的软件版本
	此软件的作用就是开启一个被tsocks转发处理的网络包的代理服务
3:gcc和make:这两个工具如果有则不需要安装,如果没有可以选择使用linux系统自带的包管理工具(apt,yum)安装,或者去官网下载安装包到本地安装即可。

具体的な手順と使い方

1:确保操作系统中已经有了gcc和make编译套件;(如果没有需要安装)
2:确保代理者上装好了Clash-for-Windows;
	①:安装好Clash-for-Windows。
	②:进入主页选择一个端口。
	③:打开允许局域网。
3:确保被代理者已经装好了tsocks(下面简单描述一下离线安装);
	①:在官网下载好tsocks后,解压到任意目录,进入tsocks目录。
	②:查看INSTALL文件根据自己的需要去执行./configure 命令,如果没有特殊需求,直接执行 ./configure 即可。
	③:执行make install,等待编译安装完成。
4:根据代理服务器的IP和端口修改tsocks的配置文件,配置文件默认是:/etc/tsocks.conf。
	将其内容改成以下几行并保存退出:
	
	local = 192.168.2.0/255.255.255.0 #local表示本地的网络,也就是不使用socks代理的网络
	server = 192.168.3.5 # SOCKS 服务器的 IP
	server_type = 5 # SOCKS 服务版本 默认是4 ,绝大多数使用5即可
	server_port = 9999SOCKS 服务使用的端口
	
	你可能需要修改一下以上内容
5: 分享一下个人的tsocks配置文件#################################

# This is the configuration for libtsocks (transparent socks)
# Lines beginning with # and blank lines are ignored
#
# The basic idea is to specify:
#	- Local subnets - Networks that can be accessed directly without
#			  assistance from a socks server
#	- Paths - Paths are basically lists of networks and a socks server
#		  which can be used to reach these networks
#	- Default server - A socks server which should be used to access 
#			   networks for which no path is available
# Much more documentation than provided in these comments can be found in
# the man pages, tsocks(8) and tsocks.conf(8)

# Local networks
# For this example this machine can directly access 192.168.0.0/255.255.255.0 
# (192.168.0.*) and 10.0.0.0/255.0.0.0 (10.*)

local = 192.168.2.0/255.255.255.0
local = 192.168.3.0/255.255.255.0

# Paths
# For this example this machine needs to access 150.0.0.0/255.255.0.0 as 
# well as port 80 on the network 150.1.0.0/255.255.0.0 through
# the socks 5 server at 10.1.7.25 (if this machines hostname was 
# "socks.hello.com" we could also specify that, unless --disable-hostnames
# was specified to ./configure).

path {
    
    
	reaches = 150.0.0.0/255.255.0.0
	reaches = 150.1.0.0:80/255.255.0.0
	server = 10.1.7.25
	server_type = 5
	default_user = delius
	default_pass = hello
}

# Default server
# For connections that aren't to the local subnets or to 150.0.0.0/255.255.0.0
# the server at 192.168.0.1 should be used (again, hostnames could be used
# too, see note above)

server = 192.168.3.5
# Server type defaults to 4 so we need to specify it as 5 for this one
server_type = 5
# The port defaults to 1080 but I've stated it here for clarity 
server_port = 9999

####################################
6:配置完成后,保存退出。

7:运行软件
用 tsocks 运行你的软件很简单,在终端中:
tsocks 你的软件
如:	
	tsocks firefox;
	tsocks ssh -p 9022 gobills@10.1.1.109
	tsocks apt install vim

ソフトウェアのスクリーンショット

ここに画像の説明を挿入

おすすめ

転載: blog.csdn.net/weixin_43441262/article/details/127228126