Curretly I have two machines. One with public ip named login and another one are in the same innet named admin. Here is what I want:
- When I use
ssh -p 23 login, I can login to admin via22port inadmin.
I tried two ways:
Change
PREROUTINGandINPUTchain iniptables, forward23in login to22in admin. This didn't work.Use Local forwarding in
loginor reverse forwarding inadmin.
This way seems to work. however, I can only use ssh -p 23 localhost within login computer and failed when I try to connect admin in another computer with ssh -p 23 login. I thought this is very close to what I want, but can't figure out how to fix it.
The command I used:
# in admin
ssh -N -R 0.0.0.0:23:localhost:22 login
or
# in login
ssh -N -L 0.0.0.0:23:localhost:22 admin
update
After I changed the port 23 to 222 or any other port, It worked.
It could because 23 a port used by telnet(However this port is not occupied by any program.)