SSH config for multiple hops in Linux

Often some hosts in corporate network are available only from several gateway machines. The scheme looks like that: you connect to gateway ssh -A gateway.public.net and then to desired host from gateway machines ssh -A host.private.net. But the problem arises when you want to copy or download something from host.private.net. You have to do it in two hops, because host.private.net is not available from your machine directly. The solution is ssh forwarding. Just add the following (edit according your network settings) lines to ~/.ssh/config:

Configuration of hosts for convenient ssh connections

It is possible to save configuration of ssh connection for later usage. For example, one had to type

ssh <username>@<ip address> -p <port> -i <path to key file>

every time one wants to connect to server.