Loading... ## Intranet penetration <div class="panel panel-default collapse-panel box-shadow-wrap-lg"><div class="panel-heading panel-collapse" data-toggle="collapse" data-target="#collapse-75c5f2a2c2388b37ca45b3e1aae40c6389" aria-expanded="true"><div class="accordion-toggle"><span>什么是内网共享?</span> <i class="pull-right fontello icon-fw fontello-angle-right"></i> </div> </div> <div class="panel-body collapse-panel-body"> <div id="collapse-75c5f2a2c2388b37ca45b3e1aae40c6389" class="collapse collapse-content"><p></p>内网共享和远程局域网概念可能有点不太好理解,简单来说,你有一台在内网的机器,你可以使用技术手段或者软件来远程访问到他,比如传输文件,远程桌面什么的,但是你不能应用他的网络去访问他所处的内网资源,这个只是叫远程局域网。那么内网共享的概念就是把这台内网设备的本地网络环境共享出来让外网的设备应用。 <p></p></div></div></div> <svg id="SvgjsSvg1125" preserveAspectRatio="xMinYMin meet" viewBox="0,0,400,400" xmlns="http://www.w3.org/2000/svg" version="1.1" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svgjs="http://svgjs.com/svgjs" width="100%" height="362.0625"><defs id="SvgjsDefs1126"><pattern id="SvgjsPattern1129" x="0" y="0" width="59.50001525878906" height="58.999977111816406" patternUnits="userSpaceOnUse"><image id="SvgjsImage1130" xlink:href="https://img8.file.cache.docer.com/storage/image/9/3/4/4/5/031b903037dad22548d1c23c461c2250.png/128x128.png" width="59.50001525878906" height="58.999977111816406" preserveAspectRatio="none" crossOrigin="anonymous" x="0" y="0"></image></pattern><pattern id="SvgjsPattern1133" x="0" y="0" width="55.787488619163696" height="56.146755986929094" patternUnits="userSpaceOnUse"><image id="SvgjsImage1134" xlink:href="https://img8.file.cache.docer.com/storage/image/5/f/0/5/7/7e395dcdf10dd2dd0b75588e5f6dc67d.png/128x128.png" width="55.787488619163696" height="56.146755986929094" preserveAspectRatio="none" crossOrigin="anonymous" x="0" y="0"></image></pattern><marker id="SvgjsMarker1159" markerWidth="16" markerHeight="12" refX="16" refY="6" viewBox="0 0 16 12" orient="auto" markerUnits="userSpaceOnUse"><path id="SvgjsPath1160" d="M0 2L14 6L0 11L0 2 " fill="#323232" stroke="#323232" stroke-width="2"></path></marker><marker id="SvgjsMarker1167" markerWidth="16" markerHeight="12" refX="16" refY="6" viewBox="0 0 16 12" orient="auto" markerUnits="userSpaceOnUse"><path id="SvgjsPath1168" d="M0 2L14 6L0 11L0 2 " fill="#323232" stroke="#323232" stroke-width="2"></path></marker><pattern id="SvgjsPattern1175" x="0" y="0" width="48" height="49" patternUnits="userSpaceOnUse"><image id="SvgjsImage1176" xlink:href="https://img7.file.cache.docer.com/storage/image/0/d/2/3/c/981b0cd3dc23ee022274a41f37ae6bc2.png/128x128.png" width="48" height="49" preserveAspectRatio="none" crossOrigin="anonymous" x="0" y="0"></image></pattern><pattern id="SvgjsPattern1179" x="0" y="0" width="42" height="43.85319823670375" patternUnits="userSpaceOnUse"><image id="SvgjsImage1180" xlink:href="https://img7.file.cache.docer.com/storage/image/0/2/9/6/7/a14d08192e3022c29bc01485628c6076.png/128x128.png" width="42" height="43.85319823670375" preserveAspectRatio="none" crossOrigin="anonymous" x="0" y="0"></image></pattern><pattern id="SvgjsPattern1183" x="0" y="0" width="64" height="64" patternUnits="userSpaceOnUse"><image id="SvgjsImage1184" xlink:href="https://img7.file.cache.docer.com/storage/image/7/f/3/2/0/87887c77f1eca36734f222702083ef0a.png/128x128.png" width="64" height="64" preserveAspectRatio="none" crossOrigin="anonymous" x="0" y="0"></image></pattern><marker id="SvgjsMarker1187" markerWidth="16" markerHeight="12" refX="16" refY="6" viewBox="0 0 16 12" orient="auto" markerUnits="userSpaceOnUse"><path id="SvgjsPath1188" d="M0 2L14 6L0 11L0 2 " fill="#323232" stroke="#323232" stroke-width="2"></path></marker><marker id="SvgjsMarker1195" markerWidth="16" markerHeight="12" refX="16" refY="6" viewBox="0 0 16 12" orient="auto" markerUnits="userSpaceOnUse"><path id="SvgjsPath1196" d="M0 2L14 6L0 11L0 2 " fill="#323232" stroke="#323232" stroke-width="2"></path></marker><marker id="SvgjsMarker1199" markerWidth="16" markerHeight="12" refX="16" refY="6" viewBox="0 0 16 12" orient="auto" markerUnits="userSpaceOnUse"><path id="SvgjsPath1200" d="M0 2L14 6L0 11L0 2 " fill="#323232" stroke="#323232" stroke-width="2"></path></marker><marker id="SvgjsMarker1207" markerWidth="16" markerHeight="12" refX="16" refY="6" viewBox="0 0 16 12" orient="auto" markerUnits="userSpaceOnUse"><path id="SvgjsPath1208" d="M0 2L14 6L0 11L0 2 " fill="#323232" stroke="#323232" stroke-width="2"></path></marker><marker id="SvgjsMarker1215" markerWidth="16" markerHeight="12" refX="16" refY="6" viewBox="0 0 16 12" orient="auto" markerUnits="userSpaceOnUse"><path id="SvgjsPath1216" d="M0 2L14 6L0 11L0 2 " fill="#323232" stroke="#323232" stroke-width="2"></path></marker><marker id="SvgjsMarker1223" markerWidth="16" markerHeight="12" refX="16" refY="6" viewBox="0 0 16 12" orient="auto" markerUnits="userSpaceOnUse"><path id="SvgjsPath1224" d="M0 2L14 6L0 11L0 2 " fill="#323232" stroke="#323232" stroke-width="2"></path></marker><marker id="SvgjsMarker1231" markerWidth="16" markerHeight="12" refX="16" refY="6" viewBox="0 0 16 12" orient="auto" markerUnits="userSpaceOnUse"><path id="SvgjsPath1232" d="M0 2L14 6L0 11L0 2 " fill="#323232" stroke="#323232" stroke-width="2"></path></marker><marker id="SvgjsMarker1243" markerWidth="16" markerHeight="12" refX="16" refY="6" viewBox="0 0 16 12" orient="auto" markerUnits="userSpaceOnUse"><path id="SvgjsPath1244" d="M0 2L14 6L0 11L0 2 " fill="#323232" stroke="#323232" stroke-width="2"></path></marker></defs><g id="SvgjsG1127" transform="translate(311.0749816894531,112.4999885559082)"><path id="SvgjsPath1128" d="M0 0L59.50001525878906 0L59.50001525878906 58.999977111816406L0 58.999977111816406Z " stroke="none" fill="url(#SvgjsPattern1129)"></path></g><g id="SvgjsG1131" transform="translate(68.78750832907849,109)"><path id="SvgjsPath1132" d="M0 0L55.787488619163696 0L55.787488619163696 56.146755986929094L0 56.146755986929094Z " stroke="none" fill="url(#SvgjsPattern1133)"></path></g><g id="SvgjsG1135" transform="translate(293.5749969482422,67.5000114440918)"><path id="SvgjsPath1136" d="M0 4Q0 0 4 0L105 0Q109 0 109 4L109 37.4999885559082Q109 41.4999885559082 105 41.4999885559082L4 41.4999885559082Q0 41.4999885559082 0 37.4999885559082Z " stroke="rgba(255,153,204,1)" stroke-width="2" fill-opacity="1" fill="#ff9999"></path><g id="SvgjsG1137"><text id="SvgjsText1138" font-family="微软雅黑" text-anchor="middle" font-size="14px" width="87" fill="#323232" font-weight="700" align="middle" font-style="" opacity="1" y="1.1499942779541015" transform="rotate(0)"><tspan id="SvgjsTspan1139" dy="17" x="55"><tspan id="SvgjsTspan1140" style="text-decoration:;">DHCP服务器 </tspan></tspan><tspan id="SvgjsTspan1141" dy="17" x="55"><tspan id="SvgjsTspan1142" style="text-decoration:;"> 推送路由</tspan></tspan></text></g></g><g id="SvgjsG1143" transform="translate(226.07498168945312,25)"><path id="SvgjsPath1144" d="M0 0L90 0L106 16L106 29L0 29L0 0Z " stroke="none" fill-opacity="1" fill="#ffffaa"></path><path id="SvgjsPath1145" d="M90 0L90 16L106 16Z " stroke="none" fill-opacity="1" fill="#cdcdcd"></path><path id="SvgjsPath1146" d="M0 0L90 0L106 16L106 29L0 29L0 0Z " stroke="none" fill="none"></path><g id="SvgjsG1147"><text id="SvgjsText1148" font-family="微软雅黑" text-anchor="middle" font-size="13px" width="65" fill="#323232" font-weight="700" align="middle" font-style="" opacity="1" y="4.55" transform="rotate(0)"><tspan id="SvgjsTspan1149" dy="16" x="53.5"><tspan id="SvgjsTspan1150" style="text-decoration:;">公网服务器</tspan></tspan></text></g></g><g id="SvgjsG1151" transform="translate(49.01686072998018,171.4999656677246)"><path id="SvgjsPath1152" d="M0 4Q0 0 4 0L86.11624191894578 0Q90.11624191894578 0 90.11624191894578 4L90.11624191894578 16.148351694610028Q90.11624191894578 20.148351694610028 86.11624191894578 20.148351694610028L4 20.148351694610028Q0 20.148351694610028 0 16.148351694610028Z " stroke="rgba(255,153,204,1)" stroke-width="2" fill-opacity="1" fill="#ff9999"></path><g id="SvgjsG1153"><text id="SvgjsText1154" font-family="微软雅黑" text-anchor="middle" font-size="14px" width="70" fill="#323232" font-weight="700" align="middle" font-style="" opacity="1" y="-1.025824152694986" transform="rotate(0)"><tspan id="SvgjsTspan1155" dy="17" x="46"><tspan id="SvgjsTspan1156" style="text-decoration:;">网关服务器</tspan></tspan></text></g></g><g id="SvgjsG1157"><path id="SvgjsPath1158" d="M311.0749816894531 141.9999771118164C224.3075504303129 141.9999771118164 162.5749969482422 55 96.68125263866034 109 " stroke="#323232" stroke-width="2" fill="none" marker-end="url(#SvgjsMarker1159)"></path><rect id="SvgjsRect1161" width="52" height="16" x="170.0504845579723" y="97.2499885559082" fill="#ffffff"></rect><text id="SvgjsText1162" font-family="微软雅黑" text-anchor="middle" font-size="13px" width="52" fill="#323232" font-weight="700" align="top" font-style="" opacity="1" y="95.2999885559082" transform="rotate(0)"><tspan id="SvgjsTspan1163" dy="16" x="196.0504845579723"><tspan id="SvgjsTspan1164" style="text-decoration:;">转发流量</tspan></tspan></text></g><g id="SvgjsG1165"><path id="SvgjsPath1166" d="M124.57499694824219 137.07337799346453C212.1642649110975 137.07337799346453 230.5749969482422 184 340.82498931884766 171.4999656677246 " stroke="#323232" stroke-width="2" fill="none" marker-end="url(#SvgjsMarker1167)"></path><rect id="SvgjsRect1169" width="55" height="16" x="196.70222148063863" y="150.97418470519784" fill="#ffffff"></rect><text id="SvgjsText1170" font-family="微软雅黑" text-anchor="middle" font-size="13px" width="54" fill="#323232" font-weight="700" align="top" font-style="" opacity="1" y="149.02418470519785" transform="rotate(0)"><tspan id="SvgjsTspan1171" dy="16" x="224.20222148063863"><tspan id="SvgjsTspan1172" style="text-decoration:;">NAT转换</tspan></tspan></text></g><g id="SvgjsG1173" transform="translate(279.5749969482422,266)"><path id="SvgjsPath1174" d="M0 0L48 0L48 49L0 49Z " stroke="none" fill="url(#SvgjsPattern1175)"></path></g><g id="SvgjsG1177" transform="translate(382.0749816894531,266)"><path id="SvgjsPath1178" d="M0 0L42 0L42 43.85319823670375L0 43.85319823670375Z " stroke="none" fill="url(#SvgjsPattern1179)"></path></g><g id="SvgjsG1181" transform="translate(166.5749969482422,255.92659911835187)"><path id="SvgjsPath1182" d="M0 0L64 0L64 64L0 64Z " stroke="none" fill="url(#SvgjsPattern1183)"></path></g><g id="SvgjsG1185"><path id="SvgjsPath1186" d="M198.5749969482422 255.92659911835187C198.5749969482422 189.75963846245486 249.5749969482422 236 340.82498931884766 171.4999656677246 " stroke="#323232" stroke-width="2" fill="none" marker-end="url(#SvgjsMarker1187)"></path><rect id="SvgjsRect1189" width="26" height="16" x="222.48124599456787" y="205.08818502168015" fill="#ffffff"></rect><text id="SvgjsText1190" font-family="微软雅黑" text-anchor="middle" font-size="13px" width="26" fill="#323232" font-weight="700" align="top" font-style="" opacity="1" y="203.13818502168016" transform="rotate(0)"><tspan id="SvgjsTspan1191" dy="16" x="235.48124599456787"><tspan id="SvgjsTspan1192" style="text-decoration:;">请求</tspan></tspan></text></g><g id="SvgjsG1193"><path id="SvgjsPath1194" d="M303.5749969482422 266C303.5749969482422 225.3693348901864 340.82498931884766 212.13063077753822 340.82498931884766 171.4999656677246 " stroke="#323232" stroke-width="2" fill="none" marker-end="url(#SvgjsMarker1195)"></path></g><g id="SvgjsG1197"><path id="SvgjsPath1198" d="M403.0749816894531 266C403.0749816894531 220.73576592683065 340.82498931884766 216.76419974089396 340.82498931884766 171.4999656677246 " stroke="#323232" stroke-width="2" fill="none" marker-end="url(#SvgjsMarker1199)"></path><rect id="SvgjsRect1201" width="26" height="16" x="358.9499855041504" y="210.7499828338623" fill="#ffffff"></rect><text id="SvgjsText1202" font-family="微软雅黑" text-anchor="middle" font-size="13px" width="26" fill="#323232" font-weight="700" align="top" font-style="" opacity="1" y="208.79998283386232" transform="rotate(0)"><tspan id="SvgjsTspan1203" dy="16" x="371.9499855041504"><tspan id="SvgjsTspan1204" style="text-decoration:;">请求</tspan></tspan></text></g><g id="SvgjsG1205"><path id="SvgjsPath1206" d="M370.5749969482422 141.9999771118164C432.74486408987036 141.9999771118164 486.2448488310813 287.9265991183519 424.0749816894531 287.9265991183519 " stroke="#323232" stroke-width="2" fill="none" marker-end="url(#SvgjsMarker1207)"></path><rect id="SvgjsRect1209" width="52" height="16" x="417.9523896750688" y="206.96328811508414" fill="#ffffff"></rect><text id="SvgjsText1210" font-family="微软雅黑" text-anchor="middle" font-size="13px" width="52" fill="#323232" font-weight="700" align="top" font-style="" opacity="1" y="205.01328811508415" transform="rotate(0)"><tspan id="SvgjsTspan1211" dy="16" x="443.9523896750688"><tspan id="SvgjsTspan1212" style="text-decoration:;">转发流量</tspan></tspan></text></g><g id="SvgjsG1213"><path id="SvgjsPath1214" d="M340.82498931884766 171.4999656677246C340.82498931884766 219.3941331103748 375.4691643908924 290.5 327.5749969482422 290.5 " stroke="#323232" stroke-width="2" fill="none" marker-end="url(#SvgjsMarker1215)"></path><rect id="SvgjsRect1217" width="52" height="16" x="326.16030592453876" y="240.96029562485614" fill="#ffffff"></rect><text id="SvgjsText1218" font-family="微软雅黑" text-anchor="middle" font-size="13px" width="52" fill="#323232" font-weight="700" align="top" font-style="" opacity="1" y="239.01029562485616" transform="rotate(0)"><tspan id="SvgjsTspan1219" dy="16" x="352.16030592453876"><tspan id="SvgjsTspan1220" style="text-decoration:;">转发流量</tspan></tspan></text></g><g id="SvgjsG1221"><path id="SvgjsPath1222" d="M340.82498931884766 171.4999656677246C302.5749969482422 235 254.5749969482422 285 230.5749969482422 287.9265991183519 " stroke="#323232" stroke-width="2" fill="none" marker-end="url(#SvgjsMarker1223)"></path><rect id="SvgjsRect1225" width="52" height="16" x="254.35624599456787" y="244.42832059825957" fill="#ffffff"></rect><text id="SvgjsText1226" font-family="微软雅黑" text-anchor="middle" font-size="13px" width="52" fill="#323232" font-weight="700" align="top" font-style="" opacity="1" y="242.4783205982596" transform="rotate(0)"><tspan id="SvgjsTspan1227" dy="16" x="280.35624599456787"><tspan id="SvgjsTspan1228" style="text-decoration:;">转发流量</tspan></tspan></text></g><g id="SvgjsG1229"><path id="SvgjsPath1230" d="M279.0749816894531 54C279.0749816894531 91.45503111023717 273.619950579216 141.9999771118164 311.0749816894531 141.9999771118164 " stroke="#323232" stroke-width="2" fill="none" marker-end="url(#SvgjsMarker1231)"></path></g><g id="SvgjsG1233" transform="translate(64.07498168945312,25)"><path id="SvgjsPath1234" d="M0 0L90 0L106 16L106 29L0 29L0 0Z " stroke="none" fill-opacity="1" fill="#ffffaa"></path><path id="SvgjsPath1235" d="M90 0L90 16L106 16Z " stroke="none" fill-opacity="1" fill="#cdcdcd"></path><path id="SvgjsPath1236" d="M0 0L90 0L106 16L106 29L0 29L0 0Z " stroke="none" fill="none"></path><g id="SvgjsG1237"><text id="SvgjsText1238" font-family="微软雅黑" text-anchor="middle" font-size="13px" width="52" fill="#323232" font-weight="700" align="middle" font-style="" opacity="1" y="4.55" transform="rotate(0)"><tspan id="SvgjsTspan1239" dy="16" x="53.5"><tspan id="SvgjsTspan1240" style="text-decoration:;">内网设备</tspan></tspan></text></g></g><g id="SvgjsG1241"><path id="SvgjsPath1242" d="M64.07498168945312 39.5C25.000136583406317 39.5 29.712663223031683 137.07337799346453 68.78750832907849 137.07337799346453 " stroke="#323232" stroke-width="2" fill="none" marker-end="url(#SvgjsMarker1243)"></path></g><g id="SvgjsG1245" transform="translate(175.29592883911118,317.0741529591214)"><path id="SvgjsPath1246" d="M0 4Q0 0 4 0L42.55813621826201 0Q46.55813621826201 0 46.55813621826201 4L46.55813621826201 16Q46.55813621826201 20 42.55813621826201 20L4 20Q0 20 0 16Z " stroke="rgba(255,153,204,1)" stroke-width="2" fill-opacity="1" fill="#ff9999"></path><g id="SvgjsG1247"><text id="SvgjsText1248" font-family="微软雅黑" text-anchor="middle" font-size="14px" width="18" fill="#323232" font-weight="700" align="middle" font-style="" opacity="1" y="-1.1" transform="rotate(0)"><tspan id="SvgjsTspan1249" dy="17" x="24"><tspan id="SvgjsTspan1250" style="text-decoration:;">PC</tspan></tspan></text></g></g><g id="SvgjsG1251" transform="translate(275.7959288391112,317.0741529591214)"><path id="SvgjsPath1252" d="M0 4Q0 0 4 0L51.55813621826201 0Q55.55813621826201 0 55.55813621826201 4L55.55813621826201 16Q55.55813621826201 20 51.55813621826201 20L4 20Q0 20 0 16Z " stroke="rgba(255,153,204,1)" stroke-width="2" fill-opacity="1" fill="#ff9999"></path><g id="SvgjsG1253"><text id="SvgjsText1254" font-family="微软雅黑" text-anchor="middle" font-size="14px" width="28" fill="#323232" font-weight="700" align="middle" font-style="" opacity="1" y="-1.1" transform="rotate(0)"><tspan id="SvgjsTspan1255" dy="17" x="28.5"><tspan id="SvgjsTspan1256" style="text-decoration:;">移动</tspan></tspan></text></g></g><g id="SvgjsG1257" transform="translate(375.2959135803221,317.0741529591214)"><path id="SvgjsPath1258" d="M0 4Q0 0 4 0L51.55813621826201 0Q55.55813621826201 0 55.55813621826201 4L55.55813621826201 16Q55.55813621826201 20 51.55813621826201 20L4 20Q0 20 0 16Z " stroke="rgba(255,153,204,1)" stroke-width="2" fill-opacity="1" fill="#ff9999"></path><g id="SvgjsG1259"><text id="SvgjsText1260" font-family="微软雅黑" text-anchor="middle" font-size="14px" width="36" fill="#323232" font-weight="700" align="middle" font-style="" opacity="1" y="-1.1" transform="rotate(0)"><tspan id="SvgjsTspan1261" dy="17" x="28.5"><tspan id="SvgjsTspan1262" style="text-decoration:;">IPAD</tspan></tspan></text></g></g></svg> <div class="tip inlineBlock warning"> **提示:阅读本文需要一定的网络知识** </div> <!--more--> <div class="tip inlineBlock success"> **优点** </div> **1**. 没有公网<code>IP</code>也可以,只要一台有网络足够快的设备当服务器就可以,如果有公网<code>IP</code>的服务器就更好了,没有公网<code>IP</code>的服务器就需要借助第三方的全球<code>DDNS</code>服务来实现 **2**. 兼容市面上几乎所有的设备接入 **3**. 用户安全,可以使用证书或密码验证登录,支持加密锁 **4**. 数据安全,支持多种加密方式,支持<code>SSL3.0</code> **5**. 可以穿透网络,防火墙,<code>NAT</code>等 **6**. 支持服务端相互连接,可以组建大型域级连接 **7**. 可以拆分隧道,服务端推送路由表到客户端 **8**. 可以在复杂的多个内网环境切换,不需要重新部署公网端 <!--more--> <div class="tip inlineBlock warning"> **缺点** </div> **1**. 对服务器网络要求高,所有流量都在服务器分发和中转,可以做到拆分隧道,内网流量才走服务器,只是我还没研究出来。 <!--more--> ## 穿透工具 **还是使用SoftEther这个神器** <div class="panel panel-default collapse-panel box-shadow-wrap-lg"><div class="panel-heading panel-collapse" data-toggle="collapse" data-target="#collapse-d4fdd73c97715daea7d04202e28f340423" aria-expanded="true"><div class="accordion-toggle"><span>SoftEther介绍</span> <i class="pull-right fontello icon-fw fontello-angle-right"></i> </div> </div> <div class="panel-body collapse-panel-body"> <div id="collapse-d4fdd73c97715daea7d04202e28f340423" class="collapse collapse-content"><p></p><code>SoftEther</code>起源筑波大学的一个学术项目,它可以在<code>Windows|Linux|Mac|FreeBSD</code>和<code>Solaris</code>上运行<code>SoftEther</code>是开源的。可以将<code>SoftEther</code>免费用于任何个人或商业用途,支持适用于<code>Windows|Vista|7|8的Microsoft|SSTP</code>不再需要为<code>WindowsServer</code>许可证使用远程访问功能支付昂贵的费用。强大<code>SSL</code>协议,可以穿透任何类型的防火墙。超优化<code>SSL</code>协议具有非常快的吞吐量,低延迟和防火墙抵抗力。<p></p></div></div></div> ## 共享原理 内网设备为网关,公网设备为<code>DHCP</code>,完全虚拟一个路由器的环境  <h2>环境准备</h2> **1**.一台处于内网并且可以访问互联网的机器 (<code>windows</code>系统最好,方便操作) **2**.一台拥有公网<code>IP</code>的服务器 (操作系统无所谓) ## 部署过程 ### 1.公网服务器部署参考这篇文章 <div class="preview"> <div class="post-inser post box-shadow-wrap-normal"> <a href="https://www.itggg.cn/xuexi/90.html" target="_blank" class="post_inser_a no-external-link no-underline-link"> <div class="inner-image bg" style="background-image: url(https://img-1259793745.itggg.cn/20201222182909.jpg);background-size: cover;"></div> <div class="inner-content" > <p class="inser-title">搭建远程局域网</p> <div class="inster-summary text-muted"> local area network scope definition 1. 没有公网IP也可以,只要一... </div> </div> </a> <!-- .inner-content #####--> </div> <!-- .post-inser ####--> </div> ### 2.内网服务器部署图文过程 下载服务端安装,官方下载可能有点慢,也可以在本站的网盘下载 [官方下载][3] [本站网盘][4] <div class='album_block'> [album]          [/album] </div> ## 公网服务器设置 公网服务器这头,进入到虚拟NAT和虚拟DHCP服务器 **1**.虚拟主机网络接口设置:<code>IP</code>地址设置为你网段里的任意一个<code>IP</code>都可以,不要是网关<code>IP</code>就可以了,其他默认 **2**.虚拟<code>NAT</code>设置: 公网服务器这头取消掉,内网机器那头不要取消 **3**.虚拟<code>DHCP</code>服务器,定义你的网段,具体设置可自行根据需求来就行了 **4**.应用到客户端的选项:网关地址就填写你内网机器那台的<code>IP</code>地址,只有把他作为网关才可以实现内网共享,<code>DNS</code>配置下就完事  ## 常见问题 **1.怎么使用?** 按照上面的方法搭建和设置完毕,然后你需要使用的设备直接连接到你的公网服务器上就可以了,怎么连接在上面的参考文章里有,连接上后,你的设备网络环境就已经**完全处于内网那台设备的网络环境**了。 **2.连接上的设备没有互联网?** 因为应用的内网设备作为网关,所以要在公网服务器那头把<code>DNS</code>配上就可以了。 **3.为什么本机的速度都很慢?** **解决方法一**: 呃,这个嘛,前面就已经说了,要经过服务器转发的,所有速度还是受服务器的公网带宽限制的,而且你本机所有的流量都是走的服务器,所以不管你是访问的内网,还是互联网,都是走的服务器。可以用拆分隧道,由公网服务端推送一条路由信息到连接上的客户端来解决这个问题,访问内网的流量才走服务器,互联网和其他网络还是走本地,这个需要非常专业的网络知识,实验过几次,推送也成功了,但是流量还是走的服务器,我也没彻底搞明白这个路由推送是怎么定义的,有需求的可以自己研究研究,给一个参考文章可以看看。<code>SoftEther</code>在官方下载的版本都不支持推送路由,会提示<code>“未在开源版本上实施” </code> 实际上是官方在源码里就禁止了,在本站的网盘里有我重新编译好的<code>windows</code>版本,可以使用这个功能。 **其他解决办法:见后记2** <div class='album_block'> [album]   [/album] </div> **解决方法二:** 安装<code>SoftEthers</code>配套的客户端,用配套的客户端来连接,客户端在本站网盘有下载的。然后在 **高级设置**里勾选,**不要调整路由表**,这样走内网和外网的流量就分开了。 <div class='album_block'> [album]   [/album] </div> **4.链接不上?** 检查内网设备上设置的网段和公网服务器的网段是不是一样的,然后依次按照部署过程检查一遍,如果还是不行,检查你内网的机器能不能访问互联网,虚拟<code>HUB</code>的级联有没有掉线。 **5.多网络怎么切换** 通过上面的教程就知道了,原理其实就是在于公网服务器把内网的机器作为网关来使用的,如果要在多种网络环境切换,只用在要共享的那个网络环境里找一台设备部署,让后设置下<code>IP</code>地址就可以了,然后把公网服务器的网关换成你内网的<code>IP</code>就可以了,这样就可以随意切换网络。如果有多个内网环境同时运行的话,只需要在公网服务器上新建虚拟<code>HUB</code>就可以了,这样不管有多少个网络环境,只需要部署一台内网的设备,链接到公网服务器新建的虚拟<code>HUB</code>就可以了。  ## 后记 > 在漫长的岁月中,因为项目上应用的远程越来越多,我这台 `5M`带宽的小水管不堪重负,有时候还会拖慢网站的访问速度,没办法,继续研究这个拆分隧道,终于成功 <img src="https://www.itggg.cn/usr/themes/handsome/assets/img/emotion/aru/insidious.png" class="emotion-aru"> 上面提出的 **“解决方法二”** 还是有问题,请直接放弃,以下先来一波效果图 <div class="tip inlineBlock warning"> 路由推送成功,内外网的流量已经分开了,访问百度和内网地址测试,访问速度提升非常大 </div> <div class='album_block'> [album]   [/album] </div> ### 实现方法 只修改公网服务器这头,编辑推送的路由规则,然后去掉应用到客户端的选项,然后保存。 <div class="tip inlineBlock error"> 路由的推送规则:内网地址/子网掩码/网关</br> 示例:10.0.0.0/255.0.0.0/10.200.30.1</br> 说明:访问10这段的地址,都使用10.200.30.1网关</br> 其他:依次类推,可以添加多条路由推送 </div> <div class='album_block'> [album]   [album] ### 客户端设置 客户端对应的也要设置下,不管是安装的 `SoftEther`客户端还是 `L2TP`连接方式或者别的,都要改下。 **1**.打开网卡设置,点击 `Internet 协议版本4(TCP/IPv4)`,选择高级,去掉远程网关,修改跃点数为 `100` [album]    [/album] </div> <div class="tip inlineBlock success"> 这样就搞定了,此时你再连接到服务器上去,就可以看看效果了 </div> ## 后记2 > 在做路由推送的时候,会提示 “未在开源版本上实施” 可以修改配置文件实现 > - lang.cnf里面改成en > - ddns再禁用就行了 [1]: https://pic4.zhimg.com/80/v2-9caaaf45d811e711f3cca85a8238c31b_720w.jpg [3]: https://www.softether-download.com/files/softether/v4.34-9745-beta-2020.04.05-tree/Windows/SoftEther_VPN_Server_and_VPN_Bridge/ [4]: https://p.itggg.cn [15]: https://mawenjian.net/p/1456.html Last modification:May 31, 2022 © Reprint prohibited Support Appreciate the author AliPayWeChat Like 2 如果你想请我喝奶茶的话
13 comments
本站网盘打不开?
学习一下,有空试验一下。有个想法需要用到内网穿透,不然我就用花生壳了~
可以试试,我一直都在用这个来往项目上的一些内网网络,很稳定,花生壳限制太多了。
大佬,如果把国外的服务器当网关使,那原理上来说就是可以上外网了?
求解答?
原理上来说是可以的,但是涉及到速度问题了,DHCP服务器的带宽要够大才行。
电信用户表示用不上
不会啊。这个和运营商没有关系,只要有互联网就可以了
我的意思是说电信有公网IP,不需要内网穿透
噢
这篇文章不是表示的组网,而是穿透远程网络的内网环境,和公网IP没关系
不错学习了
不然就要花大笔钱搞花生壳儿了 
花生壳