A
rewrite means that you do, completely on the server side of
one server, tell your web server to interpret an URL that is requested from a browser as another URL. The client has no knowledge of the internal rewrite.
What you want is a
redirect. As you stated, this should be a 301 (permanent) redirect, not a temporary (302) redirect. This ensures that the "link juice" is transfered to the other URL.
I do this for my own blog, too.
www.magerquark.de/blog [
^] redirects to
blog.magerquark.de [
^] (both in German, you hardly will understand a word ;-)).
For IIS 6, I recommend
URL rewriter [
^], which is free of charge.
For IIS 7 and 7.5, please use the rewrite module (IIRC, it comes as an additional module to install).