ssh -D 12345 -C -q -N <username>@<ip or FQDN> -p 23456
Explanation
-D ssh will act as a SOCKS server for the given port
-C Compress data
-q quiet mode. warning and diagnostic messages will be suppressed
-N Do not execute a remote command. just forwarding ports.
<username>@<ip or FQDN> Connection string to SSH server
-p SSH server port. (if it's usual port 22, you can ignore this parameter)
In addition to above options you can use -f option to push ssh command to background
Executing above command will create a SSH tunnel which supports SOCKS protocol.
How to configure Firefox to use the SSH tunnel
Go to proxy settings and use localhost as "SOCKS Host" and the port you used for the tunnel as the Port (see the screenshot below)
How to configure Firefox to forward DNS queries to the SSH tunnel
Use "Proxy DNS when using SOCKS v5" in proxy settings or set "network.proxy.socks_remote_dns" to "true" via about:config to get DNS queries resolved via the tunnel. Otherwise the browser will use DNS server configured in your network interface or ISP's DNS servers.
Important: Please read http://swapoff.blogspot.com/2018/08/avoid-webrtc-leak-if-you-use-browser.html for instructions to disable WebRTC.