老哥们,请教个网络问题。

2021-04-14 11:59:49 +08:00
 sorasyl
现有内网机 windows 一台,linux 服务器一台,linux 能访问外网,windows 能 ssh 连接 linux

如何让 windows 连接外网?

有个关键字就可以了,谢谢
3395 次点击
所在节点    宽带症候群
24 条回复
coderfox
2021-04-14 12:00:56 +08:00
- SSH tunneling: Forward a specific port (localhost:9999 to example.org:80) along with disabling pseudo-[t]ty allocation and executio[n] of remote commands:
ssh -L 9999:example.org:80 -N -T username@remote_host
coderfox
2021-04-14 12:01:19 +08:00
不好意思,刚看错了,应该是这个:

- SSH tunneling: Dynamic port forwarding (SOCKS proxy on localhost:9999):
ssh -D 9999 -C username@remote_host
Jirajine
2021-04-14 12:08:57 +08:00
Linux 上开启 ip forward 、masqurade,并让防火墙放行转发包。
然后 Windows 把默认路由指向 Linux,就可以了。
mgrddsj
2021-04-14 12:31:51 +08:00
最简单的方法:Linux 上开个 Shadowsocks-libev,Windows 上用支持 ss 的客户端连接上就好了
seers
2021-04-14 12:38:37 +08:00
关键字 Linux server as gateway
tankren
2021-04-14 13:50:29 +08:00
linux 开转发 windows 把 linux 设成网关 或者 linux 跑 socks 代理
你先确定这样做会不会被炒鱿鱼
sorasyl
2021-04-14 14:00:48 +08:00
@tankren 啊这,太黑人了吧
catchexception
2021-04-14 14:12:52 +08:00
frp ?
sorasyl
2021-04-14 14:17:55 +08:00
感谢各位老哥指点
我试了下 socks5 代理 windows 只能跑下 http,其他的应用需要单独设置代理,用 ipforwad 做转发更好
duole
2021-04-14 14:19:24 +08:00
正向代理?
wangyaominde
2021-04-14 14:24:44 +08:00
l2tp
huangmingyou
2021-04-14 14:25:11 +08:00
windows ssh 到 linux 的时候,可以给 windows 做 socks5 代理。
nekoneko
2021-04-14 14:39:44 +08:00
代理的话可以用 v2ray
linux 上用一件脚本安装一下,然后 windows 上用 v2ray 客户端就行

https://iyideng.me/black-technology/cgfw/vmess-v2ray-server-building-and-using-tutorial.html
deviluser
2021-04-14 15:08:54 +08:00
windows 运行:
ssh -ND 1080 user@remote_ip
开启本地 1080 端口用作 socket5 代理,流量统统以 ssh 协议通过 remote 出
然后再配置 internet 属性添加局域网代理

感觉是布置的作业,你应该自己做才对。
3dwelcome
2021-04-14 15:23:05 +08:00
你们怎么都想到设置代理,难道楼主没有 linux 的 root 权限?
感觉要求就是把 linux 当成一个软路由,普通的 NAT 转发机器。
no1xsyzy
2021-04-14 15:33:29 +08:00
@3dwelcome 主要是代理想断就断
今天倒没有出现 “找网管、不要自己绕过限制” 派人士(
tankren
2021-04-14 15:38:46 +08:00
@sorasyl #7 公家的内网机不要乱搞
sorasyl
2021-04-14 16:32:56 +08:00
@3dwelcome 软路由更符合需求,但是服务器没有公网 ip,折腾了半天始终不能转发数据包
guanyin8cnq12
2021-04-14 19:09:53 +08:00
socks5 就完事了阿,或者装 shadowsocks server 和 client
oneisall8955
2021-04-14 19:31:15 +08:00
Linux iptables 开转发,window 网关设置为 Linux

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/770549

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX