boottp
boottp

Reputation: 1

Avoid port-forwarding

I have a dd-wrt router where I setup a ssh port-forwarding rule to redirect each WAN request towards a host in the private LAN that at the moment is unavailable. Is it possible to avoid the firewall redirection with a ssh parameter and connect directly to the router via ssh ? Note: At the moment I haven't direct access to the router.

Upvotes: -2

Views: 345

Answers (1)

James Fry
James Fry

Reputation: 1153

One effective solution is to setup a single SSH port forward to one host on the network, and then use SSH forwarding via that host to the others.

This can be added easily to the client ssh config:

host AnyNameYouLike
    Hostname remoteHostnameOrIp
        Proxycommand ssh -q [email protected] nc -q0 %h %p
        User remoteHostnameOrIpUser
        IdentityFile ~/.ssh/remoteHostnameOrIp_id_rsa

You can omit the IdentityFile line if you prefer alternative authentication. If you set up an entry for [email protected] too you can have completely passwordless and transparent proxying.

Further, you can use wildcards, and have ssh automatically ssh via the proxy for any matching host, eg:

host 10.10.10.*
    proxycommand ssh -q [email protected] nc -q0 %h %p

Upvotes: 0

Related Questions