This is kind of multi-layered.
Firstly, you need to setup a CNAME record for sub1.com to point to sub1.domain.com. This is done via whoever is hosting the DNS for sub1.com. You should more than likely have a control panel at either your hosting company or your domain name registrar to add this.
All this does however is tell clients that your website sub1.com lives at a certain IP address (i.e. in the case of a CNAME, it says, look up the IP of sub1.domain.com and sub1.com lives at the same location.)
Secondly, you need to tell your webserver that sub1.com and sub1.domain.com are the same site.
For Apache, you probably already have a <VirtualHost>
setup, so you would add in a ServerAlias directive to tell Apache that the VirtualHost also serves sub1.com as well as sub1.domain.com
... signifies that you have your own configuration directives in here already.
<VirtualHost ...>
ServerName sub1.domain.com
ServerAlias sub1.com
...
</VirtualHost>
Thirdly and lastly, you need to make sure that your site doesn't redirect or reference sub1.domain.com within the code (i.e. Header redirects through PHP, meta tag refreshes, or a href
links within the HTML to redirect the user outside of the current domain).
Links should have absolute paths without the domain, e.g. 1 not 2
1.
<a href="/blah.html">Blah</a>
2.
<a href="http://sub1.domain.com/blah.html">Blah</a>