Using Haproxy for HTTP/SSH/MSTSC multiplexing

Source: Internet
Author: User
Tags session id sessions haproxy mstsc

There is more http/ssh multiplexing on the web, but in the real world, with IIS load Balancing using Haproxy, 80 ports are required to use the Remote Desktop Management Server.

Recently through the Wireshark grab packet, found the TPKT header field, finally successfully implemented RDP protocol multiplexing:

Note: RDP typically uses TPKT as its transport protocol, and TPKT runs on top of TCP. When used to transmit RDP, the TCP port used is 3389, not the normal TPKT port 102.

Reference documents:

http://blog.csdn.net/kevin_bobolkevin/article/details/50790967

TPKT Communication Instructions

Https://wenku.baidu.com/view/9f509844e2bd960591c67723.html


650) this.width=650; "Src=" https://s4.51cto.com/wyfs02/M00/9A/BF/wKiom1laCESgVrh0AANwJnBcOd4329.png-wh_500x0-wm_ 3-wmp_4-s_2573990352.png "title=" 111.png "alt=" Wkiom1lacesgvrh0aanwjnbcod4329.png-wh_50 "/>


The final configuration file is as follows, for reference:

------------------------------------------------------


Global

Daemon

User Haproxy

Group Haproxy

Maxconn 49985

Log 127.0.0.1 Local0

Log 127.0.0.1 Local1 Notice

# Tune.ssl.default-dh-param 2048


Defaults

Mode TCP

Log Global

Log 127.0.0.1 Local0 Err


Option Tcplog

Option Dontlog-normal


Timeout Connect 10s

Timeout queue 30s

Timeout client 15m

Timeout Client-fin 15m

Timeout server 15m

Timeout Tunnel 12h


Listen monitor

Bind *:8888

#监听端口

Mode http

#http的7层模式

Log Global

Log 127.0.0.1 Local0 Err


Maxconn 5


Option Httplog


Stats enable

Stats URI/

Stats Refresh 15s


Timeout Connect 10s

Timeout queue 30s

Timeout client 30s

Timeout server 30s


Listen HTTP

Bind *:80

Maxconn 800

Timeout client 1h

Tcp-request inspect-delay 2s

ACL is_http req.payload (0,3)-M bin 474554 504f53 505554 44454c

ACL is_ssh req.payload (0,3)-M bin 535348

ACL is_rdp req.payload (0,3)-M bin 030000

Tcp-request Content Accept if is_http

# Use_backend HTTP If is_http

Use_backend SSH if is_ssh

Use_backend RDP if IS_RDP

#监听端口

Option Tcpka

#是否允许客户端发送tcp KeepAlive Package, this is not related to HTTP keepalive

#option Redispatch

#是否允许失败后重新分配session This setting will present a change in the session ID of the returned K/3cloud system resulting in a flashback. Possible cause there is an exception on the server or the transmission has occurred

Option Abortonclose

#当服务器负载很高的时候, automatically ends the link that the current queue is processing longer

#tcp-request Inspect-delay 30s


Hash-type consistent

Balance Roundrobin

Stick-table Type IP size 10240k expire 24h

Stick on SRC

Server Server01 192.168.90.121:80 weight check agent-check agent-port 3333 minconn 0 maxconn On-marked-down Shu Tdown-sessions

Server Server02 192.168.90.122:80 weight check agent-check agent-port 3333 minconn 0 maxconn On-marked-down Shu Tdown-sessions


Backend SSH

Mode TCP

Timeout Server 1h

Server Server-ssh 192.168.90.126:22


Backend RDP

Mode TCP

Timeout Server 1h

Server SERVER-MSTSC 192.168.90.121:3389


This article is from the "Stone Blog" blog, make sure to keep this source http://dayday.blog.51cto.com/3248/1944129

Using Haproxy for HTTP/SSH/MSTSC multiplexing

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.