what is the best way to configure Ubuntu to use a SOCKS5 proxy for all network traffic? Server is ubuntu server. I want to push all outbound traffic through the proxy (apt-get, http, https, etc). Everything but ssh should hit the proxy server.
Each command has its own configuration parameters and/or configuration files to use proxy servers. For example,
w3m recognizes the
HTTP_PROXY environment variable and uses it as a proxy if defined.
wget also has options related to proxy settings.
apt-get can be configured also to use a proxy server (or better apt-cacher to cache your downloaded packages for future installs/upgrades).
At the very least, you can use
iptables to redirect all you outgoing traffic to a specific proxy.
$ sudo iptables -t nat -A OUTPUT -p tcp --dport 80 -j DNAT --to-destination proxy_ip:proxy_port
Adding a rules such as the above is enough to transparently redirect all outgoing traffic to your proxy server. Of course, you can customize the rule according to your needs like forwarding other ports.