How about using domain instead of IP address?
1. Register a new domain (or subdomain) that will be used to access user accounts. Let's call it EXAMPLE.COM
2. Configure wildcard DNS record for example.com so that anything.example.com or even anything.anythingelse.example.com resolves to your server's main IP.
3. Create a custom apache template virtual_host.conf (or virtual_host2.conf) where this line
PHP:
ServerAlias www.|DOMAIN| |DOMAIN| |SERVER_ALIASES|
is replaced with
PHP:
ServerAlias www.|DOMAIN| |DOMAIN| |SERVER_ALIASES| |DOMAIN|.example.com
Now, when you create a new hosting account with 2 domains, for example, for mydomain.com and myotherdomain.com they can be accessed as mydomain.com.example.com and myotherdomain.com.example.com.