Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
517 views
in Technique[技术] by (71.8m points)

portforwarding - Local portwarding not working with IP address but working when mentioned localhost

I am trying to set up local port forwarding from my local to machine. I am using the following example to set it up

ssh -f -N -L [LOCAL_IP:]LOCAL_PORT:DESTINATION:DESTINATION_PORT [USER@]SSH_SERVER

There is daemon running on 2009 port of my remote machine. Assuming my remote IP is 10.0.0.0 I ran following to connect my localport to 2009 port of my remote.

ssh -f -N -L 2009:10.0.0.0:2009 10.0.0.0

I verified my local listening on port 2009 when i try to run lsof -i :2009. However when i try to run some command it says connection refused error. I also tested with CNAME of my remote, still would get same output: local would start listening but any command would throw connection refused error.
Also when i would use localhost instead of ssh server itself it would work perfectly fine.

ssh -f -N -L 2009:localhost:2009 10.0.0.0

Why is it working when i mention localhost but not when i actually mention the IP/CNAME of remote?

question from:https://stackoverflow.com/questions/65915471/local-portwarding-not-working-with-ip-address-but-working-when-mentioned-localho

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...