I got a public-IP assigned to a couple of machines that are behind a router.Say[M1,M2,M3]

Can I login to M1, M2, M3 respectively through different ports from anywhere in the world?

For now, I can ping the Public-Ip

ping x.x.x.x
PING x.x.x.x (x.x.x.x): 56 data bytes
64 bytes from x.x.x.x: icmp_seq=0 ttl=57 time=31.424 ms
64 bytes from x.x.x.x: icmp_seq=1 ttl=57 time=35.152 ms
64 bytes from x.x.x.x: icmp_seq=2 ttl=57 time=35.229 ms

How do I configure to use the same public/Floating-IP to access all the three machines but on different SSH port?

Can anyone please help me on this ?

  • you did not say what you are trying to configure ... an app? a router?
    – jsotola
    May 26, 2020 at 15:33

1 Answer 1


Yes, you can do this. You don't have quite enough detail in your post to know what exactly to suggest, but you just need to do port forwarding on the router. In general the ssh server listens on port 22.

So in your case you can forward a different port for each of your machines:

router:2122 -> M1:22
router:2222 -> M2:22
router:2322 -> M3:22

How you do this specifically, depends on the software running on the router. If you have a GUI there is almost certainly a port forward option.


This site is temporarily in read-only mode and not accepting new answers.

Not the answer you're looking for? Browse other questions tagged .