Interview Prep/Linux/Networking, SSH & Scheduling

Explain SSH local, remote and dynamic port forwarding.

AdvancedConceptNetworking, SSH & Scheduling
Answer
# Local: localhost:5433 -> (via bastion) -> db.internal:5432
ssh -N -L 5433:db.internal:5432 bastion
# Remote: expose my local :3000 as :8080 on the server
ssh -N -R 8080:localhost:3000 server
# Dynamic: SOCKS5 proxy on localhost:1080
ssh -N -D 1080 bastion

-N means no remote command. Remote forwards bind only to loopback unless GatewayPorts is enabled on the server.

All Linux questions Roadmap: Linux

More on Networking, SSH & Scheduling