Perhaps it might help if you said what exactly you were trying to do?
Some quick pointers off the top of my head:
"stunnel" is a good program for SSL tunneling.
"ssh -L port:user@host
ort" will help with secure tunnels across a network.
iptables can be used to set up tunnels on the local machine, NATs on the local network, and so on.
Most OS level performance tuning involves changing runtime settings found under /proc (usually in your rc.local script), and has little if anything to do with tunneling.