假设有公网的机器叫P,和P处于同一网段的机器叫A,P的内网ip叫ip1,外网ip叫ip2,A的内网ip叫ip3,现在我想在家里的电脑B上访问P的10022端口,相当于访问A的22端口,请问在P,A,B三台机器上分别要怎么配置?
在P服务器上 iptables -t nat -A PREROUTING -d P-ip/32 -p tcp -m tcp --dport 10022 -j DNAT --to-destination A-ip:22
ssh隧道/端口转发
ssh -L [bind_address:]port:host:hostport