Okay, DNS:
Open /etc/hosts, add lines like this:
127.0.0.1 localhost sajid.msj subdomain.sajid.msj anothersubdomain.sajid.msj
If you want this to be available to other machines on the network, you'll need to use the intranet IP
The way I do mass hosting of subdomains is with mod_vhost_alias, like this:
sudo a2enmod vhost_alias
and then a file in /etc/apache2/sites-enabled called 000vhosting which contains:
<VirtualHost *:80>
DocumentRoot /home/nicholas/Sites/
ServerName *
# get the server name from the Host: header
UseCanonicalName Off
# this log format can be split per-virtual-host based on the first field
# LogFormat "%V %h %l %u %t \"%r\" %s %b" vcommon
LogFormat "%V %h %l %u %t \"%r\" %>s %b \"%{User-agent}i\"" vcommon
#RewriteLog /tmp/rewrite.log
#RewriteLogLevel 9
CustomLog /var/log/apache2/vhost_access.log vcommon
# include the server name in the filenames used to satisfy requests
VirtualDocumentRoot /home/nicholas/Sites/%0/public_html
VirtualScriptAlias /home/nicholas/Sites/%0/cgi-bin
</VirtualHost>
Then for every subdomain, you create a directory in wherever you put your Sites directory with the same name, and then the root of the site will point to a directory called public_html within that.
So subdomain.sajid.msj is contained in /home/nicholas/Sites/subdomain.sajid.msj/public_html