This would be a documentation page, if this were not a sandbox project. But with the situation being as it is, I figured making a standing issue for documentation purposes would be a good start.

One of the first things I'd advise doing, should you be on a *nix based, single user system (like most non-windows laptops) would be to move the hosts file to your home directory someplace, and create a symlink from where it was to where it is. Here are the commands on a Mac running OSX 10.6, and from what I know of 10.7, they should still work. Likewise with any Linux platform I've used, though my experience with different distributions is somewhat limited.

$ cd
$ mkdir -p .config/System
$ cp /etc/hosts config/System
$ cd /etc
# You'll need sudo for these generally, and network access may be disabled between these next two commands
$ sudo rm hosts && sudo ln -s ~/.config/System/hosts

Then, once the above is done, you can modify your drushrc.php file, or add the following statements to it.

$command_specific['host-add']['hf'] = "$HOME/.config/System/hosts";
$command_specific['host-remove']['hf'] = "$HOME/.config/System/hosts";

----

Now, if you'd rather not do the above for whatever reason, you can always look into enabling yourself to make modifications to the hosts file without needing sudo. To do that, a key command to look into is visudo, though I have no idea how the syntax for that works (I've tried it before).

The add command appends data through drush_file_append_data() call.

The remove command copies it to another file in the same directory (adding .bak to the filename), creates a new file in that directory (with a .new added to the end), then removes the original, moves the new one to the original location, then deletes the .bak version. Each only happens if the previous operation(s) was (were) successful.

--

For the DNS flush option, this is only for convenience's sake. I've never encountered a problem with not doing this, but might as well be thorough. On OS X 10.4, 10.5 and 10.6, you do not need to use sudo for this so its simple in those cases. With 10.7, as far as I know, you need to use sudo for this by default, which means the drush command will fail when trying to do that; again I'd start with searching for visudo to change this. I can't speak for Linux environments here.