今天同事和我讨论了在内网穿透时无法使用x11的问题。具体是这样的,办公室有台服务器(docker容器)使用公司内网,在办公室中内网直接使用x11是可以的(如运行xclock)。从家里(外网)访问该服务器是使用ngrok内网穿透转发了ssh端口到云主机上,此时(也就是内网穿透)无法运行x11程序。
#mermaid-svg-GFbtwgOY0Y8QDEPI .label {font-family: 'trebuchet ms', verdana, arial;font-family: var(--mermaid-font-family);fill: #333;color: #333; }#mermaid-svg-GFbtwgOY0Y8QDEPI .label text {fill: #333; }#mermaid-svg-GFbtwgOY0Y8QDEPI .node rect, #mermaid-svg-GFbtwgOY0Y8QDEPI .node circle, #mermaid-svg-GFbtwgOY0Y8QDEPI .node ellipse, #mermaid-svg-GFbtwgOY0Y8QDEPI .node polygon, #mermaid-svg-GFbtwgOY0Y8QDEPI .node path {fill: #ECECFF;stroke: #9370DB;stroke-width: 1px; }#mermaid-svg-GFbtwgOY0Y8QDEPI .node .label {text-align: center;fill: #333; }#mermaid-svg-GFbtwgOY0Y8QDEPI .node.clickable {cursor: pointer; }#mermaid-svg-GFbtwgOY0Y8QDEPI .arrowheadPath {fill: #333333; }#mermaid-svg-GFbtwgOY0Y8QDEPI .edgePath .path {stroke: #333333;stroke-width: 1.5px; }#mermaid-svg-GFbtwgOY0Y8QDEPI .flowchart-link {stroke: #333333;fill: none; }#mermaid-svg-GFbtwgOY0Y8QDEPI .edgeLabel {background-color: #e8e8e8;text-align: center; } #mermaid-svg-GFbtwgOY0Y8QDEPI .edgeLabel rect {opacity: 0.9; } #mermaid-svg-GFbtwgOY0Y8QDEPI .edgeLabel span {color: #333; }#mermaid-svg-GFbtwgOY0Y8QDEPI .cluster rect {fill: #ffffde;stroke: #aaaa33;stroke-width: 1px; }#mermaid-svg-GFbtwgOY0Y8QDEPI .cluster text {fill: #333; }#mermaid-svg-GFbtwgOY0Y8QDEPI div.mermaidTooltip {position: absolute;text-align: center;max-width: 200px;padding: 2px;font-family: 'trebuchet ms', verdana, arial;font-family: var(--mermaid-font-family);font-size: 12px;background: #ffffde;border: 1px solid #aaaa33;border-radius: 2px;pointer-events: none;z-index: 100; }#mermaid-svg-GFbtwgOY0Y8QDEPI .actor {stroke: #CCCCFF;fill: #ECECFF; }#mermaid-svg-GFbtwgOY0Y8QDEPI text.actor > tspan {fill: black;stroke: none; }#mermaid-svg-GFbtwgOY0Y8QDEPI .actor-line {stroke: grey; }#mermaid-svg-GFbtwgOY0Y8QDEPI .messageLine0 {stroke-width: 1.5;stroke-dasharray: none;stroke: #333; }#mermaid-svg-GFbtwgOY0Y8QDEPI .messageLine1 {stroke-width: 1.5;stroke-dasharray: 2, 2;stroke: #333; }#mermaid-svg-GFbtwgOY0Y8QDEPI #arrowhead path {fill: #333;stroke: #333; }#mermaid-svg-GFbtwgOY0Y8QDEPI .sequenceNumber {fill: white; }#mermaid-svg-GFbtwgOY0Y8QDEPI #sequencenumber {fill: #333; }#mermaid-svg-GFbtwgOY0Y8QDEPI #crosshead path {fill: #333;stroke: #333; }#mermaid-svg-GFbtwgOY0Y8QDEPI .messageText {fill: #333;stroke: #333; }#mermaid-svg-GFbtwgOY0Y8QDEPI .labelBox {stroke: #CCCCFF;fill: #ECECFF; }#mermaid-svg-GFbtwgOY0Y8QDEPI .labelText,#mermaid-svg-GFbtwgOY0Y8QDEPI .labelText > tspan {fill: black;stroke: none; }#mermaid-svg-GFbtwgOY0Y8QDEPI .loopText,#mermaid-svg-GFbtwgOY0Y8QDEPI .loopText > tspan {fill: black;stroke: none; }#mermaid-svg-GFbtwgOY0Y8QDEPI .loopLine {stroke-width: 2px;stroke-dasharray: 2, 2;stroke: #CCCCFF;fill: #CCCCFF; }#mermaid-svg-GFbtwgOY0Y8QDEPI .note {stroke: #aaaa33;fill: #fff5ad; }#mermaid-svg-GFbtwgOY0Y8QDEPI .noteText,#mermaid-svg-GFbtwgOY0Y8QDEPI .noteText > tspan {fill: black;stroke: none; }#mermaid-svg-GFbtwgOY0Y8QDEPI .activation0 {fill: #f4f4f4;stroke: #666; }#mermaid-svg-GFbtwgOY0Y8QDEPI .activation1 {fill: #f4f4f4;stroke: #666; }#mermaid-svg-GFbtwgOY0Y8QDEPI .activation2 {fill: #f4f4f4;stroke: #666; }#mermaid-svg-GFbtwgOY0Y8QDEPI .mermaid-main-font {font-family: "trebuchet ms", verdana, arial;font-family: var(--mermaid-font-family); }#mermaid-svg-GFbtwgOY0Y8QDEPI .section {stroke: none;opacity: 0.2; }#mermaid-svg-GFbtwgOY0Y8QDEPI .section0 {fill: rgba(102, 102, 255, 0.49); }#mermaid-svg-GFbtwgOY0Y8QDEPI .section2 {fill: #fff400; }#mermaid-svg-GFbtwgOY0Y8QDEPI .section1, #mermaid-svg-GFbtwgOY0Y8QDEPI .section3 {fill: white;opacity: 0.2; }#mermaid-svg-GFbtwgOY0Y8QDEPI .sectionTitle0 {fill: #333; }#mermaid-svg-GFbtwgOY0Y8QDEPI .sectionTitle1 {fill: #333; }#mermaid-svg-GFbtwgOY0Y8QDEPI .sectionTitle2 {fill: #333; }#mermaid-svg-GFbtwgOY0Y8QDEPI .sectionTitle3 {fill: #333; }#mermaid-svg-GFbtwgOY0Y8QDEPI .sectionTitle {text-anchor: start;font-size: 11px;text-height: 14px;font-family: 'trebuchet ms', verdana, arial;font-family: var(--mermaid-font-family); }#mermaid-svg-GFbtwgOY0Y8QDEPI .grid .tick {stroke: lightgrey;opacity: 0.8;shape-rendering: crispEdges; } #mermaid-svg-GFbtwgOY0Y8QDEPI .grid .tick text {font-family: 'trebuchet ms', verdana, arial;font-family: var(--mermaid-font-family); }#mermaid-svg-GFbtwgOY0Y8QDEPI .grid path {stroke-width: 0; }#mermaid-svg-GFbtwgOY0Y8QDEPI .today {fill: none;stroke: red;stroke-width: 2px; }#mermaid-svg-GFbtwgOY0Y8QDEPI .task {stroke-width: 2; }#mermaid-svg-GFbtwgOY0Y8QDEPI .taskText {text-anchor: middle;font-family: 'trebuchet ms', verdana, arial;font-family: var(--mermaid-font-family); }#mermaid-svg-GFbtwgOY0Y8QDEPI .taskText:not([font-size]) {font-size: 11px; }#mermaid-svg-GFbtwgOY0Y8QDEPI .taskTextOutsideRight {fill: black;text-anchor: start;font-size: 11px;font-family: 'trebuchet ms', verdana, arial;font-family: var(--mermaid-font-family); }#mermaid-svg-GFbtwgOY0Y8QDEPI .taskTextOutsideLeft {fill: black;text-anchor: end;font-size: 11px; }#mermaid-svg-GFbtwgOY0Y8QDEPI .task.clickable {cursor: pointer; }#mermaid-svg-GFbtwgOY0Y8QDEPI .taskText.clickable {cursor: pointer;fill: #003163 !important;font-weight: bold; }#mermaid-svg-GFbtwgOY0Y8QDEPI .taskTextOutsideLeft.clickable {cursor: pointer;fill: #003163 !important;font-weight: bold; }#mermaid-svg-GFbtwgOY0Y8QDEPI .taskTextOutsideRight.clickable {cursor: pointer;fill: #003163 !important;font-weight: bold; }#mermaid-svg-GFbtwgOY0Y8QDEPI .taskText0, #mermaid-svg-GFbtwgOY0Y8QDEPI .taskText1, #mermaid-svg-GFbtwgOY0Y8QDEPI .taskText2, #mermaid-svg-GFbtwgOY0Y8QDEPI .taskText3 {fill: white; }#mermaid-svg-GFbtwgOY0Y8QDEPI .task0, #mermaid-svg-GFbtwgOY0Y8QDEPI .task1, #mermaid-svg-GFbtwgOY0Y8QDEPI .task2, #mermaid-svg-GFbtwgOY0Y8QDEPI .task3 {fill: #8a90dd;stroke: #534fbc; }#mermaid-svg-GFbtwgOY0Y8QDEPI .taskTextOutside0, #mermaid-svg-GFbtwgOY0Y8QDEPI .taskTextOutside2 {fill: black; }#mermaid-svg-GFbtwgOY0Y8QDEPI .taskTextOutside1, #mermaid-svg-GFbtwgOY0Y8QDEPI .taskTextOutside3 {fill: black; }#mermaid-svg-GFbtwgOY0Y8QDEPI .active0, #mermaid-svg-GFbtwgOY0Y8QDEPI .active1, #mermaid-svg-GFbtwgOY0Y8QDEPI .active2, #mermaid-svg-GFbtwgOY0Y8QDEPI .active3 {fill: #bfc7ff;stroke: #534fbc; }#mermaid-svg-GFbtwgOY0Y8QDEPI .activeText0, #mermaid-svg-GFbtwgOY0Y8QDEPI .activeText1, #mermaid-svg-GFbtwgOY0Y8QDEPI .activeText2, #mermaid-svg-GFbtwgOY0Y8QDEPI .activeText3 {fill: black !important; }#mermaid-svg-GFbtwgOY0Y8QDEPI .done0, #mermaid-svg-GFbtwgOY0Y8QDEPI .done1, #mermaid-svg-GFbtwgOY0Y8QDEPI .done2, #mermaid-svg-GFbtwgOY0Y8QDEPI .done3 {stroke: grey;fill: lightgrey;stroke-width: 2; }#mermaid-svg-GFbtwgOY0Y8QDEPI .doneText0, #mermaid-svg-GFbtwgOY0Y8QDEPI .doneText1, #mermaid-svg-GFbtwgOY0Y8QDEPI .doneText2, #mermaid-svg-GFbtwgOY0Y8QDEPI .doneText3 {fill: black !important; }#mermaid-svg-GFbtwgOY0Y8QDEPI .crit0, #mermaid-svg-GFbtwgOY0Y8QDEPI .crit1, #mermaid-svg-GFbtwgOY0Y8QDEPI .crit2, #mermaid-svg-GFbtwgOY0Y8QDEPI .crit3 {stroke: #ff8888;fill: red;stroke-width: 2; }#mermaid-svg-GFbtwgOY0Y8QDEPI .activeCrit0, #mermaid-svg-GFbtwgOY0Y8QDEPI .activeCrit1, #mermaid-svg-GFbtwgOY0Y8QDEPI .activeCrit2, #mermaid-svg-GFbtwgOY0Y8QDEPI .activeCrit3 {stroke: #ff8888;fill: #bfc7ff;stroke-width: 2; }#mermaid-svg-GFbtwgOY0Y8QDEPI .doneCrit0, #mermaid-svg-GFbtwgOY0Y8QDEPI .doneCrit1, #mermaid-svg-GFbtwgOY0Y8QDEPI .doneCrit2, #mermaid-svg-GFbtwgOY0Y8QDEPI .doneCrit3 {stroke: #ff8888;fill: lightgrey;stroke-width: 2;cursor: pointer;shape-rendering: crispEdges; }#mermaid-svg-GFbtwgOY0Y8QDEPI .milestone {transform: rotate(45deg) scale(0.8, 0.8); }#mermaid-svg-GFbtwgOY0Y8QDEPI .milestoneText {font-style: italic; }#mermaid-svg-GFbtwgOY0Y8QDEPI .doneCritText0, #mermaid-svg-GFbtwgOY0Y8QDEPI .doneCritText1, #mermaid-svg-GFbtwgOY0Y8QDEPI .doneCritText2, #mermaid-svg-GFbtwgOY0Y8QDEPI .doneCritText3 {fill: black !important; }#mermaid-svg-GFbtwgOY0Y8QDEPI .activeCritText0, #mermaid-svg-GFbtwgOY0Y8QDEPI .activeCritText1, #mermaid-svg-GFbtwgOY0Y8QDEPI .activeCritText2, #mermaid-svg-GFbtwgOY0Y8QDEPI .activeCritText3 {fill: black !important; }#mermaid-svg-GFbtwgOY0Y8QDEPI .titleText {text-anchor: middle;font-size: 18px;fill: black;font-family: 'trebuchet ms', verdana, arial;font-family: var(--mermaid-font-family); }#mermaid-svg-GFbtwgOY0Y8QDEPI g.classGroup text {fill: #9370DB;stroke: none;font-family: 'trebuchet ms', verdana, arial;font-family: var(--mermaid-font-family);font-size: 10px; } #mermaid-svg-GFbtwgOY0Y8QDEPI g.classGroup text .title {font-weight: bolder; }#mermaid-svg-GFbtwgOY0Y8QDEPI g.clickable {cursor: pointer; }#mermaid-svg-GFbtwgOY0Y8QDEPI g.classGroup rect {fill: #ECECFF;stroke: #9370DB; }#mermaid-svg-GFbtwgOY0Y8QDEPI g.classGroup line {stroke: #9370DB;stroke-width: 1; }#mermaid-svg-GFbtwgOY0Y8QDEPI .classLabel .box {stroke: none;stroke-width: 0;fill: #ECECFF;opacity: 0.5; }#mermaid-svg-GFbtwgOY0Y8QDEPI .classLabel .label {fill: #9370DB;font-size: 10px; }#mermaid-svg-GFbtwgOY0Y8QDEPI .relation {stroke: #9370DB;stroke-width: 1;fill: none; }#mermaid-svg-GFbtwgOY0Y8QDEPI .dashed-line {stroke-dasharray: 3; }#mermaid-svg-GFbtwgOY0Y8QDEPI #compositionStart {fill: #9370DB;stroke: #9370DB;stroke-width: 1; }#mermaid-svg-GFbtwgOY0Y8QDEPI #compositionEnd {fill: #9370DB;stroke: #9370DB;stroke-width: 1; }#mermaid-svg-GFbtwgOY0Y8QDEPI #aggregationStart {fill: #ECECFF;stroke: #9370DB;stroke-width: 1; }#mermaid-svg-GFbtwgOY0Y8QDEPI #aggregationEnd {fill: #ECECFF;stroke: #9370DB;stroke-width: 1; }#mermaid-svg-GFbtwgOY0Y8QDEPI #dependencyStart {fill: #9370DB;stroke: #9370DB;stroke-width: 1; }#mermaid-svg-GFbtwgOY0Y8QDEPI #dependencyEnd {fill: #9370DB;stroke: #9370DB;stroke-width: 1; }#mermaid-svg-GFbtwgOY0Y8QDEPI #extensionStart {fill: #9370DB;stroke: #9370DB;stroke-width: 1; }#mermaid-svg-GFbtwgOY0Y8QDEPI #extensionEnd {fill: #9370DB;stroke: #9370DB;stroke-width: 1; }#mermaid-svg-GFbtwgOY0Y8QDEPI .commit-id, #mermaid-svg-GFbtwgOY0Y8QDEPI .commit-msg, #mermaid-svg-GFbtwgOY0Y8QDEPI .branch-label {fill: lightgrey;color: lightgrey;font-family: 'trebuchet ms', verdana, arial;font-family: var(--mermaid-font-family); }#mermaid-svg-GFbtwgOY0Y8QDEPI .pieTitleText {text-anchor: middle;font-size: 25px;fill: black;font-family: 'trebuchet ms', verdana, arial;font-family: var(--mermaid-font-family); }#mermaid-svg-GFbtwgOY0Y8QDEPI .slice {font-family: 'trebuchet ms', verdana, arial;font-family: var(--mermaid-font-family); }#mermaid-svg-GFbtwgOY0Y8QDEPI g.stateGroup text {fill: #9370DB;stroke: none;font-size: 10px;font-family: 'trebuchet ms', verdana, arial;font-family: var(--mermaid-font-family); }#mermaid-svg-GFbtwgOY0Y8QDEPI g.stateGroup text {fill: #9370DB;fill: #333;stroke: none;font-size: 10px; }#mermaid-svg-GFbtwgOY0Y8QDEPI g.statediagram-cluster .cluster-label text {fill: #333; }#mermaid-svg-GFbtwgOY0Y8QDEPI g.stateGroup .state-title {font-weight: bolder;fill: black; }#mermaid-svg-GFbtwgOY0Y8QDEPI g.stateGroup rect {fill: #ECECFF;stroke: #9370DB; }#mermaid-svg-GFbtwgOY0Y8QDEPI g.stateGroup line {stroke: #9370DB;stroke-width: 1; }#mermaid-svg-GFbtwgOY0Y8QDEPI .transition {stroke: #9370DB;stroke-width: 1;fill: none; }#mermaid-svg-GFbtwgOY0Y8QDEPI .stateGroup .composit {fill: white;border-bottom: 1px; }#mermaid-svg-GFbtwgOY0Y8QDEPI .stateGroup .alt-composit {fill: #e0e0e0;border-bottom: 1px; }#mermaid-svg-GFbtwgOY0Y8QDEPI .state-note {stroke: #aaaa33;fill: #fff5ad; } #mermaid-svg-GFbtwgOY0Y8QDEPI .state-note text {fill: black;stroke: none;font-size: 10px; }#mermaid-svg-GFbtwgOY0Y8QDEPI .stateLabel .box {stroke: none;stroke-width: 0;fill: #ECECFF;opacity: 0.7; }#mermaid-svg-GFbtwgOY0Y8QDEPI .edgeLabel text {fill: #333; }#mermaid-svg-GFbtwgOY0Y8QDEPI .stateLabel text {fill: black;font-size: 10px;font-weight: bold;font-family: 'trebuchet ms', verdana, arial;font-family: var(--mermaid-font-family); }#mermaid-svg-GFbtwgOY0Y8QDEPI .node circle.state-start {fill: black;stroke: black; }#mermaid-svg-GFbtwgOY0Y8QDEPI .node circle.state-end {fill: black;stroke: white;stroke-width: 1.5; }#mermaid-svg-GFbtwgOY0Y8QDEPI #statediagram-barbEnd {fill: #9370DB; }#mermaid-svg-GFbtwgOY0Y8QDEPI .statediagram-cluster rect {fill: #ECECFF;stroke: #9370DB;stroke-width: 1px; }#mermaid-svg-GFbtwgOY0Y8QDEPI .statediagram-cluster rect.outer {rx: 5px;ry: 5px; }#mermaid-svg-GFbtwgOY0Y8QDEPI .statediagram-state .divider {stroke: #9370DB; }#mermaid-svg-GFbtwgOY0Y8QDEPI .statediagram-state .title-state {rx: 5px;ry: 5px; }#mermaid-svg-GFbtwgOY0Y8QDEPI .statediagram-cluster.statediagram-cluster .inner {fill: white; }#mermaid-svg-GFbtwgOY0Y8QDEPI .statediagram-cluster.statediagram-cluster-alt .inner {fill: #e0e0e0; }#mermaid-svg-GFbtwgOY0Y8QDEPI .statediagram-cluster .inner {rx: 0;ry: 0; }#mermaid-svg-GFbtwgOY0Y8QDEPI .statediagram-state rect.basic {rx: 5px;ry: 5px; }#mermaid-svg-GFbtwgOY0Y8QDEPI .statediagram-state rect.divider {stroke-dasharray: 10,10;fill: #efefef; }#mermaid-svg-GFbtwgOY0Y8QDEPI .note-edge {stroke-dasharray: 5; }#mermaid-svg-GFbtwgOY0Y8QDEPI .statediagram-note rect {fill: #fff5ad;stroke: #aaaa33;stroke-width: 1px;rx: 0;ry: 0; }:root {--mermaid-font-family: '"trebuchet ms", verdana, arial';--mermaid-font-family: "Comic Sans MS", "Comic Sans", cursive; }#mermaid-svg-GFbtwgOY0Y8QDEPI .error-icon {fill: #552222; }#mermaid-svg-GFbtwgOY0Y8QDEPI .error-text {fill: #552222;stroke: #552222; }#mermaid-svg-GFbtwgOY0Y8QDEPI .edge-thickness-normal {stroke-width: 2px; }#mermaid-svg-GFbtwgOY0Y8QDEPI .edge-thickness-thick {stroke-width: 3.5px; }#mermaid-svg-GFbtwgOY0Y8QDEPI .edge-pattern-solid {stroke-dasharray: 0; }#mermaid-svg-GFbtwgOY0Y8QDEPI .edge-pattern-dashed {stroke-dasharray: 3; }#mermaid-svg-GFbtwgOY0Y8QDEPI .edge-pattern-dotted {stroke-dasharray: 2; }#mermaid-svg-GFbtwgOY0Y8QDEPI .marker {fill: #333333; }#mermaid-svg-GFbtwgOY0Y8QDEPI .marker.cross {stroke: #333333; }:root { --mermaid-font-family: "trebuchet ms", verdana, arial;}#mermaid-svg-GFbtwgOY0Y8QDEPI {color: rgba(0, 0, 0, 0.75);font: ;}
ngrok内网穿透
内网
公网
办公室服务器
云主机
办公室电脑
家里电脑
其次,设置 DISPLAY 时是直接使用IP,意味着X程序是直接连接的该IP,由于使用内网穿透时,服务器是无法直接连接到本机电脑的,所以使用netstat查看时状态一直都是SYN_SENT,无法建立连接。
那么,是否我将本地电脑的6000端口转发到服务器上,然后在服务器上设置DISPLAY 为 localhost:0.0,运行x11程序时就使用localhost的6000端口,而由于这个端口是转发本地电脑的,因此就相当于将数据转到了本机上。