Sometimes I work in place where I have free wifi, but it requires proxy - and it work only for http(s). In my work I need ssh sometimes. I bought a G4 card, but it has transfer limit so I would like to use G4 only for ssh, and in browser use proxy only. How to configure it properly on ubuntu?
You should aim for a customized routing table. The way you describe your problem, you want the following:
I must confess I'm not much of a GUI user in things like these. I know you could set up the routing table like this using the rourte command line tool. You'd basically add a route to the specific target through the default gateway of the device in question. You could even write a script to automate the process, once you've worked out the commands to use.
I guess there are ways to achieve similar effects using the Ubuntu graphical user interface tools. Someone else might know that detail. Answers to questions bearing the routing tag might also provide useful information on that, although I haven't found a GUI tutorial on custom routes at my first glance.