小编Sha*_*ism的帖子

使用 NAT 网络通过 SSH 连接到 Vmware 虚拟机

现在我能够ssh通过互联网ssh托管以及从主机到虚拟机。我想要做的是ssh从外面直接到Guest机器。

我尝试使用iptables以下方法执行此操作:

iptables -t nat -A PREROUTING -m tcp -p tcp --dport 2222 -j DNAT --to-destination 192.168.130.128:22
Run Code Online (Sandbox Code Playgroud)

并且还打开了这个相关的端口UFW

ufw allow routed
ufw allow outgoing
ufw deny incoming
ufw allow 2222/tcp
Run Code Online (Sandbox Code Playgroud)

重新加载防火墙后,远程ssh将冻结debug1: Connecting to x.x.x.x [x.x.x.x] port 2222并使用tcpdump -i vmnet8 'port 22'我可以看到:

listening on vmnet8, link-type EN10MB (Ethernet), capture size 65535 bytes
18:56:03.002790 IP x.x.x.x.13203 > y.y.y.y.ssh: Flags [S], seq 1077492285, win 29200, options [mss …
Run Code Online (Sandbox Code Playgroud)

linux ssh iptables vmware-player macos

9
推荐指数
1
解决办法
1297
查看次数

标签 统计

iptables ×1

linux ×1

macos ×1

ssh ×1

vmware-player ×1