Is there a web proxy on your university network? If so, use it for normal web browsing, but not to access blocked sites.
Otherwise, it's possible, but not very easy. Routing (i.e. deciding where to send packets to) is performed at the IP level, which only knows about IP addresses. On the other hand, your routing requirement is based on a host name, but the layer that knows about the names has no control over routing.
I think any solution will involve a web proxy. (I'm assuming that for other protocols, you'll always use a particular network.) The web proxy itself isn't going to do anything other than relay requests, so any will do: a big one (squid
), one specialized for cacheing (wwwoffle
), a simple tiny one (tinyproxy
), etc. (aptitude search web proxy; aptitude search http proxy
).
Now, for the solution I'm proposing (there may be other ways), don't configure your proxy in any special way (i.e. make it relay all requests), but run it as a dedicated user: create a user alt-routed
with no special privilege, and arrange for the proxy to run as this user.
Then, make wlan0
the default route. Then set up iptables and install the iproute
package. The rules you want are to direct outgoing packets that came from a process running as the alt-route-user
to the ppp0
interface. There's no direct way to do it, but it can be done by:
- specially marking (with the mark 1) outgoing packets from user
alt-routed
;
- using a different routing table (table 1) for packets marked with this mark;
- routing everything to the alternate interface in this table.
If I understand the documentation correctly, this should work:
iptables -t mangle -A OUTPUT -m owner --uid-owner alt-routed -o wlan0 -j MARK --set-mark 1
ip rule add fwmark 1 table 1
ip route add 0.0.0.0/0 table 1 dev ppp0
Note that this is well beyond my common usage of these tools, so I might have gotten these commands completely wrong. Confirmations or corrections welcome.
Any program you run as alt-routed
will access the Internet via ppp0
instead of the default wlan0
.
Finally, configure your browsers to go through the proxy for sites that you want to access over ppp0
, and not to go through the proxy for sites that you want to access through wlan0
. There are several ways to do that, depending on what browser(s) you're targetting and whether you want a GUI or are willing to edit a configuration file.