文章目录
- ISO模型与SOCKS协议
- references
- SOCKS代理与HTTP代理的对比
- SOCKS
- HTTP
- SOCKS5
- Usage
- OSI模型
- 层次划分
- 第7层 应用层
- 第6层 表示层
- 第5层 会话层
- 第4层 传输层
- 第3层 网络层
- 第2层 数据链路层
- 第1层 物理层
- 影响
ISO模型与SOCKS协议
references
- SOCKS - Wiki
- SOCKSis anInternetprotocol that exchangesnetwork packets between aclient andserver through aproxy server.
- SOCKS5optionally providesauthentication soonly authorized users may access a server.
- Practically, a SOCKS serverproxies TCP connections to an arbitrary IP address, andprovides a means for UDP packets to be forwarded.
- SOCKS performs at Layer 5 of theOSI model (thesession layer, an intermediate layer between thepresentation layer and thetransport layer). A SOCKS server accepts incoming client connection on TCP port 1080, as defined inRFC1928.[1]
- SOCKS是一种网络传输协议,主要用于客户端与外网服务器之间通讯的中间传递。
- SOCKS是"SOCKet Secure"的缩写
- 当防火墙后的客户端要访问外部的服务器时,就跟SOCKS代理服务器连接。
- 这个代理服务器控制客户端访问外网的资格,允许的话,就将客户端的请求发往外部的服务器。
- 这个协议最初由David Koblas开发,而后由NEC的Ying-Da Lee将其扩展到SOCKS4。
- 最新协议是SOCKS5,与前一版本相比,增加支持UDP、验证,以及IPv6。
- 根据OSI模型,SOCKS是会话层的协议,位于表示层与传输层之间。
SOCKS代理与HTTP代理的对比
- SOCKS工作在比HTTP代理更低的层次:SOCKS使用握手协议来通知代理软件其客户端试图进行的SOCKS连接,然后尽可能透明地进行操作,而常规代理可能会解释和重写报头(例如,使用另一种底层协议,例如FTP;然而,HTTP代理只是将HTTP请求转发到所需的HTTP服务器)。
- 虽然HTTP代理有不同的使用模式,HTTP CONNECT方法允许转发TCP连接;然而,SOCKS代理还可以转发UDP流量(仅SOCKS5),而HTTP代理不能。
- HTTP代理通常更了解HTTP协议,执行更高层次的过滤(虽然通常只用于GET和POST方法,而不用于CONNECT方法)。
SOCKS
- Bill希望通过互联网与Jane沟通,但他们的网络之间存在一个防火墙,Bill不能直接与Jane沟通。
- 所以,Bill连接到他的网络上的SOCKS代理,告知它他想要与Jane创建连接;
- SOCKS代理打开一个能穿过防火墙的连接,并促进Bill和Jane之间的通信。
HTTP
- Bill希望从Jane的Web服务器下载一个网页。Bill不能直接连接到Jane的服务器,因为在他的网络上设置了防火墙。
- 为了与该服务器通信,Bill连接到其网络的HTTP代理。
- 他的网页浏览器与代理通信的方式与他直接连接Jane的服务器的方式相同;
- 也就是说,网页浏览器会发送一个标准的HTTP请求头。
- HTTP代理连接到Jane的服务器,然后将Jane的服务器返回的任何数据传回Bill。
SOCKS5
- The SOCKS5 protocol is defined inRFC1928. It is an incompatible extension of the SOCKS4 protocol;
- it offers more choices for authentication and adds support forIPv6 andUDP, the latter of which can be used forDNS lookups. The initial handshake consists of the following:
- Client connects and sends a greeting, which includes a list of authentication methods supported.
- Server chooses one of the methods (or sends a failure response if none of them are acceptable).
- Several messages may now pass between the client and the server, depending on the authentication method chosen.
- Client sends a connection request similar to SOCKS4.
- Server responds similar to SOCKS4.
Usage
SOCKS is a de facto standard for circuit-level gateways (level 5 gateways).[6]
The circuit/session level nature of SOCKS make it a versatile tool in forwarding any TCP (or UDP since SOCKS5) traffic, creating an interface for all types of routing tools. It can be used as:
- A circumvention tool, allowing traffic to bypass Internet filtering to access content otherwise blocked, e.g., by governments, workplaces, schools, and country-specific web services.
- Since SOCKS is verydetectable, a common approach is to present a SOCKS interface formore sophisticated protocols:
- TheTor onion proxy software presents a SOCKS interface to its clients.[8]
- Providing similar functionality toa virtual private network, allowing connections to be forwarded1to a server’s “local” network:
- Some SSH suites, such asOpenSSH, support dynamic port forwarding that allows the user to create a local SOCKS proxy.[9]
- This can free the user from the limitations of connecting only to a predefined remote port and server.
OSI模型
- 1984年,ISO发布了著名的ISO/IEC 7498标准,它定义了网络互联的7层框架,也就是开放式系统互联参考模型。
层次划分
根据建议X.200,OSI将计算机网络体系结构划分为以下七层,标有1~7,第1层在底部。
现“OSI/RM”是英文“Open Systems Interconnection Reference Model”的缩写。
第7层 应用层
应用层(Application Layer)提供为应用软件而设计的接口,以设置与另一应用软件之间的通信。
- 例如:
- HTTP、HTTPS、
- FTP、Telnet、SSH、SMTP、POP3等。
第6层 表示层
表示层(Presentation Layer)把数据转换为能与接收者的系统格式兼容并适合传输的格式。
第5层 会话层
会话层(Session Layer)负责在数据传输中设置和维护计算机网络中两台计算机之间的通信连接。
第4层 传输层
- 传输层(Transport Layer)把传输表头(TH)加至资料以形成分组。
- 传输表头包含了所使用的协议等发送信息。
- 例如:传输控制协议(TCP)等。
第3层 网络层
- 网络层(Network Layer)决定数据的路径选择和转寄,将网络表头(NH)加至数据包,以形成分组。
- 网络表头包含了网络资料。
- 例如:互联网协议(IP)等。
第2层 数据链路层
- 数据链路层(Data Link Layer)负责网络寻址、错误侦测和改错。
- 当表头和表尾被加至数据包时,会形成信息框(Data Frame)。
- 数据链表头(DLH)是包含了物理地址和错误侦测及改错的方法。
- 数据链表尾(DLT)是一串指示数据包末端的字符串。
- 例如:
- 以太网、无线局域网(Wi-Fi)和通用分组无线服务(GPRS)等。
- 分为两个子层:
- 逻辑链路控制(logical link control,LLC)子层和
- 介质访问控制(Media access control,MAC)子层。
第1层 物理层
- 物理层(Physical Layer)在局域网上发送数据帧(Data Frame),它负责管理电脑通信设备和网络媒体之间的互通。
- 包括了针脚、电压、线缆规范、集线器、中继器、网卡、主机接口卡等。
影响
- OSI是一个定义良好的协议规范集,并有许多可选部分完成类似的任务。
- 它定义了开放系统的层次结构、层次之间的相互关系以及各层所包括的可能的任务,作为一个框架来协调和组织各层所提供的服务。
- OSI参考模型并没有提供一个可以实现的方法,而是描述了一些概念,用来协调进程间通信标准的制定。
- 即OSI参考模型并不是一个标准,而是一个在制定标准时所使用的概念性框架。
- send (a letter or email) on to a further destination.↩︎